| Crates.io | staticmcp_stdio_bridge |
| lib.rs | staticmcp_stdio_bridge |
| version | 0.0.1 |
| created_at | 2025-08-08 23:35:51.015728+00 |
| updated_at | 2025-08-08 23:35:51.015728+00 |
| description | A lightweight stdio bridge server that serves StaticMCP files. |
| homepage | |
| repository | https://github.com/StaticMCP/stdio_bridge |
| max_upload_size | |
| id | 1787413 |
| size | 89,691 |
A lightweight stdio bridge server that serves StaticMCP files.
The StaticMCP Bridge acts as a translation layer between the MCP protocol and your static JSON files:
mcp.json file describes available resources and toolsresources/ directorytools/ directory structureMore about StaticMCP on https://staticmcp.com.
cargo install static_mcp_bridge
Or build from source:
git clone https://github.com/StaticMCP/StaticMCP
cd StaticMCP/bridge
cargo build --release
my-static-mcp/
├── mcp.json # Manifest file
├── resources/
│ ├── README.md.json # Resource responses
│ └── config.json.json
└── tools/
├── search/
│ ├── rust.json # Tool response for search("rust")
│ └── javascript.json # Tool response for search("javascript")
└── analyze/
└── file.json # Tool response for analyze("file")
mcp.json){
"serverInfo": {
"name": "My StaticMCP Server",
"version": "1.0.0"
},
"capabilities": {
"resources": [
{
"uri": "file://README.md",
"name": "Project README",
"description": "Main project documentation"
}
],
"tools": [
{
"name": "search",
"description": "Search for information",
"inputSchema": {
"type": "object",
"properties": {
"query": { "type": "string" }
}
}
}
]
}
}
resources/README.md.json:
{
"contents": [
{
"uri": "file://README.md",
"mimeType": "text/markdown",
"text": "# My Project\n\nThis is a sample README..."
}
]
}
tools/search/rust.json:
{
"content": [
{
"type": "text",
"text": "Here are search results for 'rust':\n\n1. Rust Programming Language\n2. Systems programming\n3. Memory safety"
}
]
}
# Local directory
static-mcp-bridge ./my-static-mcp
# Remote URL (hosted static files)
static-mcp-bridge https://mysite.com/my-mcp
Test your StaticMCP server using the official MCP Inspector:
npx @modelcontextprotocol/inspector static-mcp-bridge https://yourdomain.com/your-mcp
The bridge automatically maps MCP requests to file paths:
file://path/to/file → resources/path/to/file.jsoncustom://resource → resources/resource.jsontools/{tool_name}/{arg_value}.jsontools/{tool_name}/{arg1}/{arg2}.json (sorted)Examples:
search("rust") → tools/search/rust.jsonanalyze(file="test.txt", format="json") → tools/analyze/json/test.txt.json{
"contents": [
{
"uri": "file://example.txt",
"mimeType": "text/plain",
"text": "File content here"
}
]
}
{
"content": [
{
"type": "text",
"text": "Tool response text"
}
]
}
Deploy your StaticMCP files to any static hosting service:
vercel --prodgh-pages branchcd my-static-mcp
echo '{"builds": [{"src": "**", "use": "@vercel/static"}]}' > vercel.json
vercel --prod
Then use: static-mcp-bridge https://my-mcp.vercel.app
You can generate your StaticMCP files using any method:
import json
import os
# Generate tool responses
for query in ['rust', 'javascript', 'python']:
result = {"content": [{"type": "text", "text": f"Results for {query}..."}]}
os.makedirs(f'tools/search', exist_ok=True)
with open(f'tools/search/{query}.json', 'w') as f:
json.dump(result, f)
#!/bin/bash
# generate-mcp.sh
echo "Generating StaticMCP content..."
python scripts/generate_resources.py
python scripts/generate_tools.py
echo "StaticMCP content ready!"
If a requested file doesn't exist, the bridge returns an appropriate MCP error response.
When serving over HTTP, the bridge handles CORS headers automatically.
All responses are highly cacheable since content is static. Consider setting long cache headers when serving files.
Check out these example StaticMCP implementations:
StaticMCP Bridge - Turn any static file hosting into a powerful MCP server! 🚀