MCP HubMCP Hub
farzad528

mcp-server-azure-ai-agents

by: farzad528

Model Context Protocol Servers for Azure AI Search

35created 14/03/2025
Visit
Azure
AI

📌Overview

Purpose: To allow Claude Desktop to leverage Azure AI services for enhanced content searching capabilities through a Model Context Protocol (MCP) server.

Overview: This project features two implementations of an MCP server that connect Claude Desktop with Azure's powerful search functionalities. Users can opt for the Azure AI Agent Service or integrate directly with Azure AI Search, providing flexible options to enhance search experiences.

Key Features:

  • AI-Enhanced Search: Optimizes search results through intelligent processing using the Azure AI Agent Service.

  • Multiple Data Sources: Ability to search both private indexed documents and public web content, ensuring comprehensive search capabilities.

  • Source Citations: Web search results include citations to original sources, enhancing credibility and traceability.

  • Flexible Implementation: Users can choose between the Azure AI Agent Service or direct Azure AI Search integration based on their needs.

  • Seamless Claude Integration: All search functionalities are integrated smoothly into the Claude Desktop interface for an intuitive user experience.

  • Customizable: The system is designed for easy modification, allowing users to extend or adjust the search behavior to fit their specific requirements.


Azure AI Agent Service + Azure AI Search MCP Server

A Model Context Protocol (MCP) server enabling Claude Desktop to search content using Azure AI services, with options for Azure AI Agent Service or direct Azure AI Search integration.


Overview

This project features two MCP server implementations for integrating Claude Desktop with Azure search capabilities:

  1. Azure AI Agent Service Implementation (Recommended)

    • Azure AI Search Tool: AI-enhanced document search.
    • Bing Web Grounding Tool: Web search with source citations.
  2. Direct Azure AI Search Implementation: Three search methods:

    • Keyword Search: Exact matches.
    • Vector Search: Semantic similarity using embeddings.
    • Hybrid Search: Combination of keyword and vector searches.

Features

  • AI-Enhanced Search: Optimizes results through intelligent processing.
  • Multiple Data Sources: Search private documents and the public web.
  • Source Citations: Includes citations in web search results.
  • Flexible Implementation: Choose between Agent Service or direct search integration.
  • Seamless Claude Integration: Accessible through Claude Desktop.
  • Customizable: Easy to modify search behavior.

Requirements

  • Python: Version 3.10 or higher
  • Claude Desktop: Latest version
  • Azure Resources: Azure AI Search service with an indexed dataset and Azure AI Project.
  • Operating System: Windows or macOS (adaptable instructions available).

Azure AI Agent Service Implementation (Recommended)

Setup Guide

  1. Project Directory:

    mkdir mcp-server-azure-ai-search
    cd mcp-server-azure-ai-search
    
  2. Create .env File:

    echo "PROJECT_CONNECTION_STRING=your-project-connection-string" > .env
    echo "MODEL_DEPLOYMENT_NAME=your-model-deployment-name" >> .env
    echo "AI_SEARCH_CONNECTION_NAME=your-search-connection-name" >> .env
    echo "BING_CONNECTION_NAME=your-bing-connection-name" >> .env
    echo "AI_SEARCH_INDEX_NAME=your-index-name" >> .env
    
  3. Set Up Virtual Environment:

    uv venv
    .venv\Scripts\activate
    uv pip install "mcp[cli]" azure-identity python-dotenv azure-ai-projects
    
  4. Integration: Use the azure_ai_agent_service_server.py script.

Azure AI Agent Service Setup

  1. Create Azure AI Project: In Azure Portal, note project connection and model deployment names.
  2. Create Azure AI Search Connection: Add Azure AI Search service connection in your project.
  3. Create Bing Web Search Connection: Add a connection to Bing Search service.
  4. Authenticate with Azure:
    az login
    

Configuring Claude Desktop

{
  "mcpServers": {
    "azure-ai-agent": {
      "command": "C:\\path\\to\\.venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\azure_ai_agent_service_server.py"],
      "env": {
        "PROJECT_CONNECTION_STRING": "your-project-connection-string",
        "MODEL_DEPLOYMENT_NAME": "your-model-deployment-name",
        "AI_SEARCH_CONNECTION_NAME": "your-search-connection-name",
        "BING_CONNECTION_NAME": "your-bing-connection-name",
        "AI_SEARCH_INDEX_NAME": "your-index-name"
      }
    }
  }
}

Direct Azure AI Search Implementation

  1. Create .env File:

    echo "AZURE_SEARCH_SERVICE_ENDPOINT=https://your-service-name.search.windows.net" > .env
    echo "AZURE_SEARCH_INDEX_NAME=your-index-name" >> .env
    echo "AZURE_SEARCH_API_KEY=your-api-key" >> .env
    
  2. Install Dependencies:

    uv pip install "mcp[cli]" azure-search-documents==11.5.2 azure-identity python-dotenv
    
  3. Integration: Use the azure_search_server.py script.

  4. Configure Claude Desktop:

{
  "mcpServers": {
    "azure-search": {
      "command": "C:\\path\\to\\.venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\azure_search_server.py"],
      "env": {
        "AZURE_SEARCH_SERVICE_ENDPOINT": "https://your-service-name.search.windows.net",
        "AZURE_SEARCH_INDEX_NAME": "your-index-name",
        "AZURE_SEARCH_API_KEY": "your-api-key"
      }
    }
  }
}

Testing the Server

  1. Restart Claude Desktop to apply new configuration.
  2. Look for the MCP tools icon in the input field.
  3. Try queries such as "Search for information about AI in my Azure Search index".

Troubleshooting

  • Server Not Appearing:
    • Check Claude Desktop logs.
    • Verify file paths and environment variables.
  • Azure AI Agent Service Issues:
    • Ensure correct Azure AI Project configuration.
    • Verify connections and authentication status.

Customizing Your Server

  • Modify tool instructions.
  • Add new tools using the @mcp.tool() decorator.
  • Customize response formatting.
  • Adjust web search parameters.

License

This project is licensed under the MIT License.