Python: Add MCP hosting helpers#7209
Merged
eavanvalkenburg merged 3 commits intoJul 21, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5d6987cd-1b67-4ba1-8b54-3c50da6e7607
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Python hosting helper package (agent-framework-hosting-mcp) that provides a framework-neutral boundary for exposing Agent Framework agents/workflows as MCP tools, plus samples, tests, and supporting registration/docs updates (Fixes #6592).
Changes:
- Introduces
agent-framework-hosting-mcpwith conversion helpers (mcp_to_run,mcp_from_run) and adapters (MCPAgentTool,MCPWorkflowTool) for app-owned MCP servers. - Adds MCP hosting samples (manual, FastMCP, agent-derived, session-aware, workflow-derived) and corresponding unit + streamable HTTP integration coverage.
- Registers the new package in the Python workspace/CI and documents the MCP hosting channel in the hosting spec.
Reviewed changes
Copilot reviewed 25 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Adds the new workspace member and locked deps for agent-framework-hosting-mcp. |
| python/pyproject.toml | Registers agent-framework-hosting-mcp as a workspace package. |
| python/PACKAGE_STATUS.md | Tracks agent-framework-hosting-mcp as alpha. |
| python/AGENTS.md | Lists the new MCP hosting helpers package in the Python agents index. |
| docs/specs/002-python-hosting-channels.md | Documents the MCP hosting channel boundary and API surface. |
| .github/workflows/python-merge-tests.yml | Includes hosting-mcp in path filters and integration test matrix. |
| .github/workflows/python-integration-tests.yml | Adds hosting-mcp tests to integration runs. |
| python/samples/04-hosting/mcp/README.md | Provides an overview and run instructions for the MCP hosting samples. |
| python/samples/04-hosting/mcp/pyproject.toml | Adds a runnable sample environment definition for MCP hosting. |
| python/samples/04-hosting/mcp/manual_app.py | Manual low-level MCP server sample using direct conversion helpers. |
| python/samples/04-hosting/mcp/fastmcp_app.py | FastMCP sample using function-signature-derived tool schema + conversions. |
| python/samples/04-hosting/mcp/agent_app.py | Low-level server sample using MCPAgentTool for schema+execution alignment. |
| python/samples/04-hosting/mcp/session_app.py | Session-aware sample using AgentState + app-owned per-session locking. |
| python/samples/04-hosting/mcp/workflow_app.py | Workflow sample using MCPWorkflowTool with typed input derivation. |
| python/packages/hosting-mcp/pyproject.toml | New package definition, dependencies, and test/tooling configuration. |
| python/packages/hosting-mcp/README.md | Package-level documentation for the conversion seam and adapters. |
| python/packages/hosting-mcp/AGENTS.md | Defines the intended boundary and public API for contributors. |
| python/packages/hosting-mcp/LICENSE | Adds MIT license file for the new package. |
| python/packages/hosting-mcp/agent_framework_hosting_mcp/init.py | Exposes the public API surface and package version. |
| python/packages/hosting-mcp/agent_framework_hosting_mcp/_conversion.py | Implements MCP↔Agent Framework argument/result conversions. |
| python/packages/hosting-mcp/agent_framework_hosting_mcp/_agent_tool.py | Implements an agent-backed MCP tool adapter with optional session persistence. |
| python/packages/hosting-mcp/agent_framework_hosting_mcp/_workflow_tool.py | Implements a workflow-backed MCP tool adapter with schema derivation and output conversion. |
| python/packages/hosting-mcp/agent_framework_hosting_mcp/py.typed | Marks the package as typed for downstream type-checkers. |
| python/packages/hosting-mcp/tests/hosting_mcp/test_conversion.py | Unit tests for conversion helpers. |
| python/packages/hosting-mcp/tests/hosting_mcp/test_agent_tool.py | Unit tests for MCPAgentTool schema + session behavior. |
| python/packages/hosting-mcp/tests/hosting_mcp/test_workflow_tool.py | Unit tests for MCPWorkflowTool schema derivation and behavior. |
| python/packages/hosting-mcp/tests/hosting_mcp/test_integration.py | Streamable HTTP integration test invoking a locally-hosted MCP server. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5d6987cd-1b67-4ba1-8b54-3c50da6e7607
TaoChenOSU
reviewed
Jul 20, 2026
TaoChenOSU
approved these changes
Jul 20, 2026
westey-m
reviewed
Jul 21, 2026
westey-m
approved these changes
Jul 21, 2026
eavanvalkenburg
enabled auto-merge
July 21, 2026 14:39
westey-m
approved these changes
Jul 21, 2026
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
Agent Framework needs a small, framework-neutral boundary for exposing agents and workflows through MCP without owning the MCP server, transport, authentication, or deployment model. This adds native MCP conversion helpers and optional adapters while preserving application control over the server architecture.
Description & Review Guide
agent-framework-hosting-mcppackage withmcp_to_run(...),mcp_from_run(...),AgentMCPTool, andWorkflowMCPTool; adds stateless, session-aware, manual, FastMCP, and workflow samples; adds unit and streamable HTTP integration coverage; and updates package registration, CI, lifecycle documentation, and the hosting specification.Related Issue
Fixes #6592
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.