# Coral (MCP Gateway)

> A self-hosted MCP gateway where agents write TypeScript programs, Coral checks every call against your policy, and working code becomes a reusable custom tool

- Category: Evaluation & Production Ops / Gateways & Routing
- Language: Rust
- Licence: Apache-2.0 (ee/ directory under the Coral Enterprise license)
- Repository: https://github.com/withcoral/coral
- Website: https://withcoral.com
- Canonical page: https://ai-tldr.dev/tools/coral-gateway/

## In short

Coral (MCP Gateway) is a self-hosted MCP gateway where agents write TypeScript programs, Coral checks every call against your policy, and working code becomes a reusable custom tool. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in Rust and licensed Apache-2.0 (ee/ directory under the Coral Enterprise license).

## Overview

Coral is an open-source, self-hosted gateway that sits between AI agents and the systems they work on — GitHub, Slack, Linear, databases, internal APIs. Instead of exposing hundreds of individual tool schemas to the model, Coral builds on the "code mode" approach: the agent finds tools with `coral.search`, reads their TypeScript signatures, and sends Coral a short TypeScript program through a single `exec` tool. One program can call several tools, filter the results and return only what the task needs, so less raw data passes through the model's context.

Each program runs in a fresh V8 isolate with no network access, no credentials and no imports. Every provider call it makes goes through Coral's policy check: each provider tool and custom tool is set to Allow, Ask or Block, and an Ask pauses the run until a person approves the exact call with its arguments. Only then does Coral add the credentials and forward the call. Runs happen on the Coral server, so they continue if the agent disconnects, and every run is attributed to the person or agent that started it. Providers can be set to act as the caller's own account, so teammates share tools without sharing API tokens.

The distinctive part is custom tools. When a program succeeds, the agent can save it as a private tool and call it next time in one step as `coral.private.<name>(...)`; a workspace owner can publish it to everyone as `coral.shared`. Because a custom tool is code, it can hold rules that a plain allow/block list cannot — the README's example is a `closeStaleTicket` tool that changes one field, and only on tickets with no activity for 30 days — while Coral still checks every provider call inside it. The project reports that across 34 tasks on GitHub, Linear and Slack, custom tools cut tokens by 37%, cost by 31% and time by 29%.

Coral is written in Rust and runs either as a desktop app (macOS on Apple silicon, Windows x64, Linux x86_64) or as a shared team server under Docker Compose or Kubernetes with an OIDC identity provider and SQLite or Postgres. Providers come from a catalog or from any OpenAPI document or MCP server, and any MCP-capable agent can connect. The open-source edition is Apache-2.0 with no limits on users, agents or volume; an `ee/` directory holds Enterprise Edition code (SSO with SAML, SCIM, advanced RBAC, an immutable audit log) under its own licence. Coral v1 replaced the 0.x SQL interface with TypeScript programs.

## What it does

- Code mode over MCP: agents search tools, read TypeScript signatures and send one program that chains several calls through a single `exec` tool
- Programs run in fresh V8 isolates with no network, credentials or imports; Coral injects credentials only after the policy check
- Allow, Ask or Block per provider tool and per custom tool, with approvals showing the exact call and arguments
- Custom tools: successful programs saved as private tools and shareable across a workspace, with provider calls inside still policy-checked
- Connects anything with an MCP server or OpenAPI document; providers can act as each caller's own account
- Runs as a desktop app or a self-hosted team server (Docker Compose or Kubernetes, OIDC, SQLite or Postgres)

## Getting started

Use the desktop app for yourself, or run a shared server for a team. Either way, you add a provider and then point your MCP client at the workspace's MCP URL.

1. Install Coral

   Download the desktop app from withcoral.com/download (macOS on Apple silicon, Windows x64, Linux x86_64). For a team, run a shared server with Docker Compose or Kubernetes; it needs an OIDC identity provider, a reverse proxy for TLS, and SQLite or Postgres.

2. Add a provider

   Pick a service such as GitHub or Linear from the catalog, or bring your own OpenAPI document or MCP server. By default, tools that read data run right away and everything else needs your approval.

3. Connect your agent

   Copy the workspace's MCP URL from the Coral UI and add it to your MCP client.

```bash
claude mcp add --scope user --transport http coral <your-mcp-url>   # Claude Code
codex mcp add coral --url <your-mcp-url>                            # Codex
```

4. Ask a question

   Ask something that uses the provider, such as "What are my open pull requests?". Behind the scenes the agent sends Coral a program like this one, which finds unreviewed pull requests and posts them to Slack (pausing for approval if posting requires it).

```ts
const { data: pulls } = await coral.providers.github.pulls.list({
    owner: "withcoral",
    repo: "coral",
    state: "open",
});

const unreviewed = pulls.filter((pull) => pull.requested_reviewers.length === 0);

await coral.providers.slack.chat.postMessage({
    channel: "#engineering",
    text: unreviewed.map((pull) => `#${pull.number} ${pull.title}`).join("\n"),
});

return unreviewed.map((pull) => pull.number);
```

## When to use it

- Giving an AI SRE agent access to telemetry and deploy tools while restricting rollbacks to the services you name
- Letting a support agent issue refunds through a custom tool that escalates to a person in the cases you define
- Sharing vetted, reusable tools across a team without handing out API tokens, since providers can act as each caller
- Cutting tokens and cost on repeated agent tasks by reusing saved custom tools instead of re-deriving the steps each run
