> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Choose between the Metorial SDK, the REST API and plain MCP
URL: https://metorial.com/docs/build/guides/sdk-rest-api-or-mcp

Use the SDK when it has an adapter for your framework, plain MCP when your framework has its own MCP client, and the REST API from any other language.

---

Use the Metorial SDK when it has an adapter for your model SDK or framework. It creates the session, formats the tools and runs the calls. Use a plain MCP connection when your framework brings its own MCP client. Use the REST API from languages other than TypeScript and Python, and to manage resources. All three work on the same sessions and authenticate with the same secret API key, so you can combine them.

**What you'll learn**

* Which path fits which stack
* What each path does for you and what it leaves to you
* The first command or call for each path

**Before you start**

* [Install the CLI and sign in](https://metorial.com/docs/build/sandboxes#install-the-tools)
* A secret [API key](https://metorial.com/docs/build/api) in `METORIAL_API_KEY`

## Pick a path

| You are building with                                                                | Use                                                  | Guide                                                                                                                                        |
| ------------------------------------------------------------------------------------ | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Vercel AI SDK, or the OpenAI, Anthropic, Google or Mistral SDK                       | SDK adapter                                          | [Provider runtime](https://metorial.com/docs/build/providers)                                                                                |
| LangChain or LangGraph, in TypeScript or Python                                      | SDK adapter                                          | [LangChain and LangGraph](https://metorial.com/docs/build/frameworks/langchain)                                                              |
| OpenAI Agents SDK, LlamaIndex, CrewAI, Google ADK, Pydantic AI or AutoGen, in Python | SDK adapter                                          | [Frameworks](https://metorial.com/docs/build/frameworks/openai-agents-sdk)                                                                   |
| OpenAI Agents SDK in TypeScript, Claude Agent SDK or Mastra                          | SDK for the session, then the framework's MCP client | [Claude Agent SDK](https://metorial.com/docs/build/frameworks/claude-agent-sdk), [Mastra](https://metorial.com/docs/build/frameworks/mastra) |
| Any other MCP client                                                                 | REST API for the session, then MCP                   | [Connect any MCP client](https://metorial.com/docs/build/guides/connect-any-mcp-client)                                                      |
| Go, Java, Ruby or another language                                                   | REST API                                             | [Getting started with the API](https://metorial.com/docs/build/api)                                                                          |
| An AI client such as Claude, Cursor or ChatGPT, used by a person                     | A portal's Magic MCP URL, no code                    | [Supported clients](https://metorial.com/docs/platform/clients)                                                                              |

## Compare the three

|                             | SDK                                                               | Plain MCP                                                          | REST API                                      |
| --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------- |
| Packages                    | `metorial` on npm and PyPI, plus an adapter package in TypeScript | Any MCP client library                                             | None                                          |
| Creates the session         | Yes, in `metorial.connect()`                                      | No. Create it with the SDK, the REST API or the CLI                | Yes, `POST /sessions`                         |
| Formats tools for the model | Yes                                                               | Your MCP client or framework does                                  | You do                                        |
| Runs tool calls             | Yes, through the adapter                                          | Your MCP client does, with `tools/call`                            | You do                                        |
| Auth                        | Secret API key                                                    | Secret API key or the session's `client_secret`, as a Bearer token | Secret API key as a Bearer token              |
| Per-user OAuth              | `providerAuthConfigId` in a provider entry                        | Set when the session is created                                    | `provider_auth_config_id` in a provider entry |
| Languages                   | TypeScript and Python                                             | Any                                                                | Any                                           |

## Start each path

The SDK path is one call. Every [framework guide](https://metorial.com/docs/build/frameworks/openai-agents-sdk) has a complete program.

**TypeScript**

```typescript
import { metorialAiSdk } from '@metorial/ai-sdk';
import Metorial from 'metorial';

let metorial = new Metorial({ apiKey: process.env.METORIAL_API_KEY! });

let session = await metorial.connect({
  adapter: metorialAiSdk(),
  providers: [{ providerDeploymentId: process.env.METORIAL_PROVIDER_DEPLOYMENT_ID! }]
});

console.log(Object.keys(session.tools()).join(', '));
```

**Python**

```python
import asyncio
import os

from metorial import Metorial, metorial_openai


async def main():
    metorial = Metorial(api_key=os.environ["METORIAL_API_KEY"])

    session = await metorial.connect(
        adapter=metorial_openai(),
        providers=[
            {"provider_deployment_id": os.environ["METORIAL_PROVIDER_DEPLOYMENT_ID"]}
        ],
    )

    print(", ".join(tool["function"]["name"] for tool in session.tools()))


asyncio.run(main())
```

For plain MCP, create a session and point your client at its `connection_url` with the API key as a Bearer token:

```bash
metorial-admin sessions create \
  --providers '[{"provider_deployment_id": "pde_your_deployment_id"}]'
```

For the REST API, send the same request yourself:

```bash
curl -X POST https://api.metorial.com/sessions \
  -H "Authorization: Bearer $METORIAL_API_KEY" \
  -H "Metorial-Version: 2026-01-01-magnetar" \
  -H "Content-Type: application/json" \
  -d "{\"providers\": [{\"provider_deployment_id\": \"$METORIAL_PROVIDER_DEPLOYMENT_ID\"}]}"
```

## Next steps

* [Developer quickstart](https://metorial.com/docs/build/quickstart): the SDK from install to first tool call
* [Connect any MCP client](https://metorial.com/docs/build/guides/connect-any-mcp-client): the session endpoint, headers and tokens
* [Notes for AI code generators](https://metorial.com/docs/build/guides/notes-for-ai-code-generators): current package names and the mistakes to avoid
* [API reference](https://metorial.com/api): every REST endpoint