Skip to content

Python: Show mcp 2.x Server handler registration in the hosting-mcp README - #10080

Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:contrib/python-hosting-mcp-readme-server-api
Draft

Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:contrib/python-hosting-mcp-readme-server-api

Conversation

@1aifanatic

Copy link
Copy Markdown
Contributor

Motivation & Context

The agent-framework-hosting-mcp README shows AgentMCPTool wired with @server.list_tools() and @server.call_tool(). Those decorators were part of the mcp 1.x low-level Server. The package requires mcp>=2.2.0,<3, where Server takes on_list_tools / on_call_tool callbacks in its constructor, so the README code raises AttributeError: 'Server' object has no attribute 'list_tools'. The samples in samples/04-hosting/mcp/ already use the 2.x form.

Description & Review Guide

  • What are the major changes? README only. The snippet defines list_tools(ctx, params) and call_tool(ctx, params) and passes them to Server(..., on_list_tools=..., on_call_tool=...), matching samples/04-hosting/mcp/agent_app.py.
  • What is the impact of these changes? Documentation only.
  • What do you want reviewers to focus on? Nothing in particular.

I ran the updated snippet with a stub agent and connected an in-memory mcp.Client to the server. list_tools returns run_agent with the task, audience and reasoning_effort properties, and call_tool returns 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

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

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

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (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

…EADME

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 05:37
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 Server constructor callbacks.
  • Updates handler signatures to accept ctx and params, reading tool-call arguments from params.
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

1 inactive deployment
github-app-auth — 26dc32c0 Deployed Nov 4, 2026 by 1aifanatic via team_check #8669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants