FastMCP - Model Context Protocol Server
LocalAbout FastMCP - Model Context Protocol Server
A Python MCP server for managing model contexts and running queries against them. It is intended for MCP clients that need context CRUD, filtering, and optional Datadog metrics.
Key features
- 01Create, retrieve, update, and delete contexts
- 02Query a specified context
- 03Filter contexts by model name and tags
- 04In-memory context storage
- 05Datadog metrics and monitoring
Use cases
- 01Maintain model context records
- 02Run queries using a selected context
- 03Monitor context and query activity in Datadog
MCP support
Exposes context management, query, health-check, and Datadog configuration tools to MCP clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEFastMCP - 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
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.