API Reference
API Overview
REST API and MCP interface for Clean.
Clean exposes two interfaces:
- REST API — HTTP endpoints for indexing, searching, and managing repos
- MCP server — Model Context Protocol interface used by AI agents
Both are served from the same process on port 8000 by default.
Base URL
Authentication
All requests require a Bearer token:
Your API key (clean_sk_...) is available in the dashboard under API Keys.
Response formats
| Format | Header / param | Notes |
|---|---|---|
| TOON (default) | — | Compact tabular, 30–40% fewer tokens |
| JSON | ?format=json | Standard JSON |
Rate limits
| Limit | Value |
|---|---|
| Per IP | 60 req/min |
| Per API key | 120 req/min |
Endpoints
- Search —
GET /search - Repositories —
POST /repos/index,GET /repos,GET /repos/{owner}/{repo}/status - MCP tools —
search_code,index_repo,list_repos