Python: Added MCP tool support for azure functions package. #2385
Merged
gavin-aguiar merged 31 commits intomainfrom Nov 25, 2025
Merged
Python: Added MCP tool support for azure functions package. #2385gavin-aguiar merged 31 commits intomainfrom
gavin-aguiar merged 31 commits intomainfrom
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 <13853051+dmytrostruk@users.noreply.github.com>
* 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 <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * 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 <175728472+Copilot@users.noreply.github.com>
…nto gaaguiar/mcp
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
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
larohra
reviewed
Nov 21, 2025
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
larohra
approved these changes
Nov 24, 2025
kshyju
reviewed
Nov 24, 2025
kshyju
reviewed
Nov 24, 2025
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py
Outdated
Show resolved
Hide resolved
TsuyoshiUshio
approved these changes
Nov 24, 2025
kshyju
reviewed
Nov 24, 2025
python/samples/getting_started/azure_functions/08_mcp_server/function_app.py
Outdated
Show resolved
Hide resolved
larohra
approved these changes
Nov 24, 2025
kshyju
approved these changes
Nov 25, 2025
Contributor
kshyju
left a comment
There was a problem hiding this comment.
Take my approval with a grain of salt as my python knowledge is very limited.
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
…t#2385) * Python: Add Scaffolding for Durable AzureFunctions package to Agent Framework (microsoft#1823) * Add scafolding * update readme * add code owners and label * update owners * .NET: Durable extension: initial src and unit tests (microsoft#1900) * Python: Add Durable Agent Wrapper code (microsoft#1913) * 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 <13853051+dmytrostruk@users.noreply.github.com> * Azure Functions .NET samples (microsoft#1939) * Python: Add Unit tests for Azurefunctions package (microsoft#1976) * Add Unit tests for Azurefunctions * remove duplicate import * .NET: [Feature Branch] Migrate state schema updates and support for agents as MCP tools (microsoft#1979) * Python: Add more samples for Azure Functions (microsoft#1980) * Move all samples * fix comments * remove dead lines * Make samples simpler * Agents as MCP tools * Removed unused files and updated sample * .NET: [Feature Branch] Durable Task extension integration tests (microsoft#2017) * .NET: [Feature Branch] Update OpenAI config for integration tests (microsoft#2063) * Python: Add Integration tests for AzureFunctions (microsoft#2020) * Add Integration tests * Remove DTS extension * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * 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 <175728472+Copilot@users.noreply.github.com> * Addressed copilot feedback * Minor refactoring and added tests * Updated mcp sample * Fixed broken link in readme * Addressed copilot comments * Addressed feedback * Updated property to enable_mcp_tool_trigger --------- Co-authored-by: Laveesh Rohra <larohra@microsoft.com> Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com> Co-authored-by: Chris Gillum <cgillum@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 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