FreshMCP
Provides standardized MCP interfaces for Azure services including Cosmos DB operations (container and item management) and AI Search operations (index management), deployed through Azure API Management gateway.
README
FreshMCP
A Python-based service that provides a Message Control Protocol (MCP) interface for FreshMCP operations using Azure Cosmos DB and AI Search.
Overview
FreshMCP is a comprehensive service that provides standardized interfaces for interacting with Azure services:
Cosmos DB Operations
- Container management (create, list, delete)
- Item operations (create, read, update, delete, query)
AI Search Operations
- Create index
- List indexes
- Delete index
Architecture & Flow
System Architecture
graph TB
subgraph "Client Layer"
A[VSCode/Cursor Client]
B[Web Application]
end
subgraph "APIM Gateway"
C[Azure API Management]
D[Rate Limiting]
E[Authentication]
F[Request Routing]
end
subgraph "MCP Agent Layer"
G[Cosmos DB MCP Agent]
H[Search MCP Agent]
end
subgraph "Azure Services"
J[Cosmos DB]
K[AI Search]
end
A --> C
B --> C
C --> D
C --> E
C --> F
F --> G
F --> H
G --> J
H --> K
Request Flow
- Client Request: VSCode/Cursor or web application sends request to APIM
- APIM Processing:
- Authentication and authorization
- Rate limiting and throttling
- Request routing based on service type
- MCP Agent Processing:
- Tool execution based on request type
- Service-specific operations
- Response formatting
- Azure Service Interaction:
- Direct API calls to Azure services
- Data retrieval and manipulation
- Telemetry collection
APIM Configuration
The Azure API Management (APIM) serves as the central gateway for all MCP agent communications:
- Authentication: Subscription key-based authentication
- Rate Limiting: Configurable limits per subscription
- Routing: Intelligent routing to appropriate MCP agents
- Monitoring: Built-in analytics and monitoring
- Caching: Response caching for improved performance
MCP Agent Communication
Each MCP agent communicates via Server-Sent Events (SSE) protocol:
- Cosmos DB Agent: Handles all database operations
- Search Agent: Manages AI Search index operations
Prerequisites
- Python 3.11 or higher
- Azure CLI
- Azure Developer CLI (azd)
- Docker
- Azure subscription with appropriate permissions
Local Development Setup
-
Clone the repository:
-
Install uv (if not already installed):
pip install uv
- Create and activate a virtual environment using uv:
uv venv
# Windows
.venv\Scripts\activate
# Linux/Mac
source .venv/bin/activate
- Install dependencies using uv:
uv sync
- Set up environment variables:
cp .env.example .env
# Edit .env with your Azure credentials and service settings
Server Endpoints
Start the Cosmos DB MCP server:
python -m src.cosmos.mcp.server
The server will start on
http://localhost:8001/cosmos/sse
Start the AI Search MCP server:
python -m src.search.mcp.server
The server will start on
http://localhost:8002/search/sse
Setting up the MCP to the client
Add the tools of any MCP server to VSCode or Cursor providing a JSON configuration file below:
VSCode:
{
"servers": {
"cosmos_mcp_local": {
"type": "sse",
"url": "http://localhost:8001/cosmos/sse"
},
"search_mcp_local": {
"type": "sse",
"url": "http://localhost:8002/search/sse"
}
}
}
Cursor:
{
"mcpServers": {
"cosmos_mcp_local": {
"type": "sse",
"url": "http://localhost:8001/cosmos/sse"
},
"search_mcp_local": {
"type": "sse",
"url": "http://localhost:8002/search/sse"
}
}
}
Deployment with Azure Developer CLI (azd)
- Initialize azd (if not already done):
azd init -e dev -l eastus
# -e dev is optional, it will create a new dev environment
# -l eastus is optional, it will create the resources in the eastus region
- Deploy the application:
azd up
This will:
- Packages the project/services
- Provision all the necessary Azure services
- Build and push the Docker images to the Azure Container Registry
- Deploy the images to the Azure Container Apps
Setting up RBAC for Azure Services
Cosmos DB RBAC
- Grant the necessary RBAC role to the system-assigned managed identity:
az cosmosdb sql role assignment create \
--account-name <your-cosmos-account> \
--resource-group <your-resource-group> \
--role-definition-id "00000000-0000-0000-0000-000000000002" \
--principal-id <managed-identity-principal-id> \
--scope "/"
Note: The system-assigned managed identity is assigned to your cosmosdb Container App by default.
AI Search RBAC
- Grant the necessary RBAC role to the system-assigned managed identity:
az role assignment create \
--assignee <managed-identity-principal-id> \
--role "Search Service Contributor" \
--scope /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Search/searchServices/<search-service-name>
Note: The system-assigned managed identity is assigned to your search Container App by default.
Environment Variables
Required environment variables (use a table to list them):
| Variable | Description | Required |
|---|---|---|
AZURE_TENANT_ID |
Azure tenant ID | Yes (If using Service Principal) |
AZURE_CLIENT_ID |
Client ID for authentication | Yes (If using Service Principal) |
AZURE_CLIENT_SECRET |
Client secret for authentication | Yes (If using Service Principal) |
APPLICATIONINSIGHTS_CONNECTION_STRING |
Application Insights connection string | No |
Monitoring
To monitor your application:
azd monitor -e dev
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。