Skip to content

Commit b6ed402

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular/cli): use serveStdio to support both 2025 and 2026-07-28 MCP protocol eras
Replace direct `StdioServerTransport` connection in `cli.ts` with `serveStdio` from `@modelcontextprotocol/server/stdio`. `serveStdio` supports both the 2025-era protocol (`initialize` handshake) and the 2026-07-28 protocol revision over stdio on the same endpoint, automatically negotiating the era for each connection.
1 parent f9a7d52 commit b6ed402

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

  • packages/angular/cli/src/commands/mcp

packages/angular/cli/src/commands/mcp/cli.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
9+
import { serveStdio } from '@modelcontextprotocol/server/stdio';
1010
import type { Argv } from 'yargs';
1111
import {
1212
CommandModule,
1313
type CommandModuleImplementation,
1414
} from '../../command-builder/command-module';
1515
import { isTTY } from '../../utilities/tty';
16-
import { EXPERIMENTAL_TOOLS, EXPERIMENTAL_TOOL_GROUPS, createMcpServer } from './mcp-server';
16+
import { createMcpServer } from './mcp-server';
1717

1818
const INTERACTIVE_MESSAGE = `
1919
To start using the Angular CLI MCP Server, add this configuration to your host:
@@ -76,17 +76,17 @@ export default class McpCommandModule extends CommandModule implements CommandMo
7676
return;
7777
}
7878

79-
const server = await createMcpServer(
80-
{
81-
workspace: this.context.workspace,
82-
readOnly: options.readOnly,
83-
localOnly: options.localOnly,
84-
experimentalTools: options.experimentalTool,
85-
roots: options.root,
86-
},
87-
this.context.logger,
79+
serveStdio(() =>
80+
createMcpServer(
81+
{
82+
workspace: this.context.workspace,
83+
readOnly: options.readOnly,
84+
localOnly: options.localOnly,
85+
experimentalTools: options.experimentalTool,
86+
roots: options.root,
87+
},
88+
this.context.logger,
89+
),
8890
);
89-
const transport = new StdioServerTransport();
90-
await server.connect(transport);
9191
}
9292
}

0 commit comments

Comments
 (0)