Skip to main content
Coral ships with a built-in MCP server that presents Coral to agents as a read-only SQL database with catalog discovery.
Before setting up a client, make sure you have connected at least one source.

What MCP clients get

TypeNameDescription
ToolsqlExecute read-only SQL against the Coral database
Toollist_catalogList database tables and table functions with pagination
Toolsearch_catalogSearch database catalog metadata with a Rust regex
Tooldescribe_tableShow compact metadata for one database table
Toollist_columnsList columns for one database table with pagination
Resourcecoral://guideDatabase workflow guide for agents
Resourcecoral://tablesJSON summaries of database tables and required filters
Clients see the same database catalog and query results as coral sql. You set up sources with the CLI, then agents query Coral over MCP as SQL schemas and tables. Agents should treat the discovery tools as catalog helpers, not as replacement provider APIs. For data questions, prefer a single sql call using JOIN, CROSS JOIN, CTEs, subqueries, aggregates, or window functions over multiple tool calls that fetch rows and combine them in the agent.

Discovery tools

list_catalog: paginated list of database tables and parameterized table functions.
  • Arguments: optional schema, kind, limit, offset. Omit kind (or pass null) to include both "table" and "table_function" items.
  • For tables, use sql_reference in FROM and JOIN clauses.
  • For table functions, use sql_call_example and fill in the required arguments.
  • Do not quote the whole schema.item string: write github.pulls or "github"."pulls", not "github.pulls".
search_catalog: deterministic regex matching over database catalog metadata.
  • Arguments: required pattern plus optional schema, kind, ignore_case, limit, offset.
describe_table: compact metadata for one table.
  • Arguments: exact schema and table.
  • Returns guide text, required filters, and a column count without dumping full columns.
list_columns: paginated columns for one table.
  • Arguments: exact schema and table, plus optional pattern, ignore_case, required_only, limit, offset.
  • For existing tables, returns a columns page with total, has_more, and optional next_offset. When pattern is set, matching rows include matched_fields so clients can explain why a column matched.
  • When the requested table does not exist, returns found: false with recovery hints instead of an empty page. Clients should branch to search_catalog or list_catalog rather than pretending the table has zero columns.

Richer metadata via SQL

For deeper introspection, query coral.tables, coral.columns, coral.filters, coral.table_functions, and coral.inputs through the sql tool instead of relying only on list_catalog or coral://tables. Use coral.filters as the normalized filter surface, with coral.columns.filter_mode available when inspecting filter-only virtual columns.

Searching a provider’s data

Some sources expose native search endpoints (for example, GitHub issue search) as table functions with kind = 'search'. Prefer these over scanning a regular table when the agent needs ranked, query-driven results. They return provider-ranked candidates, so agents should preserve any returned rank columns and use the returned ids plus catalog-described tables to fetch full detail rows when the search result itself is incomplete.

Query result format

The sql tool returns rows as a JSON array of objects. To preserve exact values across JSON parsers, Coral encodes precision-sensitive numeric types as JSON strings rather than JSON numbers:
  • Int64 (BIGINT) and UInt64
  • Decimal32, Decimal64, Decimal128, and Decimal256
This applies wherever these types appear, including nested inside Struct, List, and Map columns. The column’s declared SQL type does not change — describe_table, list_columns, and coral.columns still report Int64 or Decimal(p, s); only the JSON encoding of the value is a string. A BIGINT user_id, for example, comes back as { "user_id": "-8504475857937456387" }. Coral does this because MCP uses JSON-RPC, and many clients — JavaScript/TypeScript JSON.parse and most MCP hosts — decode JSON numbers as IEEE-754 doubles. Values beyond 2^53 silently lose precision when read as a number. The CLI is unaffected: coral sql --format json keeps emitting these types as JSON numbers.

Client setup

Coral uses stdio transport. If a client supports a command-based install flow, point it at coral mcp-stdio.
Use add-mcp to add the Coral MCP server to all your favorite coding agents with a single command.
npx add-mcp -n coral -g "$(which coral) mcp-stdio"
(To install only in the current project, omit the -g flag.)

Verify the connection

Once your client is connected, ask the agent to list available tables or run a simple database query. Examples:
“List the tables available in Coral.”
“Run a small Coral query against coral.tables.”
The agent should call list_catalog, search_catalog, or query coral.tables and coral.table_functions to return SQL schemas and catalog items, and use describe_table or list_columns for table-specific metadata. Large catalogs should be paged with limit and offset.

Troubleshooting

  • coral not found: Make sure coral is on your PATH, or use the full path from which coral on macOS or Linux or (Get-Command coral).Source in PowerShell.
  • No tables visible: Run coral source list in your terminal to confirm you have sources installed. If empty, add one with coral source add.