> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/app/api/structural-mcp-server.md).

# Using the Structural MCP server

The Structural MCP server allows you to use AI clients such as Claude Code to interact with Structural.

You can use the same natural language prompts that you provide in the Structural Agent and perform the same actions that the Structural Agent supports.

## Configuring the MCP server on self-hosted instances

### Enabling connections to the MCP server

The MCP server is enabled automatically on Structural Cloud.

On a self-hosted instance, in the **MCP** section of the **AI Settings** page, to allow calls to the MCP server, toggle **Enable the MCP server** to the on position.

<figure><img src="/files/SSMIfXaPHLKBp0OtxLX8" alt=""><figcaption></figcaption></figure>

### Enabling dynamic client registration

By default, for MCP connections, Structural uses CIMD (Client ID Metadata Documents).

If your AI client does not support CIMD, then you can enable dynamic client registration, which allows AI clients to automatically detect and register for the MCP server.

To enable dynamic client registration, toggle **Allow dynamic client registration (RFC 7591)** to the on position.

### Enabling connections from specific AI clients

For CIMD, Structural automatically supports connections from most well-known AI clients that support it.

For other less well-known AI clients, you can configure the allowed domains.

To provide a list of allowed AI client domains that can connect to the MCP server, set the [environment setting](/app/admin/environment-variables-setting.md) `TONIC_MCP_CLIENT_ALLOWLIST` to a comma-separated list of domain names. You can set this setting from the **Environment Settings** list on **Structural Settings**.

## Setting up the connection from your AI client

To authenticate from your AI client to the MCP server, you can use either:

* OAuth authentication
* A Structural API token. For information on how to generate a Structural API token, go to [Getting an API token](/app/api/tonic-api-get-token.md).

### Using OAuth to connect to the MCP server <a href="#mcp-connection-oauth" id="mcp-connection-oauth"></a>

To use OAuth to connect to the Structural MCP server, run the command to add the MCP server to your AI client.

For example, to add the MCP server to Claude Code:

`claude mcp add --transport http structural https://<strutural-instance>/mcp`

You then authenticate to Structural.

### Using an API token to connect to the MCP server <a href="#mcp-connection-api-token" id="mcp-connection-api-token"></a>

To use an API token to connect to the Structural MCP server, run the command to add the MCP server to your AI client. Include the API token in the header.

For example, to add the MCP server to Claude Code and use an API token for authentication:

`claude mcp add --transport http structural https://<structural-instance>/mcp --header "Authorization: Apikey <user-api-token>"`

## Viewing and revoking connected applications <a href="#mcp-connection-oauth-view-revoke" id="mcp-connection-oauth-view-revoke"></a>

On the **User Settings** page, the **Connected Applications** list displays the applications that you connected to Structural through the MCP server using OAuth.

To revoke access:

1. Click the **Revoke** option for the application.
2. On the confirmation panel, click **Revoke**.


---

# 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.tonic.ai/app/api/structural-mcp-server.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.
