LeanMCP API Reference

Use the LeanMCP API to programmatically build, test, and deploy your MCP servers.

What You Can Do

The LeanMCP API lets you:
  • Build MCP servers from templates
  • Test MCPs with AI agents
  • Deploy to production environments
  • Monitor MCP performance
  • Manage your MCP projects

Authentication

All API requests require an API key:
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.leanmcp.com/v1/build
Get your API key from the LeanMCP Dashboard.

Base URL

https://api.leanmcp.com/v1

Common Patterns

Build an MCP Server

POST /v1/build
{
  "name": "my-mcp-server",
  "template": "basic",
  "tools": [...],
  "resources": [...] 
}

Test with AI

POST /v1/test
{
  "mcp_id": "your-mcp-id",
  "message": "Help me use the tools",
  "ai_model": "claude-3"
}

Deploy to Production

POST /v1/deploy  
{
  "mcp_id": "your-mcp-id",
  "environment": "production"
}

Response Format

All API responses follow this format:
{
  "success": true,
  "data": { /* response data */ },
  "meta": {
    "request_id": "req_123",
    "timestamp": "2023-12-01T12:00:00Z"
  }
}

Error Handling

Errors return HTTP status codes with details:
{
  "success": false,
  "error": {
    "code": "INVALID_MCP",
    "message": "MCP server configuration is invalid",
    "details": "Tool 'example' is missing required field 'description'"
  }
}

Rate Limits

  • Free Plan: 100 requests/hour
  • Pro Plan: 1,000 requests/hour
  • Enterprise: Custom limits
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

SDKs

Need Help?