---
name: metorial
description: Use when a task involves Metorial, the open-source MCP gateway, for example connecting AI clients such as Claude Code, Cursor, ChatGPT, Claude or Codex to company tools through a Magic MCP URL, building an agent on the Metorial API or SDKs, or self-hosting the Metorial Platform. Explains what Metorial is, which setup path fits, where the docs are, and common mistakes.
---

# Metorial

Metorial is an open-source MCP gateway. It sits between AI clients (Claude, ChatGPT, Cursor, Codex, and agents you build) and the tools they call through MCP. It handles sign-in, decides which integrations and tools each person or agent can use, runs each call with the right credentials, and records it.

- Admins manage access in **Workforce**. People connect through a branded **portal**, where they sign in with company SSO, connect their own accounts, and copy a **Magic MCP URL** for their AI client.
- Developers build products and agents on the **API** (`https://api.metorial.com`) and the **SDKs** (`metorial` on npm and PyPI).
- The **Metorial Platform** is open source and can be self-hosted with Docker Compose.

Docs: <https://metorial.com/docs>. Index for agents: <https://metorial.com/llms.txt>. Every docs page is also available as markdown by adding `.md` to its URL.

## When to use this skill

- The user wants employees or their own AI client to reach company apps (GitHub, Linear, Slack and more) through MCP with SSO, per-user OAuth, access control and audit logs.
- The user is writing code against the Metorial API, the JavaScript or Python SDK, or Metorial sandboxes.
- The user wants to run Metorial on their own infrastructure.
- The user asks how Metorial compares with connecting MCP servers directly. A single developer with one client and a few servers can configure them directly; a gateway helps once more than one person or more than one AI client needs the same integrations.

## Pick a path

| The user wants to | Path | Start here |
| --- | --- | --- |
| Give employees' AI clients approved access to company tools | Workforce, portal, and Magic MCP URL | [Workforce](https://metorial.com/docs/platform/workforce.md), [Portals](https://metorial.com/docs/platform/workforce/portals.md), [Client guides](https://metorial.com/docs/platform/clients.md) |
| Connect one AI client (Claude Code, Cursor, ChatGPT, Claude, Codex) | Magic MCP URL from the portal | [Which AI clients work with Metorial?](https://metorial.com/docs/platform/clients.md) |
| Build a product or agent that calls tools for its users | API or SDK | [Developer quickstart](https://metorial.com/docs/build/quickstart.md), [JavaScript SDK](https://metorial.com/docs/build/sdk/javascript.md), [Python SDK](https://metorial.com/docs/build/sdk/python.md), [API reference](https://metorial.com/api.md) |
| Give agents isolated Linux machines | Sandboxes | [Sandboxes](https://metorial.com/docs/build/sandboxes.md) |
| Bring an internal API or an existing MCP server | Custom provider or linked remote server | [Custom providers](https://metorial.com/docs/build/custom-providers.md), [Link a remote MCP server](https://metorial.com/docs/platform/integrations/link-remote-mcp-server.md) |
| Run Metorial on their own servers | Self-host the open-source platform | [Docker Compose setup files](https://github.com/metorial/metorial-platform/tree/main/self-hosting), [On-prem hosting](https://metorial.com/features/on-prem) |

If the path is unclear, ask the user whether they are rolling Metorial out to people (Workforce) or building software on it (API/SDK). For step-by-step setup, follow <https://metorial.com/docs-static/setup.md>.

## Key setup facts

- Hosted dashboard: <https://platform.metorial.com>.
- API keys are created in the dashboard under **Developer**, **API Keys**, **Create API Key**. Secret keys start with `metorial_sk_` and give full project access; publishable keys start with `metorial_pk_`. API requests send `Authorization: Bearer <key>`.
- The SDK has two parts: the core package (`npm install metorial` or `pip install metorial`) and a provider package for the model library, such as `@metorial/ai-sdk`, `@metorial/anthropic`, `@metorial/openai` or `@metorial/google`. A session needs a provider deployment ID from the dashboard.
- Employees connecting an AI client do not need API keys. They sign in with OAuth, and their credentials stay in Metorial Vault rather than in the client config.
- Supported clients: any client that can add a remote MCP server over HTTP and sign in with OAuth.
- Sandbox commands use the `metorial-admin` CLI (`npm install -g @metorial/admin`, then `metorial-admin login`).
- Self-hosting: clone https://github.com/metorial/metorial-platform and run `./self-hosting/run.sh --host localhost --secret "$(openssl rand -hex 32)"`. It needs Docker with Compose, at least 8 GB of RAM, about 20 GB of disk, and Node.js, npm and Bun. The dashboard runs on port 3300.

## Gotchas

- Do not put a `metorial_sk_` secret key in client-side code, a committed file, or an AI client's MCP config. Read it from an environment variable such as `METORIAL_API_KEY`.
- A Magic MCP URL from the portal is not an API key. Each person's access comes from their own sign-in, so the client config holds only the URL.
- If an integration is missing after sign-in, the person's groups may not grant it, or it was not selected on the consent screen. Check the account's groups, then sign in again.
- CLI clients such as Claude Code finish OAuth through a localhost callback. The portal's **Allowed OAuth Redirects** must include **Localhost apps** (`http://localhost:*/*`).
- Claude Code caps a tool result at 25,000 tokens by default. Raise it with `MAX_MCP_OUTPUT_TOKENS`.
- Metorial does not scan devices for unapproved MCP servers. Locking clients to the approved URL is done in each client's admin settings.
- The repository's self-hosting setup is aimed at running and evaluating the platform. For production with strict compliance needs, Metorial offers on-prem hosting.
- Look up exact SDK method names and API fields in the docs instead of guessing. Use the docs MCP server at `https://metorial.com/docs-api/mcp` (tools `search_docs` and `read_page`) if it is connected, or fetch the `.md` version of the page.
