Skip to content

Conversation

@gavin-aguiar
Copy link
Contributor

@gavin-aguiar gavin-aguiar commented Nov 21, 2025

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

  1. AgentFunctionApp enhancements:
    - 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
  2. MCP Tool Configuration:
    - 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

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

larohra and others added 20 commits November 3, 2025 08:33
…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
* 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]>
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Nov 21, 2025
@gavin-aguiar gavin-aguiar added azure-functions Issues and PRs related to Azure Functions and removed documentation Improvements or additions to documentation labels Nov 21, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Nov 21, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azurefunctions/agent_framework_azurefunctions
   _app.py3748078%197–198, 203–204, 422, 430–431, 451–453, 459–461, 467–469, 501–502, 562–563, 695, 698, 707–709, 711–713, 715, 717, 728, 730–733, 735, 737–738, 740, 747–748, 750–751, 753–754, 756, 760, 770–772, 774–775, 777–779, 786, 788–789, 791, 812, 817, 829, 905, 917, 924–926, 972, 986, 997–999, 1001–1004, 1029, 1036, 1038, 1041
TOTAL15537235284% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2240 130 💤 0 ❌ 0 🔥 52.212s ⏱️

@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Nov 21, 2025
@gavin-aguiar gavin-aguiar marked this pull request as ready for review November 21, 2025 20:35
@gavin-aguiar gavin-aguiar requested a review from a team as a code owner November 21, 2025 20:35
Copilot AI review requested due to automatic review settings November 21, 2025 20:35
Copy link
Contributor

Copilot AI left a 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_endpoint configuration flags to AgentFunctionApp
  • Implemented _setup_mcp_tool_trigger() and _handle_mcp_tool_invocation() methods for MCP tool processing
  • Enhanced health check endpoint to include mcp_tool_enabled field

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

Copy link
Contributor

@kshyju kshyju left a 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.

@gavin-aguiar gavin-aguiar added this pull request to the merge queue Nov 25, 2025
Merged via the queue into main with commit b1c210c Nov 25, 2025
24 checks passed
@cgillum cgillum deleted the gaaguiar/mcp branch November 26, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-functions Issues and PRs related to Azure Functions documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants