> For the complete documentation index, see [llms.txt](https://docs.meganova.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meganova.ai/integration-guides/mcp.md).

# Model Context Protocol (MCP)

MegaNova exposes a native [Model Context Protocol](https://modelcontextprotocol.io/) server so AI agents — Claude Desktop, the Claude Agent SDK, custom MCP clients, and any tool that speaks streamable HTTP MCP — can call MegaNova's inference surface as first-class tools and browse its catalog through resources.

## Endpoint

| Transport       | URL                            |
| --------------- | ------------------------------ |
| Streamable HTTP | `https://api.meganova.ai/mcp/` |

The server is stateless and returns JSON responses. There is no separate SSE endpoint — point your MCP client directly at this URL.

> **Auth model.** Tool calls require an API key passed as the `api_key` argument on each tool invocation (not as an HTTP header). Resources (catalog discovery) are anonymous — no auth required. Keys must begin with `sk-`.

## What the server exposes

### Tools (require `api_key`)

Each tool proxies to the equivalent REST endpoint and preserves billing, rate-limiting, and access-tier checks.

| Tool                | Purpose                                      | Key arguments                                                 |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------- |
| `chat_completions`  | OpenAI-compatible chat                       | `api_key`, `model`, `messages[]`, `temperature`, `max_tokens` |
| `text_completions`  | Legacy completion                            | `api_key`, `model`, `prompt`, `max_tokens`, `temperature`     |
| `generate_image`    | Text-to-image                                | `api_key`, `model`, `prompt`, plus model-specific options     |
| `generate_video`    | Async text-to-video / image-to-video kickoff | `api_key`, `model`, `prompt`, `resolution`, `duration`        |
| `get_video_status`  | Poll a video generation                      | `api_key`, `generation_id`                                    |
| `text_to_speech`    | TTS audio synthesis                          | `api_key`, `model`, `input`, `voice`                          |
| `list_voices`       | Enumerate available TTS voices               | `api_key`                                                     |
| `create_embeddings` | Embedding vectors                            | `api_key`, `model`, `input`                                   |
| `list_models`       | All models callable by the caller            | `api_key`                                                     |
| `get_model`         | Fetch a single model's metadata              | `api_key`, `model_id`                                         |

### Resources (anonymous)

Resources surface platform state that doesn't need an API key:

| URI                                 | Description                                    |
| ----------------------------------- | ---------------------------------------------- |
| `meganova://models/all`             | Every model in the catalog with its media type |
| `meganova://models/image`           | Image-generation models only                   |
| `meganova://models/video`           | Video-generation models only                   |
| `meganova://gpu/instances`          | GPU instances grouped by region and type       |
| `meganova://gpu/instances/{region}` | GPU instances filtered by region               |

### Prompts

Parameterized prompt templates your agent can invoke:

| Prompt                    | Arguments                                  |
| ------------------------- | ------------------------------------------ |
| `character_persona`       | `name`, `role`, `personality`, `backstory` |
| `image_generation_prompt` | `subject`, `style`, `mood`                 |
| `video_generation_prompt` | `subject`, `action`, `camera`, `duration`  |

## Connecting from Claude Desktop

Add this entry to your `claude_desktop_config.json` (or the MCP section of your agent config):

```json
{
  "mcpServers": {
    "meganova": {
      "url": "https://api.meganova.ai/mcp/"
    }
  }
}
```

Once Claude Desktop reconnects, you'll see MegaNova tools and resources in the tools picker. Paste your API key the first time a tool asks for one.

## Connecting from the Claude Agent SDK

```python
from anthropic import Anthropic
from anthropic.types.beta import BetaMcpServerConfig

client = Anthropic()

response = client.beta.messages.create(
    model="claude-opus-4-7",
    max_tokens=2048,
    mcp_servers=[
        BetaMcpServerConfig(
            name="meganova",
            url="https://api.meganova.ai/mcp/",
        ),
    ],
    messages=[{
        "role": "user",
        "content": "Use the MegaNova MCP to list all image models, then pick one and describe what it's best for.",
    }],
)
```

## Calling a tool directly (quick check)

Every MCP client does the handshake for you, but if you want to sanity-check the endpoint with `curl`, send an `initialize` request:

```bash
curl -X POST https://api.meganova.ai/mcp/ \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "capabilities": {},
      "clientInfo": {"name": "curl-test", "version": "0.1"}
    }
  }'
```

A successful handshake returns a `result` with the server's capabilities and a `Mcp-Session-Id` header you can reuse for subsequent `tools/call`, `resources/read`, etc.

## Billing and rate limits

MCP tool calls are billed and rate-limited exactly the same as direct REST calls — the API key you pass determines the tier and per-model daily limit. Usage shows up on the same [Inference Usage dashboard](https://console.meganova.ai/home) and via the [usage API](/api-reference/platform-api/usage/get-usage-records.md).

## Related

* [API Reference - Inference API](/api-reference/inference-models.md)
* [List Models](/inference-models/model-list.md)
* [Authentication](/api-reference/platform-api/authentication.md)
