MCP Context Server — a FastMCP-based server providing persistent multimodal context storage for LLM agents.
Project description
MCP Context Server
A high-performance Model Context Protocol (MCP) server providing persistent multimodal context storage for LLM agents. Built with FastMCP, this server enables seamless context sharing across multiple agents working on the same task through thread-based scoping.
Key Features
- Multimodal Context Storage: Store and retrieve both text and images (up to 10MB per image, 100MB total)
- Thread-Based Scoping: Agents working on the same task share context through thread IDs
- Tag-Based Organization: Efficient context retrieval with normalized, indexed tags
- High Performance: SQLite with WAL mode, strategic indexing, and async operations
- MCP Standard Compliance: Works with Claude Code, LangGraph, and any MCP-compatible client
- Production Ready: Comprehensive test coverage, type safety, and robust error handling
Prerequisites
uvpackage manager (install instructions)- An MCP-compatible client (Claude Code, LangGraph, or any MCP client)
Adding the Server to Claude Code
There are two ways to add the MCP Context Server to Claude Code:
Method 1: Using CLI Command
claude mcp add context-server -- uvx --from git+https://github.com/alex-feel/mcp-context-server mcp-context-server
For more details, see: https://docs.claude.com/en/docs/claude-code/mcp#option-1%3A-add-a-local-stdio-server
Method 2: Direct File Configuration
Add the following to your .mcp.json file in your project directory:
{
"mcpServers": {
"context-server": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/alex-feel/mcp-context-server",
"mcp-context-server"
],
"env": {}
}
}
}
For configuration file locations and details, see: https://docs.claude.com/en/docs/claude-code/settings#settings-files
Verifying Installation
# Start Claude Code
claude
# Check MCP tools are available
/mcp
Troubleshooting
Common Issues
Server Not Starting
- Verify
uvinstallation: Ensureuvis installed and in PATH - Network connectivity: Check access to GitHub for package installation
- Check configuration: Verify the server configuration is correct
Server Not Listed
- Check MCP tools with
/mcpcommand in Claude Code - Verify the configuration was saved correctly
- Restart Claude Code after configuration changes
Common Errors
- "Server not responding": Check if
uvxcan access GitHub - "Command not found": Ensure
uvis installed and in PATH - Configuration issues: Check your
.mcp.jsonfile or re-run the CLI command
Environment Configuration
Environment Variables
You can configure the server using environment variables in your MCP configuration. The server supports environment variable expansion using ${VAR} or ${VAR:-default} syntax.
Example configuration with environment variables:
{
"mcpServers": {
"context-server": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/alex-feel/mcp-context-server",
"mcp-context-server"
],
"env": {
"LOG_LEVEL": "${LOG_LEVEL:-INFO}",
"MCP_CONTEXT_DB": "${MCP_CONTEXT_DB:-~/.mcp/context_storage.db}",
"MAX_IMAGE_SIZE_MB": "${MAX_IMAGE_SIZE_MB:-10}",
"MAX_TOTAL_SIZE_MB": "${MAX_TOTAL_SIZE_MB:-100}"
}
}
}
}
For more details on environment variable expansion, see: https://docs.claude.com/en/docs/claude-code/mcp#environment-variable-expansion-in-mcp-json
Supported Environment Variables
- LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) - defaults to INFO
- MCP_CONTEXT_DB: Database file location - defaults to ~/.mcp/context_storage.db
- MAX_IMAGE_SIZE_MB: Maximum size per image in MB - defaults to 10
- MAX_TOTAL_SIZE_MB: Maximum total request size in MB - defaults to 100
Advanced Configuration
Additional environment variables are available for advanced server tuning, including:
- Connection pool configuration
- Retry behavior settings
- SQLite performance optimization
- Circuit breaker thresholds
- Operation timeouts
For a complete list of all configuration options, see app/settings.py.
API Reference
Tools
store_context
Store a context entry with optional images.
Parameters:
thread_id(str, required): Unique identifier for the conversation/task threadsource(str, required): Either 'user' or 'agent'text(str, required): Text content to storeimages(list, optional): Base64 encoded images with mime_typemetadata(dict, optional): Additional structured datatags(list, optional): Tags for organization (automatically normalized)
Returns: Dictionary with success status and context_id
search_context
Search context entries with efficient filtering.
Parameters:
thread_id(str, optional): Filter by threadsource(str, optional): Filter by source ('user' or 'agent')tags(list, optional): Filter by tags (OR logic)content_type(str, optional): Filter by type ('text' or 'multimodal')limit(int, optional): Maximum results (default: 50, max: 500)offset(int, optional): Pagination offsetinclude_images(bool, optional): Include image data in response
Returns: List of matching context entries
get_context_by_ids
Fetch specific context entries by their IDs.
Parameters:
context_ids(list, required): List of context entry IDsinclude_images(bool, optional): Include image data (default: True)
Returns: List of context entries with full content
delete_context
Delete context entries by IDs or thread.
Parameters:
context_ids(list, optional): Specific IDs to deletethread_id(str, optional): Delete all entries in a thread
Returns: Dictionary with deletion count
list_threads
List all active threads with statistics.
Returns: Dictionary containing:
- List of threads with entry counts
- Source type distribution
- Multimodal content counts
- Timestamp ranges
get_statistics
Get database statistics and usage metrics.
Returns: Dictionary with:
- Total entries count
- Breakdown by source and content type
- Total images count
- Unique tags count
- Database size in MB
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_context_server-0.1.0.tar.gz.
File metadata
- Download URL: mcp_context_server-0.1.0.tar.gz
- Upload date:
- Size: 118.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60e254280a145f559bcee9dd064b4f1c44875a0bc5cb5b2d82bd38196605382d
|
|
| MD5 |
b5742fda1f37146ec066f4e4b5dffc88
|
|
| BLAKE2b-256 |
c18cd0c9f237c3bcbef9a86a1efd03dfd0367abfd8f9ec70acb1093ce6bc3343
|
Provenance
The following attestation bundles were made for mcp_context_server-0.1.0.tar.gz:
Publisher:
publish.yml on alex-feel/mcp-context-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_context_server-0.1.0.tar.gz -
Subject digest:
60e254280a145f559bcee9dd064b4f1c44875a0bc5cb5b2d82bd38196605382d - Sigstore transparency entry: 560538192
- Sigstore integration time:
-
Permalink:
alex-feel/mcp-context-server@462982d534874986fece4493504feb2490a0e5bc -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alex-feel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@462982d534874986fece4493504feb2490a0e5bc -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp_context_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_context_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5731c53e80be2aa4b110ab1926051bce984601b33da2e00bf1d4fadb060127e
|
|
| MD5 |
cf16667f35812882130dc15529a87cf3
|
|
| BLAKE2b-256 |
13e481e9c7d851cb501ef16e93f0d809b3c67f57521451339ed22420e79455e9
|
Provenance
The following attestation bundles were made for mcp_context_server-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on alex-feel/mcp-context-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_context_server-0.1.0-py3-none-any.whl -
Subject digest:
f5731c53e80be2aa4b110ab1926051bce984601b33da2e00bf1d4fadb060127e - Sigstore transparency entry: 560538194
- Sigstore integration time:
-
Permalink:
alex-feel/mcp-context-server@462982d534874986fece4493504feb2490a0e5bc -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alex-feel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@462982d534874986fece4493504feb2490a0e5bc -
Trigger Event:
release
-
Statement type: