-
Notifications
You must be signed in to change notification settings - Fork 829
Python: Added MCP tool support for azure functions package. #2385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ramework (#1823) * Add scafolding * update readme * add code owners and label * update owners
* add initial changes * Move code and add single sample * Update logger * Remove unused code * address PR comments * cleanup code and address comments --------- Co-authored-by: Dmytro Struk <[email protected]>
* Add Unit tests for Azurefunctions * remove duplicate import
…gents as MCP tools (#1979)
* Move all samples * fix comments * remove dead lines * Make samples simpler
* Add Integration tests * Remove DTS extension * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Add pyi file for type safety * Add samples in readme * Updated all readme instructions * Address comments * Update readmes * Fix requirements * Address comments --------- Co-authored-by: Copilot <[email protected]>
…nto gaaguiar/mcp
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds native Model Context Protocol (MCP) tool support to the Azure Functions integration for the Agent Framework, enabling agents to be exposed as MCP tools that can be invoked by MCP-compatible clients.
Key changes:
- Added app-level and per-agent
enable_mcp_tool_endpointconfiguration flags toAgentFunctionApp - Implemented
_setup_mcp_tool_trigger()and_handle_mcp_tool_invocation()methods for MCP tool processing - Enhanced health check endpoint to include
mcp_tool_enabledfield
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/azure_functions/08_mcp_server/requirements.txt | Added dependencies for the MCP server sample |
| python/samples/getting_started/azure_functions/08_mcp_server/local.settings.json.template | Configuration template for local development |
| python/samples/getting_started/azure_functions/08_mcp_server/host.json | Azure Functions host configuration |
| python/samples/getting_started/azure_functions/08_mcp_server/function_app.py | Sample demonstrating agents with different trigger configurations (HTTP only, MCP only, or both) |
| python/samples/getting_started/azure_functions/08_mcp_server/README.md | Comprehensive documentation for the MCP server sample |
| python/packages/azurefunctions/tests/test_app.py | Added 14 new unit tests for MCP tool endpoint functionality |
| python/packages/azurefunctions/agent_framework_azurefunctions/_app.py | Core implementation of MCP tool trigger support with entity integration |
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/azure_functions/08_mcp_server/function_app.py
Show resolved
Hide resolved
python/samples/getting_started/azure_functions/08_mcp_server/function_app.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/azure_functions/08_mcp_server/README.md
Outdated
Show resolved
Hide resolved
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/azure_functions/08_mcp_server/function_app.py
Outdated
Show resolved
Hide resolved
kshyju
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take my approval with a grain of salt as my python knowledge is very limited.
Motivation and Context
This PR adds native Model Context Protocol (MCP) tool endpoint support to the Azure Functions integration for the Agent
Framework. This enables agents to be exposed as MCP tools that can be invoked by MCP-compatible clients, in addition to
traditional HTTP endpoints.
Description
- Added enable_mcp_tool_endpoint parameter (app-level and per-agent)
- Implemented _setup_mcp_tool_trigger() method to register Azure Functions MCP tool triggers
- Implemented _handle_mcp_tool_invocation() method to process MCP tool requests
- Added agent_mcp_tool_flags dictionary to track per-agent MCP settings
- Updated health check endpoint to include mcp_tool_enabled field
- MCP tools accept query (required) and threadId (optional) parameters
- Handles both JSON string and pre-parsed dict contexts defensively
- Integrates with existing durable entity infrastructure for conversation state
Contribution Checklist