Server constructor
- McpTransport transport = McpTransport.stdio,
- bool generateJson = false,
- int port = 3000,
- String address = '127.0.0.1',
- String? toolPrefix,
- bool autoClassPrefix = false,
- bool generateMcp = true,
- bool generateRest = false,
- bool codeMode = false,
- int codeModeTimeout = 30,
- bool logErrors = false,
- ToolAnnotations? annotationsDefault,
- List<
String> corsOrigins = const ['*'],
Creates a server configuration annotation.
transport determines the communication protocol (stdio or HTTP).
generateJson controls whether to generate additional JSON metadata.
port specifies the HTTP server port (default: 3000).
address specifies the HTTP bind address (default: '127.0.0.1').
toolPrefix adds a prefix to all tool names in this scope.
autoClassPrefix automatically prefixes tool names with class name.
generateMcp controls whether to generate MCP server code.
generateRest controls whether to generate REST API server and OpenAPI spec.
codeMode enables the search and execute tools for tool orchestration.
codeModeTimeout sets the max execution time for code mode scripts.
logErrors controls whether internal errors are logged to stderr.
annotationsDefault provides server-wide defaults for tool annotation hints.
corsOrigins specifies allowed CORS origins for HTTP transport (default: '*').
Implementation
const Server({
this.transport = McpTransport.stdio,
this.generateJson = false,
this.port = 3000,
this.address = '127.0.0.1',
this.toolPrefix,
this.autoClassPrefix = false,
this.generateMcp = true,
this.generateRest = false,
this.codeMode = false,
this.codeModeTimeout = 30,
this.logErrors = false,
this.annotationsDefault,
this.corsOrigins = const ['*'],
});