rag-mcp-server

rag-mcp-server

Enables hybrid vector and keyword search over Azure AI Search indexes via an MCP tool, supporting query with embedding generation.

Category
Visit Server

README

rag-mcp-server

An MCP (Model Context Protocol) server that exposes Azure AI Search as a tool. Connect it to any MCP-compatible client (Claude Desktop, MCP Inspector, etc.) to give it hybrid vector + keyword search over your own document index.

What it does

Exposes a single MCP tool:

search_documents(query: str, top_k: int = 5) -> str

Generates an embedding for the query using Azure OpenAI, runs a hybrid search against Azure AI Search, and returns the top matching document chunks with source and metadata.


Prerequisites

  • Python 3.11+
  • An Azure AI Search index with a content_vector field
  • An Azure OpenAI embedding deployment (e.g. text-embedding-3-small)

Quick Start

Run locally with Python

# 1. Clone and enter the directory
git clone <repo-url>
cd rag-mcp

# 2. Create a virtual environment and install dependencies
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

# 3. Configure credentials
cp .env.example .env
# Edit .env and fill in your Azure endpoints and API keys

# 4. Start the server
python server.py

Server listens at http://localhost:8001/mcp.

Run with Docker

cp .env.example .env
# Edit .env and fill in your Azure endpoints and API keys

docker compose up --build

Environment Variables

Copy .env.example to .env and fill in the values:

Variable Description
AZURE_OPENAI_ENDPOINT Azure OpenAI resource endpoint
AZURE_EMBEDDING_API_KEY API key for the embedding deployment
AZURE_OPENAI_EMBEDDING_DEPLOYMENT Embedding model deployment name
AZURE_SEARCH_ENDPOINT Azure AI Search service endpoint
AZURE_SEARCH_API_KEY Azure AI Search admin or query key
AZURE_SEARCH_INDEX_NAME Name of the search index to query

Testing with MCP Inspector

MCP Inspector is an interactive UI for calling MCP tools manually.

# Terminal 1 — start the server
python server.py

# Terminal 2 — open the inspector
npx @modelcontextprotocol/inspector

Open the URL printed by the inspector (e.g. http://localhost:5173), set transport to Streamable HTTP, enter http://localhost:8001/mcp, and click Connect. Navigate to the Tools tab to call search_documents.


Connect to Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "rag-mcp": {
      "type": "streamable-http",
      "url": "http://localhost:8001/mcp"
    }
  }
}

Run the Automated Test

With the server running, execute the MCP client test:

python test.py

Passes three assertions: tool is registered, no server-side error, and results contain formatted document chunks.


Deploy to Azure Container Apps

See deploy.ps1 for a full Azure CLI deployment script. Fill in your resource group at the top of the file, then run:

.\deploy.ps1

The script builds and pushes the Docker image to ACR, creates a Container Apps environment, and deploys the server with a public HTTPS endpoint.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured