coral README

项目的 README,来自 github.com/withcoral/coral。合并为一个 markdown 文件:README.md。

Coral, with engraved orange corals

Coral

Execution rails for agents.

Coral is an open-source, self-hosted gateway that sits between your agents and the systems they work on. Agents call tools by writing short TypeScript programs, and save the ones that work as custom tools to reuse. Coral checks every call against your policy before it adds credentials and forwards the call.

CI License Docs Slack

Quickstart · Download · Demo video

In this example, an agent posts unreviewed pull requests to Slack for the first time. The agent searches for the GitHub and Slack tools and writes code that calls them. It cannot post to Slack without approval, so the user approves the post. The agent then saves its code as a custom tool. The next day, the agent runs the same task by calling that custom tool.

In Claude Code, an agent posts unreviewed pull requests to Slack. It searches Coral for the GitHub and Slack tools, writes code that calls them, and waits for approval before posting. The Coral UI then shows the run, who approved it, and the custom tool the agent saved. The next day, the same request runs by calling that custom tool. A final card compares the two days: 35% fewer tokens and 31% faster, in line with our benchmarks.

Control what agents can do. Most MCP gateways decide only which tools an agent can see. That is all or nothing: if an agent can call update_record, it can update any record in any way the tool allows. A custom tool is code, so it can hold a rule that Allow and Block cannot. For example, closeStaleTicket changes one field, and only on tickets with no activity for 30 days. You set Allow, Ask, or Block on the custom tool like any other tool. Coral still checks every provider call inside it against your policy.

Less duplicated agent work. Agents start every task from scratch. They re-read tool schemas, retry failed calls, and spend tokens rewriting code for steps they got right yesterday. With Coral, agents save the code that worked as custom tools, and call them again in one step. Workspace owners can share those tools with the whole team.

Thousands of developers at more than 450 companies use Coral for safer, more efficient agent work. They use it in customer support, SecOps, business intelligence, SRE, and more.

Get started

  1. Install Coral.

    • To use Coral yourself, download the desktop app from the download page. It runs on macOS (Apple silicon), Windows (x64), and Linux (x86_64).
    • To use Coral with your team, run a shared server with Docker Compose or Kubernetes. You need an OIDC identity provider, a reverse proxy for TLS, and SQLite or Postgres.
  2. Add a provider. A provider is one service your agents can use, such as GitHub or Linear. Pick one 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. See Add a provider.

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

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

    For Cursor, VS Code, OpenCode, and other clients, see Connect an MCP client.

  4. Ask a question. Ask your agent something that uses that provider, such as "What are my open pull requests?"

Why Coral

We started Coral while building an AI SRE. To investigate an incident, the agent had to connect the dots across an ocean of telemetry and undocumented relationships between internal and external systems. It needed broad permissions and a lot of tokens, and it started from scratch the next time.

We built Coral so that the agent remembers the route. Once a task succeeds, the agent saves the steps that worked as a custom tool. Next time, it finds that tool in the same search as provider tools such as Datadog and Slack. Coral started with SRE. Teams now use it for agent work across the organization:

What you get:

How Coral fits your stack:

How Coral works

Agents write programs. Coral builds on code mode, and adds custom tools, policy controls, and managed identities. To use tools, an agent writes a short TypeScript program. One program can call several tools, filter the results, and return only what the task needs. Less raw data passes through the model's context.

Coral runs them on rails. Each program runs in a fresh V8 isolate with no network access, no credentials, and no imports. Coral checks every tool call against your workspace policy, then adds the credentials and forwards the call to the provider. A policy can also require a person to approve the call. Coral attributes every run to the person or agent that started it.

graph LR
    Agent["Your agent"] -->|"exec: run a program"| MCP["Coral MCP server"]
    You["You"] -->|"providers, policy, approvals"| UI["Coral UI"]

    subgraph Coral["Coral (your laptop or server)"]
        MCP --> Run["Program runs in a V8 isolate"]
        Run <--> FN["Custom tools (private and shared)"]
        UI --> Gate["Policy check and credentials"]
        Run --> Gate
        Gate -.->|"approval request"| UI
    end

    Gate --> GH["GitHub"]
    Gate --> SL["Slack"]
    Gate --> Own["Your OpenAPI or MCP service"]

The agent sends Coral programs through the exec tool. A program calls coral.search to find the tools the agent can use and read their TypeScript signatures. Then the agent sends a program that does the work. This one finds open pull requests that have no reviewer and posts them to Slack:

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);

If posting to Slack needs approval, the run pauses there until you approve it. Only the pull request numbers go back to the agent, not the full GitHub response. The run happens on the Coral server, so it continues even if the agent disconnects.

