Repository navigation
Python: Show mcp 2.x Server handler registration in the hosting-mcp README - #10080
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Conversation
…EADME Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 4, 2026 05:37 — with
GitHub Actions
Inactive
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 4, 2026 05:37 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the documentation-only update aligning the README example with the MCP 2.x server API.
No open issues 🎉
What changed in this PR
Updates the hosting-mcp README example to use the MCP 2.x server API required by the package, matching the existing hosting samples. This is a documentation-only change.
Changes:
- Replaces decorator-based handler registration with
Serverconstructor callbacks. - Updates handler signatures to accept
ctxandparams, reading tool-call arguments fromparams.
| File | Description |
|---|---|
python/packages/hosting-mcp/README.md |
Updates the AgentMCPTool example to register handlers using the MCP 2.x API. |
Review effort: Balanced
This branch was previously deployed
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.
Motivation & Context
The
agent-framework-hosting-mcpREADME showsAgentMCPToolwired with@server.list_tools()and@server.call_tool(). Those decorators were part of the mcp 1.x low-levelServer. The package requiresmcp>=2.2.0,<3, whereServertakeson_list_tools/on_call_toolcallbacks in its constructor, so the README code raisesAttributeError: 'Server' object has no attribute 'list_tools'. The samples insamples/04-hosting/mcp/already use the 2.x form.Description & Review Guide
list_tools(ctx, params)andcall_tool(ctx, params)and passes them toServer(..., on_list_tools=..., on_call_tool=...), matchingsamples/04-hosting/mcp/agent_app.py.I ran the updated snippet with a stub agent and connected an in-memory
mcp.Clientto the server.list_toolsreturnsrun_agentwith thetask,audienceandreasoning_effortproperties, andcall_toolreturns the agent's reply.Related Issue
N/A - trivial change: a README snippet is updated to the mcp 2.x server API the package already depends on.
AI Assistance
AI assistance details: Claude Code helped spot the removed API, update the snippet, verify it through an in-memory MCP client, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code