start_server
Initialize a development server by specifying a command, process name, and optional parameters like port and working directory, designed for use with the Code MCP Server to enable AI interactions with VS Code.
Instructions
Start a development server
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Server command | |
| cwd | No | Working directory | |
| name | Yes | Process name for reference | |
| port | No | Port number |
Input Schema (JSON Schema)
{
"properties": {
"command": {
"description": "Server command",
"type": "string"
},
"cwd": {
"description": "Working directory",
"type": "string"
},
"name": {
"description": "Process name for reference",
"type": "string"
},
"port": {
"description": "Port number",
"type": "number"
}
},
"required": [
"command",
"name"
],
"type": "object"
}
Implementation Reference
- server/src/index.ts:1455-1461 (handler)The exported startServer function serves as the entry point to start the MCP server. It instantiates VSCodeServer and calls its start method, handling any startup errors.export function startServer() { const server = new VSCodeServer() server.start().catch(async error => { await logToFile('Failed to start server:', error) process.exit(1) }) }
- server/src/cli.ts:266-266 (registration)CLI registration: calls startServer() when running the default command to start the server.startServer();
- server/src/index.ts:1465-1465 (registration)Direct execution registration: calls startServer() if the file is executed directly.startServer()
- server/src/index.ts:1444-1451 (helper)The start() method of VSCodeServer class that connects the MCP Server using StdioServerTransport.public async start() { await this.log('Starting VS Code MCP Server...') const transport = new StdioServerTransport() await this.log('MCP Server starting with stdio transport') await this.server.connect(transport) await this.log('VS Code MCP Server started successfully') }
- server/src/index.ts:1454-1460 (helper)Comment and export indicating usage for CLI.// Export the startServer function for CLI usage export function startServer() { const server = new VSCodeServer() server.start().catch(async error => { await logToFile('Failed to start server:', error) process.exit(1) })