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

# Data Collaboration MCP Server

> How the Narrative MCP server lets AI agents interact with your data

The Narrative MCP Server for Agents is a remote [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that lets AI agents like Claude explore datasets, kick off queries, refresh materialized views, and manage your Narrative account — all from a single conversation. Instead of switching between a chat window and the Narrative UI, you tell the agent what you need and it operates the platform on your behalf.

## What is MCP?

MCP is an open protocol that standardizes how AI applications connect to external tools and data sources. It defines a universal interface so that any MCP-compatible AI client — Claude Code, Claude Desktop, Cursor, Windsurf, and others — can discover and call tools exposed by an MCP server.

The protocol handles:

* **Tool discovery.** The client asks the server what tools are available and receives their names, descriptions, and parameter schemas.
* **Authentication.** OAuth-based flows let the server verify your identity without you sharing API keys with the AI client.
* **Tool execution.** The client calls a tool on your behalf, and the server returns structured results that the AI can reason about.

## Why use an AI assistant with Narrative?

Working with data collaboration platforms often involves switching between multiple screens — searching for datasets, inspecting schemas, writing queries, monitoring jobs. An AI assistant connected via MCP can compress these multi-step workflows into a conversational loop:

* **Explore datasets naturally.** Ask "what datasets do I have about mobile identifiers?" instead of navigating through the UI. The assistant searches, describes schemas, and summarizes what it finds.
* **Write and validate NQL iteratively.** Describe what you want in plain language, and the assistant drafts NQL, validates it against your schema, and fixes errors before submitting — all without you writing a query from scratch.
* **Operate on datasets without context-switching.** Trigger samples, refresh materialized views, and recalculate statistics through conversation. The assistant polls job status and reports when operations complete.
* **Work across companies.** If you belong to multiple companies, the assistant can switch context on your behalf, making cross-tenant operations seamless.

## How it works

The Narrative MCP server sits between your AI client and the Narrative API:

1. **You connect once.** Add the server URL to your AI client's MCP configuration. The first time the assistant calls a tool, a browser window opens for you to log in with your Narrative credentials.
2. **The assistant discovers tools.** On connection, the client fetches the list of available tools — dataset operations, NQL execution, attribute search, and more.
3. **Tools call the Narrative API.** When the assistant uses a tool, the MCP server translates the request into the appropriate Narrative API calls, using your authenticated session.
4. **Results flow back as context.** The server returns structured responses that the assistant incorporates into the conversation, so it can chain operations (e.g., describe a dataset, then write a query against it).

The server accepts two kinds of bearer credential, so the same endpoint works for interactive and programmatic clients:

* **OAuth login** — Interactive MCP clients (Claude Code, Claude Desktop, Cursor, Windsurf) open a browser-based login, and the server exchanges the resulting credential for a scoped Narrative access token. Your session persists across tool calls, so you only log in once per session.
* **Narrative API token** — Server-to-server callers and scripted clients can send a long-lived Narrative API token directly in the `Authorization: Bearer` header, skipping the browser flow. The token's existing user, company, and permission scope apply. See [Connecting to the Narrative MCP Server](/guides/mcp/connecting-an-ai-assistant#narrative-api-token-for-programmatic-clients) for setup details.

## Available tools

The server organizes its tools into these categories:

| Category               | What you can do                                                                                       |
| ---------------------- | ----------------------------------------------------------------------------------------------------- |
| **Context**            | Inspect the current session, list your companies, switch the active company, search companies by name |
| **Datasets**           | Search and describe datasets, inspect column statistics, configure stats collection                   |
| **Dataset operations** | Request samples, refresh materialized views, recalculate statistics                                   |
| **Attributes**         | Search and describe Rosetta Stone attributes                                                          |
| **Access rules**       | Discover and inspect the access rules your company owns or has been granted                           |
| **NQL**                | Validate queries and submit them for execution                                                        |
| **Jobs**               | Search and describe jobs to track asynchronous work — NQL runs, samples, materialized-view refreshes  |
| **Data planes**        | Discover available data planes and their compute pools                                                |
| **Workflows**          | Create, trigger, describe, and follow runs of multi-step workflows                                    |

See the [MCP server reference](/reference/integrations/mcp-server) for the complete tool catalog with parameters and examples.

## Other Narrative MCP servers

Narrative publishes a small suite of MCP servers alongside the Data Collaboration server. You can add any of them to your client independently:

| Server                                                       | URL                             | Auth  | What it does                                                      |
| ------------------------------------------------------------ | ------------------------------- | ----- | ----------------------------------------------------------------- |
| [Data Collaboration](/reference/integrations/mcp-server)     | `https://mcp.narrative.io/mcp`  | OAuth | Query datasets, run NQL, manage workflows                         |
| [Knowledge Base](/reference/integrations/mcp-knowledge-base) | `https://docs.narrative.io/mcp` | None  | Search the Narrative docs and answer questions with citations     |
| [Agent Feedback](/reference/integrations/mcp-agent-feedback) | `https://narrative.support/mcp` | None  | Submit structured product feedback and bug reports from a session |

All three are discoverable in the Narrative product under **Marketplace > MCP Servers**.

## Getting started

To connect your AI assistant to Narrative, follow the setup guide for your client:

<CardGroup cols={2}>
  <Card title="Connecting to the Narrative MCP Server" icon="plug" href="/guides/mcp/connecting-an-ai-assistant">
    Step-by-step setup for Claude Code, Claude Desktop, Cursor, and other MCP clients
  </Card>

  <Card title="Tool Reference" icon="book" href="/reference/integrations/mcp-server">
    Complete catalog of available tools with parameters and usage patterns
  </Card>
</CardGroup>
