FastMCP
A lightweight Model Context Protocol server that enables creating, managing, and querying model contexts with integrated Datadog metrics and monitoring.
README
FastMCP - Model Context Protocol Server
A lightweight Model Context Protocol (MCP) server implemented with FastMCP, a fast and Pythonic framework for building MCP servers and clients.
Features
- Create, retrieve, update, and delete model contexts
- Query execution against specific contexts
- Filtering by model name and tags
- In-memory storage (for development)
- FastMCP integration for easy MCP server development
- Datadog integration for metrics and monitoring
Requirements
- Python 3.7+
- FastMCP
- uv (recommended for environment management)
- Datadog account (optional, for metrics)
Installation
Using uv (Recommended)
The simplest way to install is using the provided scripts:
Unix/Linux/macOS
# Clone the repository
git clone https://github.com/yourusername/datadog-mcp-server.git
cd datadog-mcp-server
# Make the install script executable
chmod +x install.sh
# Run the installer
./install.sh
Windows
# Clone the repository
git clone https://github.com/yourusername/datadog-mcp-server.git
cd datadog-mcp-server
# Run the installer
.\install.ps1
Manual Installation
# Clone the repository
git clone https://github.com/yourusername/datadog-mcp-server.git
cd datadog-mcp-server
# Create and activate a virtual environment with uv
uv venv
# On Unix/Linux/macOS:
source .venv/bin/activate
# On Windows:
.\.venv\Scripts\activate
# Install dependencies
uv pip install -r requirements.txt
Datadog Configuration
The server integrates with Datadog for metrics and monitoring. You can configure Datadog API credentials in several ways:
1. Environment Variables
Set these environment variables before starting the server:
# Unix/Linux/macOS
export DATADOG_API_KEY=your_api_key
export DATADOG_APP_KEY=your_app_key # Optional
export DATADOG_SITE=datadoghq.com # Optional, default: datadoghq.com
# Windows PowerShell
$env:DATADOG_API_KEY = 'your_api_key'
$env:DATADOG_APP_KEY = 'your_app_key' # Optional
$env:DATADOG_SITE = 'datadoghq.com' # Optional
2. .env File
Create a .env file in the project directory:
DATADOG_API_KEY=your_api_key
DATADOG_APP_KEY=your_app_key
DATADOG_SITE=datadoghq.com
3. FastMCP CLI Installation
When installing as a Claude Desktop tool, you can pass environment variables:
fastmcp install mcp_server.py --name "Model Context Server" -v DATADOG_API_KEY=your_api_key
4. Runtime Configuration
Use the configure_datadog tool at runtime:
result = await client.call_tool("configure_datadog", {
"api_key": "your_api_key",
"app_key": "your_app_key", # Optional
"site": "datadoghq.com" # Optional
})
Usage
Starting the Server
# Start directly from activated environment
python mcp_server.py
# Or use uv run (no activation needed)
uv run python mcp_server.py
# Use FastMCP CLI for development (if in activated environment)
fastmcp dev mcp_server.py
# Use FastMCP CLI with uv (no activation needed)
uv run -m fastmcp dev mcp_server.py
Installing as a Claude Desktop Tool
# From activated environment
fastmcp install mcp_server.py --name "Model Context Server"
# Using uv directly
uv run python -m fastmcp install mcp_server.py --name "Model Context Server"
# With Datadog API key
fastmcp install mcp_server.py --name "Model Context Server" -v DATADOG_API_KEY=your_api_key
Using the Tools
The server provides the following tools:
create_context- Create a new contextget_context- Retrieve a specific contextupdate_context- Update an existing contextdelete_context- Delete a contextlist_contexts- List all contexts (with optional filtering)query_model- Execute a query against a specific contexthealth_check- Server health checkconfigure_datadog- Configure Datadog integration at runtime
Example Requests
Creating a Context
result = await client.call_tool("create_context", {
"context_id": "model-123",
"model_name": "gpt-3.5",
"data": {
"parameters": {
"temperature": 0.7
}
},
"tags": ["production", "nlp"]
})
Executing a Query
result = await client.call_tool("query_model", {
"context_id": "model-123",
"query_data": {
"prompt": "Hello, world!"
}
})
Configuring Datadog
result = await client.call_tool("configure_datadog", {
"api_key": "your_datadog_api_key",
"app_key": "your_datadog_app_key", # Optional
"site": "datadoghq.com" # Optional
})
Datadog Metrics
The server reports the following metrics to Datadog:
mcp.contexts.created- Context creation eventsmcp.contexts.updated- Context update eventsmcp.contexts.deleted- Context deletion eventsmcp.contexts.accessed- Context access eventsmcp.contexts.total- Total number of contextsmcp.contexts.listed- List contexts operation eventsmcp.queries.executed- Query execution eventsmcp.server.startup- Server startup eventsmcp.server.shutdown- Server shutdown events
Development
See the included mcp_example.py for a client implementation example:
# Run the example client (with activated environment)
python mcp_example.py
# Run with uv (no activation needed)
uv run python mcp_example.py
License
MIT
Resources
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。