> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leanmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LeanMCP API

> Build, test, and deploy MCPs using the LeanMCP API

# 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:

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.leanmcp.com/v1/build
```

Get your API key from the [LeanMCP Dashboard](https://dashboard.leanmcp.com).

## Base URL

```
https://api.leanmcp.com/v1
```

## Common Patterns

### Build an MCP Server

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

### Test with AI

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

### Deploy to Production

```bash theme={null}
POST /v1/deploy  
{
  "mcp_id": "your-mcp-id",
  "environment": "production"
}
```

## Response Format

All API responses follow this format:

```json theme={null}
{
  "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:

```json theme={null}
{
  "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

<CardGroup cols={2}>
  <Card title="Node.js SDK" icon="node-js" href="https://www.npmjs.com/package/@leanmcp/sdk">
    Official Node.js SDK for LeanMCP API
  </Card>

  <Card title="Python SDK" icon="python" href="https://pypi.org/project/leanmcp/">
    Official Python SDK for LeanMCP API
  </Card>

  <Card title="REST API" icon="globe" href="/api-reference/build">
    Use any HTTP client with our REST API
  </Card>

  <Card title="CLI Tool" icon="terminal" href="/development">
    Command line interface for development
  </Card>
</CardGroup>

## Need Help?

* [API Examples](https://github.com/leanmcp/api-examples)
* [Community Discord](https://discord.gg/leanmcp)
* [Support Email](mailto:support@leanmcp.com)
