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

# MCP Integration

> Connect your AI assistant to query your data layers directly

With MCP (Model Context Protocol), your AI assistant connects directly to your AstroBee data layers. Explore schemas, run SQL, and get insights without leaving Claude Code, Claude Desktop, or VS Code.

[MCP](https://modelcontextprotocol.io/) is an open standard that lets AI assistants securely connect to external tools and data sources. AstroBee's MCP server gives your assistant read access to your data layers and the ability to execute queries on your behalf.

## Managing Connections

Access MCP settings via **Settings** → **MCP** tab:

<Frame caption="MCP settings page">
  <img src="https://mintcdn.com/astrobee-f4b330e6/ppM7q3dJGmeBWRIe/screenshots/12-settings-mcp.png?fit=max&auto=format&n=ppM7q3dJGmeBWRIe&q=85&s=4faad941e40cb916eed3a941dc2252cf" alt="MCP settings" width="2850" height="1608" data-path="screenshots/12-settings-mcp.png" />
</Frame>

The MCP page shows:

* **Authorized Applications** — Apps currently connected to your account
* **Setup Instructions** — Configuration for different AI clients
* **Security Information** — How your data is protected

## Quick Setup

<Tabs>
  <Tab title="Claude Code">
    1. Run this command in your terminal:

    ```bash theme={null}
    claude mcp add astrobee --transport http https://app.astrobee.ai/api/mcp
    ```

    2. In Claude Code, type `/mcp` and select "Authenticate"
    3. Sign in with your AstroBee account in the browser

    Learn more about [MCP in Claude Code](https://docs.anthropic.com/en/docs/claude-code/mcp).
  </Tab>

  <Tab title="Claude Desktop">
    1. Open **Settings** → **Connectors** → **Add custom connector**
    2. Enter this URL:

    ```
    https://app.astrobee.ai/api/mcp
    ```

    3. Click **Connect** and sign in with your AstroBee account
  </Tab>

  <Tab title="Other MCP Clients">
    Use this JSON configuration for any MCP-compatible client:

    ```json theme={null}
    {
        "astrobee": {
            "type": "http",
            "url": "https://app.astrobee.ai/api/mcp"
        }
    }
    ```
  </Tab>
</Tabs>

## Available Tools

Once connected, your AI assistant has access to 12 tools:

### Server & Model Discovery

| Tool                 | Description                                   |
| -------------------- | --------------------------------------------- |
| `server-status`      | Check server health and connection statistics |
| `list-ontologies`    | List all data layers you have access to       |
| `list-source-models` | Get raw data schemas linked to a data layer   |

### Entity & Property Exploration

| Tool                 | Description                                                  |
| -------------------- | ------------------------------------------------------------ |
| `list-entities`      | List all entities with metadata (optionally with row counts) |
| `list-properties`    | Get all properties for a specific entity                     |
| `describe-property`  | Get detailed info about a property (type, dimension/measure) |
| `list-relationships` | View how entities are connected                              |

### Statistics & Data Quality

| Tool                  | Description                                                     |
| --------------------- | --------------------------------------------------------------- |
| `list-entity-stats`   | Get entity metrics (row count, property counts, quality scores) |
| `list-property-stats` | Get property statistics (uniqueness, null %, distinct counts)   |

### SQL Execution

| Tool                  | Description                                       |
| --------------------- | ------------------------------------------------- |
| `get-datasource-type` | Get the database engine for correct SQL syntax    |
| `validate-sql`        | Check if a SQL query is valid without executing   |
| `execute-sql`         | Run a SQL query and get results (up to 1000 rows) |

<Tip>
  For editing data layers, use the AstroBee web interface. MCP tools are read-only to maintain data layer consistency.
</Tip>

## Security

* **OAuth 2.0** — Secure authorization flow
* **Scoped Access** — Tools only access data you've authorized
* **Revocable** — Remove access anytime from Settings → MCP
* **Audit Logged** — All queries are logged for security

## Revoking Access

To disconnect an authorized application:

1. Go to **Settings** → **MCP**
2. Find the application in the Authorized Applications list
3. Click **Revoke**

The application immediately loses access to your data.

## Next Steps

<CardGroup cols={2}>
  <Card title="Claude Desktop Tutorial" href="/tutorials/connect-claude-desktop" icon="message-circle">
    Detailed setup guide for Claude Desktop
  </Card>

  <Card title="VS Code Tutorial" href="/tutorials/connect-vscode" icon="code">
    Query data layers from VS Code
  </Card>
</CardGroup>
