feat: MCP v2 (draft)#10757
Open
KKonstantinov wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Contributor
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates the Firebase CLI MCP integration (
src/mcp/) from the v1 monolithic@modelcontextprotocol/sdkpackage to the v2 split packages (@modelcontextprotocol/core,@modelcontextprotocol/server,@modelcontextprotocol/server-legacy).This is a dependency/API migration only — there are no behavioral changes to the MCP server, its tools, resources, or prompts. All call sites were updated to the v2 import paths and renamed symbols; the server still speaks the same protocol over the same transports.
Note
Do not merge this. Goal of PR is to remain open and be updated through
beta,stable. SeeRoadmapsection below.Roadmap
alphadraftbeta(legacy era MCP on modern interfaces)stable- backwards compatible with legacy era MCP clients; enabling Modern stateless MCP will need maintainers supportDetails
Dependency changes (
package.json):@modelcontextprotocol/sdk^1.24.0@modelcontextprotocol/server^2.0.0-beta.2—Server, transports, protocol types@modelcontextprotocol/core^2.0.0-beta.2— runtime Zod schemas (CallToolResultSchema,ListToolsResultSchema)@modelcontextprotocol/server-legacy^2.0.0-beta.2— frozen v1 SSE transport (migration-only)Import-path changes (v1 → v2):
@modelcontextprotocol/sdk/server/index.js→Serverfrom@modelcontextprotocol/server@modelcontextprotocol/sdk/server/stdio.js→StdioServerTransportfrom@modelcontextprotocol/server/stdio@modelcontextprotocol/sdk/server/sse.js→SSEServerTransportfrom@modelcontextprotocol/server-legacy/sse@modelcontextprotocol/sdk/types.js→ protocol types (CallToolResult,ReadResourceResult,JSONRPCMessage,PromptMessage, …) from@modelcontextprotocol/server*Schemaconstants → from@modelcontextprotocol/coreAPI/symbol renames:
McpError→ProtocolErrorErrorCode→ProtocolErrorCode(e.g.ErrorCode.InvalidParams→ProtocolErrorCode.InvalidParams)Request-handler registration now uses method-string literals instead of imported request-schema objects:
ListToolsRequestSchema"tools/list"CallToolRequestSchema"tools/call"ListPromptsRequestSchema"prompts/list"GetPromptRequestSchema"prompts/get"ListResourcesRequestSchema"resources/list"ReadResourceRequestSchema"resources/read"ListResourceTemplatesRequestSchema"resources/templates/list"SetLevelRequestSchema"logging/setLevel"Files touched (16):
src/mcp/index.ts(the bulk of the change — theMcpServerwrapper),src/mcp/onemcp/onemcp_server.ts, and 12 one-line import-path swaps acrosserrors.ts,logging-transport.ts,prompt.ts,resource.ts,resources/index.ts,tool.ts,tools/crashlytics/{events,issues,reports}.ts,util.ts,util.spec.ts,util/dataconnect/converter.ts, pluspackage.jsonandnpm-shrinkwrap.json.The mechanical portion was produced by the MCP v1→v2 codemod; the imports and method-name strings were then re-formatted to satisfy the repo's Prettier config (multi-line import blocks, double-quoted strings).
Scenarios Tested
tsc --project tsconfig.compile.json(whole project): ✅ 0 errors.mocha 'src/mcp/**/*.spec.ts'(the entire migrated area, ~20 spec files): ✅ 149 passing, 0 failing. Covers tool/prompt/resource registration, theonemcpserver, JSON-schema conversion,toContent, and feature-availability checks (crashlytics, apptesting, etc.).eslint --config .eslintrc.js src/mcp: ✅ 0 errors under the repo's--quietgate. (Pre-existing style warnings unrelated to this change remain.)Scope note: tests were run against
src/mcp/**(the only code this change touches). The full firebase-tools suite (emulator/integration legs) was not exercised.Sample Commands
No user-facing commands or flags changed. The MCP server is invoked exactly as before:
Notes / follow-ups before merge
@modelcontextprotocol/*packages reference the published^2.0.0-beta.2releases — the first beta to ship native CommonJS builds, which firebase-tools requires becausesrc/mcpcompiles to CJS.npm-shrinkwrap.jsonwas regenerated (npm install) against these. Once v2 reaches a stable2.0.0, bump the three ranges to^2.0.0.server-legacyis intentional but temporary: it is a frozen copy of v1's SSE transport shipped only to ease migration. A follow-up should move the SSE endpoint insrc/mcp/index.tstoStreamableHTTPfrom@modelcontextprotocol/serverand drop theserver-legacydependency.