Creating an MCP Server with Azure AI Agent Service

Creating an MCP Server with Azure AI Agent Service

Learn how to integrate powerful AI agents into your workflows by creating a Model Context Protocol (MCP) server with Azure AI Agent Service.

Rahul Jha

Rahul Jha

April 1, 2025

Introduction

Integrating powerful AI agents into workflows has become essential for enhancing productivity and simplifying processes. This guide outlines the process of creating a Model Context Protocol (MCP) server with Azure AI Agent Service. Although focused on Claude Desktop, these steps can be adapted to other MCP-compatible clients.

By connecting Azure AI Agents to desktop clients, you can unlock the ability to seamlessly retrieve and process data from various sources, enhancing the functionality and intelligence of your applications.

What is Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is an open standard designed for seamless integration of AI assistants with diverse data sources. It enables context-aware interactions by allowing AI applications to:

  • Retrieve real-time web data using Bing Search Grounding.
  • Access private, internal data with Azure AI Search.
  • Incorporate data from sources like SharePoint and Fabric (coming soon).

When paired with the Azure AI Agent Service, developers can securely deploy scalable AI solutions while eliminating the complexity of managing compute and storage resources.

Prerequisites

To set up an MCP server, you need:

  • Python 3.10 or higher.
  • Claude Desktop or any MCP-compatible client.
  • Azure CLI installed and configured.
  • Pre-configured Azure AI Agents in Azure AI Foundry.

Step-by-Step Integration

1. Azure Configuration

Authenticate Azure CLI:

az login

Configure your Azure AI Agents in Azure AI Foundry.

Retrieve your Azure project connection string and agent IDs.

2. Setting Environment Variables

Create an .env file in your project root directory with the following content:

"text-blue-400">PROJECT_CONNECTION_STRING=your-project-connection-string
  DEFAULT_AGENT_ID=your-default-agent-id

3. Server Installation and Execution

Set up a Python virtual environment:

python -m venv .venv
  source .venv/bin/activate  # macOS/Linux
  .venv\Scripts\activate     # Windows

Install necessary packages:

pip install mcp[cli] azure-identity python-dotenv azure-ai-projects aiohttp

Start the MCP server:

python -m azure_agent_mcp_server

4. Configure MCP Client

Update your MCP client configuration (e.g., claude_desktop_config.json) with the following:

{
    "mcpServers": {
      "azure-agent": {
        "command": "uv",
        "args": [
          "--directory",
          "/ABSOLUTE/PATH/TO/PARENT/FOLDER",
          "run",
          "-m",
          "azure_agent_mcp_server"
        ],
        "env": {
          "PROJECT_CONNECTION_STRING": "your-project-connection-string",
          "DEFAULT_AGENT_ID": "your-default-agent-id"
        }
      }
    }
  }

Practical Usage

Once configured, your MCP server can handle various tasks, such as:

Connecting to a specific agent:

connect_agent(agent_id="agent-1234", query="What's the forecast today?")

Querying the default agent:

query_default_agent(query="Summarize the latest updates.")

Listing available agents:

list_agents()

Each interaction is isolated, ensuring privacy and coherence in conversations.

Real-World Impact

Using MCP with Azure AI Agent Service simplifies AI integrations, enabling:

  • Enhanced Productivity: Embedding conversational AI into desktop workflows.
  • Scalability and Security: Managing interactions securely without additional infrastructure complexities.
  • Reduced Development Effort: Leveraging standardized MCP connections for faster deployment.

Conclusion

The Model Context Protocol is a game-changer for developers aiming to integrate AI-powered capabilities seamlessly into applications. By leveraging Azure AI Agent Service, you can create scalable, efficient, and secure AI interactions that significantly improve workflows.

Start building with MCP today and unlock the potential of context-aware AI. Feedback and questions are always welcome!

FROM IDEA TO REALITY

LET'S MAKE IT HAPPEN!

I'm available for full-time roles & freelance projects.

I thrive on crafting dynamic web applications, and delivering seamless user experiences.