> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/developer-guide/platform-api/data-world-model/data-mcp.md).

# Data Access (MCP)

{% hint style="info" %}
**Two other surfaces cover most use cases.** For agent data access inside conversations, use [platform functions](/developer-guide/platform-api/functions.md), which provide the same query capabilities plus Python UDFs and AI operations. For an MCP endpoint built into the Platform API itself (world-model tools, Platform API credentials), use the [MCP Server](/developer-guide/platform-api/functions/mcp-server.md) at `/v1/mcp`. This page documents Data-MCP, a separate standalone service that authenticates with Classic API credentials.
{% endhint %}

Data-MCP is an MCP (Model Context Protocol) server that provides SQL query access to data tables for a Classic API organization. It works with MCP-compatible clients and is separate from the Platform API's workspace-scoped world model.

## Authentication

Data-MCP authenticates with Classic API credentials. Every request requires the `X-Org-Id` header identifying your organization, plus one of two credential modes.

**Pre-exchanged token** - you have already exchanged your API key for a token:

| Header          | Value                |
| --------------- | -------------------- |
| `Authorization` | `Bearer <token>`     |
| `X-Org-Id`      | Your organization ID |

**Credential pass-through** - Data-MCP performs the token exchange on your behalf:

| Header         | Value                       |
| -------------- | --------------------------- |
| `X-Api-Key`    | Your Classic API key        |
| `X-Api-Key-Id` | The API key ID              |
| `X-User-Id`    | The user the key belongs to |
| `X-Org-Id`     | Your organization ID        |

Requests without `X-Org-Id` return `400`. Requests that provide neither a bearer token nor the full credential header set return `401`. See [Authentication](/developer-guide/getting-started/authentication.md) for the Classic API credential flow.

### Backend URL Override (optional)

For multi-region deployments, the MCP server accepts an optional `X-Amigo-Api-Url` header that selects which Classic API deployment serves the query. The value must match a host on the server's allowlist, which always includes the deployment's configured default. Unknown hosts return `400`. Requests without the header use the default backend.

| Header            | Value                                                 |
| ----------------- | ----------------------------------------------------- |
| `X-Amigo-Api-Url` | Target Classic API host (e.g. `https://api.amigo.ai`) |

## Available Tools

The MCP server exposes seven tools for exploring and querying organization data.

### `sql_query`

Execute read-only `SELECT` queries against organization tables. Results are limited to 1,000 rows with a 30-second timeout.

### `describe_query`

Returns the schema of a query result without executing it. Useful for understanding what columns a query will return before running it.

### `tables`

List available tables for the organization. Supports an optional name filter to narrow results.

### `table_schema`

Returns column names and data types for a specific table.

### `sample_data`

Preview the first N rows of a table. Helpful for understanding data shape before writing queries.

### `table_detail`

Extended table metadata including properties, statistics, and partitioning information.

### `profile_column`

Statistical profile of a specific column. Returns min, max, null count, distinct count, and value distribution.

## Connection

Data-MCP uses the **MCP Streamable HTTP** transport.

| Property      | Value                                        |
| ------------- | -------------------------------------------- |
| **Endpoint**  | `https://api.platform.amigo.ai/data-mcp/mcp` |
| **Transport** | Streamable HTTP                              |
| **Protocol**  | JSON-RPC 2.0                                 |

Use the complete `/data-mcp/mcp` path shown above; the repeated segment is intentional.

Regional endpoints are also available, so queries can use the region that holds the organization's data. See [Regions & Endpoints](/developer-guide/getting-started/regions-and-endpoints.md#platform-api) for the full list of regional base URLs.

## Example

List available tables using a JSON-RPC request:

```bash
curl -X POST https://api.platform.amigo.ai/data-mcp/mcp \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Org-Id: YOUR_ORG_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "tables",
      "arguments": {}
    },
    "id": 1
  }'
```

## Data Isolation

Queries are scoped to the authenticated organization. There is no way to query another organization's data, even with valid credentials for a different organization. The `X-Org-Id` header and the presented credentials must belong to the same organization.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/developer-guide/platform-api/data-world-model/data-mcp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
