GaurGaur docs

MCP endpoint

Reference for the MCP server endpoint at /v1/api/{consumer_slug}/mcp.

Exposes a consumer's contracts as a Model Context Protocol server. AI agents and MCP-aware tools connect here to discover and call contracts as tools. For a guided walkthrough, see Using MCP.

Endpoint

POST /v1/api/{consumer_slug}/mcp
Authorization: Bearer <api_key>

Path parameters

ParameterTypeDescription
consumer_slugstringThe slug of the consumer. The API key must authorize this consumer, and the consumer must have the MCP server protocol enabled.

Transport

You don't call the endpoint directly; point an MCP client or agent framework at it and let the client handle the protocol handshake and message framing.

RequirementDetail
AuthenticationAuthorization: Bearer <api_key> on every request.
SessionTracked with the mcp-session-id header. Conformant MCP clients manage this automatically.
Protocol enabledThe consumer must have the MCP server protocol enabled, or the endpoint returns 403.

Client configuration

Most MCP clients take a server entry with a URL and headers:

{
  "mcpServers": {
    "gaur": {
      "url": "https://<base-url>/v1/api/<consumer_slug>/mcp",
      "headers": { "Authorization": "Bearer <api_key>" }
    }
  }
}

The exact format depends on the client. See Using MCP for snippets per client.

Tools

Which tools are registered depends on the consumer's query mode.

ToolContract-onlyContract-with-SQL-fallbackSQL-only
search_objects
describe_object
query_contract
execute_sql

search_objects

Finds data objects (contracts, tables, models, collections) relevant to a question, using hybrid semantic and keyword search.

ArgumentDescription
queryA rich natural-language phrase describing what to find.
keywordsTwo to four short keywords to focus the search.
object_typesOptional list of types to filter to. Types not allowed by the consumer's query mode are rejected with a Forbidden error.

describe_object

Fetches full context for one object by id and type: Object Info, Business Context, and (for a contract) the contract JSON, which includes its dimensions, measures, and the field rules needed to call query_contract. Returned object types are gated by query mode.

query_contract

Runs a structured query against a named contract. Registered in contract-only and contract-with-SQL-fallback modes.

ArgumentDescription
contract_nameName of the contract to query.
queryQuery specification conforming to the Query schema.
contextOptional object of values for the contract's row-level security.

Result:

FieldDescription
contract_nameThe contract that ran.
queryThe query that was executed (echoed back).
rowsThe result rows.
columnsThe result columns.
row_countNumber of rows returned.
execution_time_msExecution time in milliseconds.
has_next_pageWhether more rows are available.

execute_sql

Executes a read-only (SELECT or WITH) SQL query against the consumer's authorized tables and models. Every referenced object is checked against the consumer's scope and any configured RLS rules before execution. Registered in SQL-only and contract-with-SQL-fallback modes.

ArgumentDescription
sqlThe SQL statement. Must start with SELECT or WITH.
contextOptional object of values for RLS.

Result:

FieldDescription
sqlThe SQL that ran.
rowsThe result rows.
columnsThe result columns.
row_countNumber of rows returned.
execution_time_msExecution time in milliseconds.

Resources

The server publishes MCP resources under gaur://consumer/{slug}/.... Conformant clients list them in their resources panel and read them on demand:

URIReturns
gaur://consumer/{slug}/manifestConsumer manifest JSON: slug, name, enabled protocols, endpoint URLs, auth shape, query mode.
gaur://consumer/{slug}/docsAll-in-one markdown briefing: endpoints, auth, contracts in scope, OpenAPI and docs URLs.
gaur://consumer/{slug}/contractsList of contracts available to this consumer. Contract modes only.
gaur://consumer/{slug}/contracts/{contract_name}Full JSON for one contract in scope. Contract modes only.
gaur://consumer/{slug}/query-schemaJSON Schema for a query_contract request. Contract modes only.

The contract-related resources are present only when the consumer's query mode exposes contracts.

Governance

Every tool call is bound by the consumer's scope, query-mode gating, and the contracts' row-level security. Tools return governed contract data, never raw, unscoped database access. See Using MCP.

Status codes

StatusMeaning
200Success.
401Missing or invalid API key.
403The API key does not authorize this consumer, or MCP is not enabled for it, or a tool argument referenced an object type forbidden by the consumer's query mode.
500Internal server error.

On this page