refactor(@angular/cli): migrate MCP server to @modelcontextprotocol/server v2 - #33737
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the Angular CLI MCP implementation from @modelcontextprotocol/sdk to the new @modelcontextprotocol/server package (v2.0.0). This involves updating imports, replacing RequestHandlerExtra with ServerContext, adapting logging and request sending to use the new mcpReq context API, and updating tool registration schemas. Feedback on the changes highlights that the MCP specification does not support outputSchema or title in tool registration, which can trigger TypeScript excess property checking errors or runtime issues; it is recommended to destructure these properties out before registering tools.
…erver v2 Upgrades the Model Context Protocol (MCP) server implementation from @modelcontextprotocol/sdk v1.30.0 to the role-specific @modelcontextprotocol/server v2.0.0 package. The monolithic SDK dependency has been replaced in both package.json and BUILD.bazel, with StdioServerTransport now resolved from the @modelcontextprotocol/server/stdio subpath. In the MCP server initialization, notification handler registration for roots list changes now uses the spec method string instead of a Zod schema object. Additionally, tool-registry.ts introduces McpToolCallback and centrally wraps raw Zod schemas with z.object() during tool registration so individual tool declarations do not require schema syntax changes. Finally, low-level handlers in the zoneless migration tool have been updated to use ServerContext in place of RequestHandlerExtra, routing notifications and sampling requests through ctx.mcpReq.log and ctx.mcpReq.send.
a806240 to
bffd856
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
Upgrades the Model Context Protocol (MCP) server implementation from @modelcontextprotocol/sdk v1.30.0 to the role-specific @modelcontextprotocol/server v2.0.0 package. The monolithic SDK dependency has been replaced in both package.json and BUILD.bazel, with StdioServerTransport now resolved from the @modelcontextprotocol/server/stdio subpath.
In the MCP server initialization, notification handler registration for roots list changes now uses the spec method string instead of a Zod schema object. Additionally, tool-registry.ts introduces McpToolCallback and centrally wraps raw Zod schemas with z.object() during tool registration so individual tool declarations do not require schema syntax changes. Finally, low-level handlers in the zoneless migration tool have been updated to use ServerContext in place of RequestHandlerExtra, routing notifications and sampling requests through ctx.mcpReq.log and ctx.mcpReq.send.