What works becomes a custom tool. When a program succeeds, the agent saves it as a private tool. Next time, the agent calls it in one step as coral.private.<name>({ ... }). Agents find custom tools in the same search as provider tools, and reuse or edit them instead of starting over. A workspace owner can publish a private tool as a shared tool under coral.shared, so everyone in the workspace can call it.

To learn about providers, accounts, policy, and workspaces, read Concepts.

For teams and enterprise

To run Coral for a team, see Run a shared server.

Coral Enterprise is coming soon under its own license. It adds organization-wide governance and support: SSO with SAML, SCIM provisioning, advanced RBAC, an immutable audit log, and support SLAs. See Coral Enterprise or book a demo.

Development

To run Coral from a checkout, follow the development guide. To contribute, read CONTRIBUTING.md. The release notes list what changed in each version.

Community

Ask questions, share ideas, and show what you built in our Slack community or on GitHub issues.

Security

Do not report security issues in public issues or pull requests. See SECURITY.md.

Coral is ISO/IEC 27001:2022 certified. Each program runs in its own V8 isolate, and Coral logs every approval.

License

Coral is licensed under the Apache License 2.0. See LICENSE.

The ee/ directory holds Enterprise Edition code under its own license, ee/LICENSE. A plain cargo build at the repository root builds only code under the Apache License 2.0. NOTICE states which license covers which files.

Upgrade from Coral 0.x

Coral v1 replaces the SQL interface with TypeScript programs. It starts from fresh state and does not convert what 0.x stored. If Coral finds 0.x state, it tells you at startup. See Upgrade from Coral 0.x.

coral (withcoral/coral)

正在搜索数据库…

Coral 是什么?Coral 是一个统一的 SQL 查询接口,让 AI 智能体和开发者能够通过同一个 SQL 层查询多个实时数据源,包括 GitHub、Slack、Datadog、Stripe 和 Sentry 等 API,以及本地的 JSONL/Parquet 文件。你无需分别调用每个数据源自己的 MCP 服务器或 API 封装。
这是我需要另外搭建的数据库,还是对我现有数据源的一层封装?它不是一个带有自身存储的数据库。Coral 是一个只读层,它把 SQL 转换为对你所连接数据源的实时 API 调用或文件读取,然后以普通的表格行形式返回结果。
我该如何让 Coral 运行起来并连接我的数据?将 Coral 安装为桌面应用(支持 macOS、Linux、Windows)或命令行版,然后运行 'coral source add github'(或其他内置数据源)进行连接。Coral 会交互式地提示你输入所需凭据,也可以从对应的环境变量中读取。
哪些编程智能体可以连接 Coral?每个数据源都需要单独的凭据吗?Coral 提供一个基于 stdio 的 MCP 服务器,Claude Code、Codex、Cursor 和 VS Code 都可以连接它。是的,每个数据源(如 GitHub、Slack 或 Datadog)在添加时都需要单独配置自己的凭据。
我能通过 Coral 写回数据吗?它是只读的吗?Coral 在设计上就是只读层,用于查询和关联各数据源中的现有数据,不用于写入或修改数据。
我的数据和凭据会离开我的电脑吗?不会。一切都在本地运行:你的数据、凭据和使用记录都保存在你的电脑上,绝不会被发送到其他地方。
为什么要用 Coral,而不是让智能体直接连接各数据源的 MCP 服务器?直接连接各数据源的 MCP 会产生过多的工具调用,重复的认证和分页逻辑,跨数据源的推理能力也较差。使用 Coral 时,智能体只需编写一条 SQL 查询,就能跨数据源进行关联。
Coral 在基准测试中表现好了多少?在 82 个真实任务上,使用 Claude Opus 4.6,Coral 与直接调用各服务商 MCP(Datadog、Sentry、Linear、Slack、GitHub)相比,整体准确率高 20%,成本效率高 2 倍,延迟低 42%。在复杂的编程智能体类任务上,准确率提升至高 31%,成本则便宜 3.4 倍。
我能连接未内置的数据源吗?可以。你可以编写自定义数据源规范(一个 YAML 文件,声明 API 或数据集及其表和列),也可以从代码仓库的 'sources/community' 文件夹中获取社区提供的数据源规范。
'coral search' 是做什么的?'coral search' 会在你编写 SQL 之前,在目录元数据中查找合适的模式(schema)和表。它能帮助智能体弄清该查询什么,而无需猜测表名。
作者
withcoral
大小
54.3 MB
星标
5K
时长
8个月
提交 · 90 天