> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Query your data and build dashboards from Claude, Codex or any MCP client.

Matys exposes a [Model Context Protocol](https://modelcontextprotocol.io) server. Your AI client signs in with OAuth, so there is no API key to copy or store.

> [!NOTE]
>
> The MCP server is not available to every workspace yet.

## Connect a client

Open **Settings → MCP**. The page shows your server URL and a setup guide for each supported client.

> [tab] Claude Code
>
> **1. Add the server**
>
> Copy the command from **Settings → MCP** and run it in your terminal. It has this shape:
>
> ```bash theme={null}
> claude mcp add --transport http matys <your server URL>
> ```
>
> **2. Sign in**
>
> Inside Claude Code, run `/mcp` and complete the browser sign-in when prompted.

> [tab] Claude Desktop
>
> **1. Add a custom connector**
>
> Open **Settings → Connectors → Add custom connector** in Claude Desktop.
>
> **2. Paste the server URL**
>
> Paste the server URL shown in **Settings → MCP** and save.
>
> **3. Approve access**
>
> Click **Connect** and approve access in the browser window that opens.

> [tab] Codex CLI
>
> **1. Add the server**
>
> Copy the command from **Settings → MCP** and run it in your terminal. It has this shape:
>
> ```bash theme={null}
> codex mcp add matys --url <your server URL>
> ```
>
> **2. Sign in**
>
> Restart Codex and authorize Matys in the browser when prompted.

Any other client that supports remote MCP servers with OAuth connects with the same server URL.

## Approve access

When a client connects, Matys opens an **Authorize access** screen. It shows:

* The client's name, and whether its identity is verified. An unverified app's name is self-declared and may not be who it claims to be.
* The site you are sent back to after you approve.
* What the client may do: use Matys tools on your behalf, and stay connected while you are away.

Click **Authorize** to connect, or **Deny** to refuse. Only authorize applications you trust.

The client works in the organization that is active when you sign in. It always acts with member permissions, even if you are an admin, and only reaches the data sources you can access.

## Tools

| Tool | What it does |
| - | - |
| `list_datasources` | Lists the data sources you can query. Clients call it first to get a data source ID. |
| `send_message` | Asks the Matys AI analyst a question. It can also list, create and edit dashboards when you ask for it. |
| `list_chats` | Lists your recent chats, 20 by default and up to 100. |
| `get_chat` | Reads a chat with its full message history, including the dashboards and CSV files each reply produced. |
| `get_context` | Returns your organization's context and your groups' contexts, to follow when writing SQL. |
| `execute_sql_query` | Runs one read-only `SELECT` and returns the rows as CSV. It returns 100 rows by default and up to 1,000. |
| `extract_data` | Saves the full result of a read-only query, up to 10,000 rows, as a CSV file and returns a download link. |

> [!NOTE]
>
> `get_context`, `execute_sql_query` and `extract_data` are not available to every workspace yet.

### Conversations

`send_message` starts a new chat unless the client passes the ID of an existing one to continue it.

When a reply creates or edits dashboards, it lists each one with a link that opens it in Matys. The dashboard keeps building after the reply, so changes appear within a few minutes.

### Long-running replies

A reply that takes longer than about 45 seconds returns `{ chatId, runId, status: "running" }`. The client then calls `get_chat` with that `chatId` until the reply appears.

### Download links

CSV download links from `send_message`, `get_chat` and `extract_data` stay valid for 15 minutes. Ask again for a fresh link once one expires.

## Manage connected clients

**Settings → MCP → Connected clients** lists every AI client you authorized, with the date you authorized it and the date its access expires.

**1. Find the client**

Open **Settings → MCP** and scroll to **Connected clients**.

**2. Revoke it**

Click **Revoke** next to the client, then confirm.

Revoking cuts off the client's access immediately. It must be authorized again before it can reconnect. A client also loses access if you leave the organization.

> [!TIP]
>
> If your workspace loses access to Matys, for example after a billing issue, MCP requests are
> refused until it is resolved. See [Billing](/docs/workspace/billing.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.