Ultra-lightweight MCP (Model Context Protocol) server for serving AI agent definitions
AgentMCP is a minimalist MCP server that serves specialized AI agent definitions from YAML files. With a ~10MB memory footprint and zero hosting cost, it's perfect for sharing and managing custom agents across your team.
- Tiny Footprint: ~10MB RAM, 8-12MB binary
- Fast: <100ms cold start, <10ms request latency
- Simple: ~400 lines of Go code, 2 dependencies
- Flexible: stdio (local) or HTTP/SSE (remote) transport
- Zero Cost: Deploy on Oracle Cloud Always Free tier
- Hot Reload: Watch agent files for automatic updates
- Production Ready: Docker, systemd, comprehensive tests
macOS (Homebrew):
# Coming soon
brew install agentmcpDownload Binary:
# Linux (AMD64)
curl -L -o agentmcp https://github.com/aminghadersohi/agentmcp/releases/latest/download/agentmcp-linux-amd64
chmod +x agentmcp
# macOS (Apple Silicon)
curl -L -o agentmcp https://github.com/aminghadersohi/agentmcp/releases/latest/download/agentmcp-darwin-arm64
chmod +x agentmcpDocker:
docker pull ghcr.io/aminghadersohi/agentmcp:latestLocal (stdio):
# Create agents directory
mkdir agents
# Add your agent YAML files to agents/
# Run server
./agentmcp -agents ./agents -transport stdioRemote (HTTP/SSE):
./agentmcp -agents ./agents -transport sse -port 8080Docker:
docker run -v $(pwd)/agents:/app/agents ghcr.io/aminghadersohi/agentmcp:latestCreate agent definitions in YAML:
# agents/frontend-developer.yaml
---
name: frontend-developer
version: 1.0.0
description: Expert frontend engineer specializing in React and TypeScript
model: sonnet # or opus, haiku
tools:
- Read
- Write
- Grep
- Glob
- Edit
- Bash
metadata:
author: Your Name
tags:
- frontend
- react
- typescript
created: 2025-01-15T10:00:00Z
prompt: |
You are an expert frontend engineer with deep knowledge of modern web development.
## Core Expertise
- React 18+ with hooks and suspense
- TypeScript with strict mode
- CSS Grid, Flexbox, responsive design
- Performance optimization
## Working Principles
- Component reusability
- Type safety
- Mobile-first design
- Accessibility from the startSee agents/ for more examples.
MCP Serve exposes three tools:
List all available agents, optionally filtered by tags.
{
"name": "list_agents",
"arguments": {
"tags": ["frontend", "react"]
}
}Get complete agent definition by name.
{
"name": "get_agent",
"arguments": {
"name": "frontend-developer"
}
}Search agents by keyword in name, description, or tags.
{
"name": "search_agents",
"arguments": {
"query": "typescript"
}
}./agentmcp \
-agents ./agents \ # Path to agents directory
-transport stdio \ # Transport: stdio or sse
-port 8080 \ # HTTP port (sse mode only)
-api-key your-secret-key \ # Optional API key
-watch # Enable hot reloadexport MCP_AGENTS_DIR=./agents
export MCP_TRANSPORT=stdio
export MCP_PORT=8080
export MCP_API_KEY=your-secret-key
export MCP_WATCH=trueCopy config.yaml.example to config.yaml:
agents_dir: ./agents
transport: stdio
port: 8080
watch: true
# Optional Git integration
git:
repo: https://github.com/aminghadersohi/agentmcp.git
branch: main
pull_on_startup: truegit clone https://github.com/aminghadersohi/agentmcp.git
cd agentmcp
./deployment/deploy.shOr manually:
docker compose -f docker-compose.v2.yml up -d --build# Copy binary and agents
sudo mkdir -p /opt/agentmcp/agents
sudo cp agentmcp /opt/agentmcp/
sudo cp agents/*.yaml /opt/agentmcp/agents/
# Install service
sudo cp deployment/agentmcp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable agentmcp
sudo systemctl start agentmcp- Go 1.22+
- Make (optional)
git clone https://github.com/aminghadersohi/agentmcp.git
cd agentmcp
go build -o agentmcp .go test -v ./..../build.shThis creates binaries for:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
agentmcp/
├── main.go # Server implementation
├── main_test.go # Unit tests
├── go.mod # Go dependencies
├── agents/ # Example agents
│ ├── frontend-developer.yaml
│ ├── backend-engineer.yaml
│ ├── devops-engineer.yaml
│ └── code-reviewer.yaml
├── deployment/ # Deployment files
│ ├── deploy.sh
│ └── agentmcp.service
├── Dockerfile # Container image
├── docker-compose.yml # Docker Compose config
├── build.sh # Multi-platform build script
└── .github/workflows/ # CI/CD pipelines
├── ci.yml
└── release.yml
Target metrics:
| Metric | Target | Typical |
|---|---|---|
| Binary Size | <12MB | ~10MB |
| Memory (Idle) | <10MB | ~8MB |
| Memory (Load) | <20MB | ~15MB |
| Cold Start | <100ms | ~50ms |
| Request Latency | <10ms | ~2-5ms |
| Throughput | >1000 req/s | ~5000 req/s |
- Authentication: Optional API key via
-api-keyflag orMCP_API_KEYenv var - YAML Safety: Uses safe YAML parsing (no code execution)
- File Validation: Validates agent schema before loading
- Resource Limits: Memory and CPU limits via Docker/systemd
| Deployment | Monthly Cost | Notes |
|---|---|---|
| Oracle Cloud Always Free | $0 | Perpetual free tier, 24GB RAM |
| AWS Lambda Free Tier | $0 | <1M requests/month |
| Fly.io Hobby | $5 | Auto-scaling, global |
| Railway | $5 | Usage-based |
| Local (dev) | $0 | stdio transport |
Recommended: Oracle Cloud Always Free for production.
- Core MCP server with 3 tools
- stdio and HTTP/SSE transports
- File watcher for hot reload
- Docker support
- Systemd service
- Deployment scripts
- CI/CD pipelines
- Agent validation (JSON Schema)
- Fuzzy search
- Webhooks for Git updates
- Multi-repo support
- Prometheus metrics endpoint
- Agent composition/imports
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Q: Why Go instead of Rust? A: Faster development, excellent MCP SDK, good enough performance. Go produces 8-12MB binaries vs Rust's 2-3MB, but for serving YAML files, the difference doesn't matter.
Q: Why not use a database? A: Agent definitions are static files that change infrequently. Git + filesystem provides version control, easy editing, zero overhead, and simple backup.
Q: Can I run multiple instances? A: Yes! The server is read-only, so you can run multiple instances behind a load balancer. Each instance uses <10MB RAM.
Q: How do I update agents?
A: Edit YAML files and either restart the server or enable -watch for hot reload.
Q: What about agent execution? A: Out of scope. Agents execute in MCP clients (like Claude Code), not the server. The server only serves definitions.
MIT License - see LICENSE for details.
- Built with mcp-go
- Inspired by the Quake engine's legendary efficiency
- Philosophy: "Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away." - Antoine de Saint-Exupéry
Built with ❤️ for the MCP community