Azure AI Foundry Agent MCP

Azure AI Foundry Agent MCP

Enables interaction with Azure AI Agent Service by automatically discovering agents and creating MCP tools for querying and managing agent workflows.

Category
访问服务器

README

Azure AI Foundry Agent MCP

This project provides an MCP (Model Context Protocol) server for integrating with Azure AI Agent Service. It is designed to help you interact with Azure-hosted AI agents, query them, and manage agent-related workflows in a secure and scalable way.

Features

  • Automatic discovery and registration of all Azure AI Agents from your service
  • Dynamically creates MCP tools for each agent in your Azure AI Agent Service
  • Supports both local and web transport modes
  • Regular background sync to detect new or changed agents

Project Structure

  • azure_agent_mcp_server/ — Main server code and tools
  • .env — Environment variables for configuration (see below)
  • pyproject.toml — Project dependencies and metadata
  • uv.lock — Lockfile for reproducible installs (managed by uv)

Notes

  • The most recent version of the AI Foundry SDK requires an AI Foundry Project. It doesn't support a hub based project currently. For more information about Azure AI Foundry project types, see the official documentation.

Getting Started

1. Prerequisites

  • Python 3.13+
  • uv (recommended for dependency management)
  • Azure AI Foundry project (no hub-based projects supported)
  • You get the project endpoint from the Azure AI Foundry portal. It looks like this:
    https://<your-ai-foundry-project-ressource>.services.ai.azure.com/api/projects/<your-ai-foundry-project-name>
    
  • You can find the project endpoint in the Azure AI Foundry portal under "Overview": AI Foundry Endpoint Location

2. Setup

  1. Clone the repository

  2. Configure environment variables:

    • Copy the provided .env file or create your own. Example:
      PROJECT_ENDPOINT=your-ai-foundry-project-endpoint
      
    • This variable is required for connecting to your Azure AI Agent Service.
  3. Install dependencies:

    • Using uv:
      uv pip install -r pyproject.toml
      
    • Or, to sync with the lockfile:
      uv sync
      
    • Alternatively, you can use pip or pipx if you prefer.

3. Running the Server

The server can run in two modes:

  • Local mode (default):

    uv run -m azure_agent_mcp_server  
    # Alternatively, you can run:
    # python -m azure_agent_mcp_server
    
  • Web mode (accessible via HTTP):

    # Set SERVER_TYPE=web in your .env file, or run with:
    SERVER_TYPE=web uv run -m azure_agent_mcp_server 
    # Alteratively, you can run:
    # SERVER_TYPE=web python -m azure_agent_mcp_server
    

When started, the server will:

  1. Connect to Azure AI Agent Service using the provided endpoint
  2. Automatically discover all your agents
  3. Create MCP tools for each agent
  4. Periodically check for new or updated agents every 300 seconds

4. Querying Agents in VSCode / GitHub Copilot

  1. Add MCP Server to VSCode settings:

    "mcp": {
         "servers": {
             "Azure AI Agents Server": {
                 "command": "uv",
                 "args": [
                     "--directory",
                     "/YOUR/PROJECT/PATH",
                     "run",
                     "-m",
                     "azure_agent_mcp_server"
                 ],
                 "env": {
                     "PROJECT_ENDPOINT": "your-ai-foundry-project-endpoint"
                 }
             }
         }
     },
    
  2. After the server starts, it automatically discovers all agents from your Azure AI Agent Service and makes them available as MCP tools with names based on the agent names (converted to snake_case).

  3. You can then use these tools directly in GitHub Copilot or any other MCP-compatible client.

  4. Good to know: Create a copilot-instructions.md file in the .github directory in your project to instruct copilot to streamline the usage of the MCP tools. For more information about repository custom instructions, see the GitHub documentation.

Environment Variables and Configuration

The MCP server can be configured using the following environment variables in your .env file:

  • PROJECT_ENDPOINT: Azure AI Foundry project endpoint (required)
  • SERVER_TYPE: Set to "local" (default) or "web" to choose the transport mode
  • SERVER_PORT: Port number for web mode (default: 8000)
  • SERVER_PATH: Path for web mode (default: "/")
  • UPDATE_INTERVAL: How often (in seconds) to check for new or updated agents (default: 300)
  • LOG_LEVEL: Set the logging level (default: "WARNING"). Options include "DEBUG", "INFO", "WARNING", "ERROR", and "CRITICAL".

Example .env file:

PROJECT_ENDPOINT=your-ai-foundry-project-endpoint
SERVER_TYPE=web
SERVER_PORT=9000
UPDATE_INTERVAL=120
LOG_LEVEL=INFO

Note: Never commit secrets to version control.

About uv

uv is a fast, modern Python package and project manager. It replaces tools like pip, pip-tools, pipx, poetry, and virtualenv, and is recommended for reproducible, efficient dependency management in this project.

How Agent Tools Work

The system automatically:

  1. Connects to Azure AI Agent Service on startup
  2. Discovers all agents available in your service
  3. Creates an MCP tool for each agent, converting the agent name to snake_case for the function name
  4. Sets the tool description to match the agent description
  5. Periodically checks for new, updated, or deleted agents
  6. Updates the available tools accordingly

Example:

  • An agent named "Coding Guidelines" becomes a tool named coding_guidelines
  • An agent named "Python Expert" becomes a tool named python_expert

License

This project is licensed under the MIT License. See the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选