Integrates Google Gemini for enhanced document formatting, summarization, and analysis within the Azure AI Search workflow, providing LLM-powered content processing capabilities.
Uses LangChain for AI workflow orchestration, state management, and observability through LangSmith tracing to monitor search operations and performance metrics.
Implements LangGraph workflows for intelligent query processing, context retrieval, and state-based document search with persona-driven routing and multiple output formats.
Azure AI Search MCP Server ๐๐ค
An intelligent Model Context Protocol (MCP) server for Azure AI Search integration with Claude Desktop - Transform enterprise document search into natural AI conversations using LangGraph workflows, Google Gemini, and advanced retrieval-augmented generation (RAG).
๐ฅ Keywords: Azure Cognitive Search, MCP Server, Claude Desktop Integration, LangGraph AI Workflows, Document Retrieval, Enterprise Search, RAG Implementation, AI-Powered Search, Conversational AI, Knowledge Management
๐ Perfect for: Enterprise search solutions, document analysis platforms, knowledge management systems, AI-powered research tools, intelligent document retrieval, conversational search interfaces, and RAG (Retrieval-Augmented Generation) applications.
Requirements: Python 3.8+ | Azure AI Search Service | Claude Desktop | Google Gemini API (optional)
Features
๐ Azure AI Search Integration: Connect to your Azure AI Search index
๐ LangGraph Chain: Intelligent query processing and context retrieval
๐ง Google Gemini Integration: Enhanced document formatting, summarization, and analysis
๐จ Enhanced Visualizations: Grandalf layouts, Mermaid diagrams, and ASCII art
๐ LangSmith Tracing: Full observability and debugging of chain executions
๐ MCP Protocol: Expose functionality as tools that Claude can use directly
โ๏ธ Configurable: Easy setup with environment variables
๐ง Pydantic Validation: Type-safe configuration and data validation
๐ Environment Management: Secure credential handling with python-dotenv
๐ญ Persona-Driven Responses: Two distinct AI personas for different output styles
๐ JSON-Based Prompts: Easily editable prompt templates
๐งช Comprehensive Testing: Full test suite with multiple scenarios
Table of Contents
Technical Stack
Core Technologies
Python 3.8+: Modern Python with asyncio support
LangChain/LangGraph: AI workflow orchestration and state management
Azure AI Search: Cloud-based document indexing and retrieval
Google Gemini: Large language model for content processing
Model Context Protocol (MCP): Standard protocol for AI tool integration
Configuration & Validation
Pydantic v2: Type-safe configuration models with automatic validation
python-dotenv: Environment variable management and secrets handling
Structured Logging: Comprehensive error tracking and debugging
Visualization & Development
Grandalf: Advanced graph layout algorithms for LangGraph visualization
Mermaid: Professional diagram generation for documentation
LangSmith: Observability and tracing for AI chain executions
Pytest: Comprehensive testing framework with async support
Quick Setup
Clone and Install:
git clone https://github.com/codewith-mm/langgraph-claude-azure-mcp.git cd langgraph-claude-azure-mcp pip install -e .Configure Environment: Copy
.env.exampleto.envand fill in your credentials:# On Windows (PowerShell): Copy-Item .env.example .env # On macOS/Linux: cp .env.example .envRun the MCP Server:
azure-search-mcp
Configuration
Create a .env file in the project root with the following variables:
Google Gemini Setup
Get API Key: Visit Google AI Studio
Create API Key: Generate a new API key for your project
Add to Environment: Set
GOOGLE_API_KEYin your.envfile
The server will automatically:
Use Google Gemini for document formatting and summarization when API key is configured
Fall back to basic formatting if no API key is provided
Create proper LangChain chains that appear in LangSmith tracing
Claude Desktop Integration
Step 1: Locate Claude Desktop Configuration
Claude Desktop stores its configuration in a JSON file. Example (Windows):
Step 2: MCP Server Configuration
Add this configuration to your Claude Desktop config file (update paths as needed for your environment):
Step 3: Testing the Integration
Ask Claude to:
Search for CEO compensation:
"Can you search for CEO compensation information using the Azure Search tool?"Analyze executive pay:
"Use the search tool to find and analyze executive compensation data"Get document summaries:
"Search for salary information and provide a summary"
Project Structure
Architecture Overview
Core Components
chain.py- LangGraph-based workflow engineSearchState management
Three output formats (structured, summary, analysis)
Persona-driven prompt routing
prompt_manager.py- JSON-based prompt systemDynamic template loading
Two persona management (Financial Analyst and Search Quality Rater)
Hot-reloadable configurations
server.py- MCP server implementationTool definitions and handlers
Claude Desktop integration
Error handling and logging
azure_search.py- Azure AI Search clientDocument retrieval
Vector and hybrid search
Result formatting
config.py- Configuration managementEnvironment variable handling with python-dotenv
Service configurations (Azure, Gemini, LangSmith)
Pydantic-based validation and type safety
Secure defaults and configuration validation
Key Features
๐ญ Persona-Driven Responses: Two distinct AI personas for different output styles
๐ LangGraph Workflow: State-based processing with intelligent routing
๐ JSON-Based Prompts: Easily editable prompt templates
๐ Azure AI Search: Advanced document retrieval capabilities
๐ง Gemini Integration: Google's LLM for content processing
๐ LangSmith Tracing: Comprehensive observability
๐ Claude Desktop: Native MCP integration
๐ง Pydantic Models: Type-safe configuration with automatic validation
๐ Secure Configuration: Environment-based secrets management with python-dotenv
Available Tools
search_documents: Search for relevant documents in Azure AI Search using text queriesget_document_context: Retrieve detailed context from specific documents by their IDssearch_and_summarize: Search and get a summarized view of resultssearch_with_analysis: Search with relevance analysis
Each tool supports different output formats:
structured: Detailed formatting with clear sections
summary: Concise overview with key points
analysis: In-depth analysis with insights and recommendations
Visualization Tools
The system includes comprehensive graph visualization capabilities for inspecting LangGraph structures:
Quick Visualization
Built-in Method
Features
๐จ Mermaid Diagrams: Color-coded nodes with professional styling
๐ผ๏ธ ASCII Art: Terminal-friendly graph representations
๐ Advanced Layouts: Grandalf integration for enhanced positioning
๐ File Export: Export diagrams as
.mmdand.jsonfiles๐ 100% Dynamic: Automatically adapts to any graph structure changes
๐ท๏ธ Type Detection: Shows node types and state structure
Example Output
Mermaid Diagram
ASCII Art
Testing
Essential Test Suite
The test suite has been streamlined to include only the most essential tests:
Core Chain Tests (
test_chain.py)Chain functionality and state management
Search tool functionality
Routing logic and conditional edges
Prompt template validation
Integration Tests (
test_integration.py)End-to-end MCP server functionality
Search functionality validation
Server initialization and protocol compliance
Environment Configuration (
test_env_loading.py)Environment variable loading
Configuration validation
API key verification
Claude Setup Verification (
verify_claude_setup.py)MCP server command validation
Claude Desktop integration check
Running Tests
Development
Setup Development Environment
Install development dependencies:
pip install -e ".[dev]"Run tests:
pytestFormat code:
black src/ ruff check src/ ```
Adding Features
Adding Tests: Place in
tests/directory withtest_*.pynamingModifying Prompts: Edit
src/azure_search_mcp/prompts.jsonConfiguration: Update
src/azure_search_mcp/config.pyNew Tools: Add to
src/azure_search_mcp/server.py
Project Tasks
The following VS Code tasks are available:
Start MCP Server: Launch the MCP server for testing
Start MCP Server (Conda): Launch using conda environment
Test MCP Server (Standalone): Run standalone tests
LangSmith Monitoring
Setup LangSmith (Recommended)
LangSmith provides excellent tracing and monitoring for your MCP server:
Sign up for LangSmith: Visit smith.langchain.com
Get your API key: Go to Settings โ API Keys โ Create API Key
Update your with your real LangSmith API key:
LANGCHAIN_API_KEY=lsv2_pt_your_actual_api_key_hereTest the integration by running the MCP server and checking the LangSmith dashboard
Benefits of LangSmith Integration
๐ Trace Operations: All search operations and performance metrics
๐ Debug Issues: Search queries and results debugging
๐ Monitor Usage: Usage patterns and response times
๐จ Get Alerts: Error notifications and performance issues
๐ View Traces: Detailed execution traces for each Claude interaction
What Gets Traced
โ Individual tool calls from Claude
โ Azure AI Search query execution
โ Document retrieval and formatting
โ LangGraph workflow execution
โ Performance metrics and timing
Troubleshooting
Common Issues
Claude doesn't see the tools
Solution: Check the config file path and restart Claude Desktop completely
MCP server fails to start
Solution: Test the server manually:
cd .\langgraph-claude-azure-mcp\src python -m azure_search_mcp
Authentication errors
Solution: Verify your
.envfile has the correct Azure Search credentials
No search results
Solution: Test your Azure Search index manually to ensure it has documents
Import or dependency errors
Solution: Ensure all dependencies are installed:
pip install -e .
Configuration Files Summary
Claude Desktop Config Location:
MCP Server Location:
Environment Variables:
LangSmith Integration:
โ Tracing configured and ready
๐ Monitors all search operations
๐ Dashboard: https://smith.langchain.com
๐งช Test by using the MCP server with Claude
๏ฟฝ๐ You're all set! Your Azure AI Search MCP server is ready to provide intelligent document retrieval and analysis to Claude Desktop, with comprehensive visualization tools and optional LangSmith monitoring for performance insights.
๐ SEO Keywords
Azure AI Search, MCP Server, Claude Desktop, LangGraph, RAG, Retrieval Augmented Generation, Document Search, AI Search Integration, Model Context Protocol, Enterprise Search, Conversational AI, Knowledge Management, Semantic Search, NLP, Machine Learning, Chatbots, Search Engine, Information Retrieval, Python AI, Azure Integration