Production-ready FastMCP server exposing OmniAgentPay payment tools via Model Context Protocol (MCP).
Version: 0.1.0 | Release Notes | Testing Guide | Troubleshooting
- Python 3.11+
- FastMCP (MCP protocol implementation)
- FastAPI (web framework)
- Pydantic v2
- Structlog
- OmniAgentPay SDK
app/main.py: FastAPI entrypoint with FastMCP server mountedapp/core: Configuration (pydantic-settings), logging (structlog), and securityapp/mcp:fastmcp_server.py: FastMCP server with all payment toolsauth.py: Bearer token and JWT authentication provider
app/payments: OmniAgentPay SDK integration and payment orchestrationapp/webhooks: Webhook handlers for Circle payment events
Create a .env file with required configuration:
# Payment Configuration
CIRCLE_API_KEY=your_circle_api_key
ENTITY_SECRET=your_entity_secret
ENVIRONMENT=dev # or "prod"
# FastMCP Authentication (optional but recommended)
MCP_AUTH_ENABLED=true
MCP_AUTH_TOKEN=your_static_bearer_token # For simple API clients
# OR
MCP_JWT_SECRET=your_jwt_secret # For JWT-based auth
# Guard Policies
OMNIAGENTPAY_DAILY_BUDGET=1000.0
OMNIAGENTPAY_HOURLY_BUDGET=200.0
OMNIAGENTPAY_TX_LIMIT=500.0
OMNIAGENTPAY_RATE_LIMIT_PER_MIN=5
OMNIAGENTPAY_WHITELISTED_RECIPIENTS=address1,address2python3.11 -m venv venv
source venv/bin/activate
pip install -r requirements.txtuvicorn app.main:app --host 0.0.0.0 --port 8000- Base URL:
http://localhost:8000/mcp/ - Protocol: MCP over HTTP (stateless)
If MCP_AUTH_ENABLED=true, include Bearer token in requests:
Authorization: Bearer <your_token>create_agent_wallet(agent_name: str)- Create wallet with guardrailssimulate_payment(from_wallet_id, to_address, amount, currency)- Validate paymentpay_recipient(from_wallet_id, to_address, amount, currency)- Execute paymentcreate_payment_intent(wallet_id, recipient, amount, currency, metadata)- Create intentconfirm_payment_intent(intent_id)- Confirm intent
check_balance(wallet_id)- Get USDC balance
remove_recipient_guard(wallet_id)- Remove recipient restrictionsadd_recipient_to_whitelist(wallet_id, addresses)- Update whitelist
curl -X POST http://localhost:8000/mcp/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_token" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'curl -X POST http://localhost:8000/mcp/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_token" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "check_balance",
"arguments": {
"wallet_id": "wallet_123"
}
},
"id": 2
}'This server is compatible with all MCP clients:
- Claude Desktop (via HTTP transport)
- ChatGPT (via MCP protocol)
- Gemini (via MCP protocol)
- Custom MCP clients
- Stateless HTTP: Already configured for horizontal scaling
- Authentication: Enable
MCP_AUTH_ENABLED=trueand set secure tokens - HTTPS: Use reverse proxy (nginx/traefik) with TLS
- Environment Variables: Store secrets securely (AWS Secrets Manager, etc.)
- Monitoring: Add structured logging and metrics
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]- All payment operations are protected by OmniAgentPay SDK guardrails
- Authentication required for all tools (if enabled)
- Bearer token or JWT verification supported
- Stateless design prevents session-based attacks
- Input validation via Pydantic schemas
- RELEASE.md: Release notes, version history, and upgrade instructions
- TESTING.md: Testing guide and examples
- TROUBLESHOOTING.md: Common issues and solutions
- SETUP_AUTH.md: Authentication setup guide
See LICENSE file for details.