BYOB MCP Server
Enables AI agents to dynamically discover and invoke containerized tools that can be registered at runtime without redeployment. Built on Cloudflare Workers with scale-to-zero containers for secure, isolated tool execution.
README
BYOB MCP Server π
Bring Your Own Binary: A dynamic MCP server built on Cloudflare Workers, Containers, and D1.
Enables AI agents to discover and invoke containerized tools registered at runtimeβno redeployment needed.
Quick Start
# Install dependencies
npm install
# Start local dev server
npm run dev
# In another terminal, test the API
bash test-api.sh
# Deploy to production
npm run deploy
What This Is
A proof-of-concept demonstrating:
- β Dynamic Tool Registry - Tools stored in D1, queried by MCP server
- β Containerized Execution - Each tool runs in isolated Cloudflare Container
- β MCP Protocol - AI agents discover tools via Model Context Protocol
- β HTTP Registration API - Register new tools without redeploying
- β Scale-to-Zero - Containers only run when tools are invoked
Architecture
AI Agent (Claude) ββ[MCP]ββ> Cloudflare Worker ββ[HTTP]ββ> Universal Container
β (ToolRunner)
βββ[SQL]ββ> D1 Registry
Supports:
β’ Echo
β’ Uppercase
β’ JQ
β’ Git Clone
Pre-Built Demo Tools
All four tools run in a single universal container:
- echo_message - Echoes back any JSON input
- why_are_we_yelling - Converts text to UPPERCASE
- query_json - Processes JSON with jq filters
- summarize_repo_readme - Clones a GitHub repo and summarizes its README
API Endpoints
GET /
Health check and server info
GET /api/tools
List all registered tools
POST /api/register-tool
Register a new tool
{
"name": "my_tool",
"description": "What this tool does",
"containerClass": "echo",
"schema": {
"type": "object",
"properties": {
"input": {"type": "string"}
}
}
}
POST /mcp
MCP protocol endpoint (connect your AI agent here)
Example: Register a Tool
curl -X POST http://localhost:8787/api/register-tool \
-H "Content-Type: application/json" \
-d '{
"name": "whisper",
"description": "Echoes message in lowercase",
"containerClass": "toolrunner",
"schema": {
"type": "object",
"properties": {
"message": {"type": "string"}
},
"required": ["message"]
}
}'
Connect to Claude Desktop
Edit your Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"byob-server": {
"url": "http://localhost:8787/mcp"
}
}
}
Restart Claude Desktop, then ask:
- "What tools do you have available?"
- "Can you echo the message 'Hello BYOB!'?"
- "Use why_are_we_yelling with text: hello world"
- "Summarize the README from https://github.com/fiberplane/mcp-lite"
Documentation
- PROJECT_SUMMARY.md - High-level overview
- HACKATHON.md - Full architecture and setup guide
- DEMO.md - Step-by-step demo script
- CLAUDE.md - Development instructions (for AI assistants)
Project Structure
βββ src/
β βββ index.ts # Main Worker + MCP server
β βββ containers.ts # Container class definitions
β βββ types.ts # TypeScript interfaces
βββ containers/
β βββ Dockerfile # Universal container image
β βββ server.js # Multi-tool HTTP server
β βββ README.md # Container documentation
βββ migrations/
β βββ 0001_initial_schema.sql
β βββ 0002_seed_example_tools.sql
βββ wrangler.jsonc # Cloudflare configuration
Adding New Tools
Since all tools use the same universal container, adding new tools is simple:
Option 1: Via API (No redeployment needed)
curl -X POST http://localhost:8787/api/register-tool \
-H "Content-Type: application/json" \
-d '{"name":"my_tool", "description":"...", ...}'
Option 2: Extend the Container
To add new operation types:
- Edit
containers/server.jsto handle new input patterns - Add new tool definitions to
migrations/0002_seed_example_tools.sql - Redeploy
The single container approach keeps things simple for demos while still demonstrating the BYOB architecture.
Technology Stack
- Runtime: Cloudflare Workers (V8 Isolates)
- MCP: mcp-lite (not @modelcontextprotocol/sdk)
- Web Framework: Hono
- Database: Cloudflare D1 (SQLite)
- Containers: Cloudflare Containers (Durable Objects)
- Schema: Zod + JSON Schema
Deployment
Local Development
npm run dev
# Server runs on http://localhost:8787
Production Deployment
- Run migrations on remote database:
npx wrangler d1 execute byob-tools-registry --remote \
--file=./migrations/0001_initial_schema.sql
npx wrangler d1 execute byob-tools-registry --remote \
--file=./migrations/0002_seed_example_tools.sql
- Deploy Worker and Containers:
npm run deploy
Note: First deployment takes 2-5 minutes to build Docker images.
- Update Claude Desktop config with your production URL:
{
"mcpServers": {
"byob-server": {
"url": "https://byob-mcp-server.YOUR_ACCOUNT.workers.dev/mcp"
}
}
}
Testing
# Automated API tests
bash test-api.sh
# Manual health check
curl http://localhost:8787/
# List tools
curl http://localhost:8787/api/tools | jq
# Test MCP protocol
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Key Features
Dynamic Discovery
Tools registered in D1 appear immediately to all connected AI agentsβno redeployment required.
Secure Isolation
Each container runs in an isolated sandbox with resource limits and ephemeral storage.
Serverless Scale
Containers scale to zero when idle. Pay only for actual tool invocations.
Standard Interface
All containers expose POST /execute endpoint accepting/returning JSON.
Limitations
Container classes must be defined at deploy time in wrangler.jsonc. True runtime BYOB would require automatic Worker rebuild/redeploy when new containers are registered.
Workaround: Multiple logical tools can share the same container class, allowing significant flexibility without redeployment.
Resources
License
MIT - Built for hackathon demonstration
Contributing
This is a hackathon prototype. For questions or suggestions, open an issue!
Built with βοΈ Cloudflare Workers | π³ Containers | ποΈ D1 | π€ MCP
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Neon Database
MCP server for interacting with Neon Management API and databases