# Connect an AI to your project

Configure MCP and an API key so an agent can read or edit project templates.

You can let AI inspect template structure, explain inputs, or edit a design in your project through **MCP (Beta)**. The connection exposes Tembuilder tools to your AI application; a project API key determines which operations it can perform.

## 1. Choose the connection for your task

Tembuilder provides two MCP connections:

| Connection | Purpose | Key required |
| --- | --- | --- |
| Docs MCP · `/docs/mcp` | Search and read public documentation. | No. |
| Project MCP · `/mcp` | Read or edit project templates and Assets. | Yes. |

> [!NOTE] Information
>
> For documentation questions, add a server at `https://<api-host>/docs/mcp` to your AI application without an API key. Use the API host shown on your project’s **MCP (Beta)** page. The steps below configure Project MCP.

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="Docs MCP reads guidance · Project MCP works on templates">
<div class="sim-stage"><div class="ds-columns"><div class="sim-panel"><div class="ds-head"><strong>Docs MCP</strong><div class="wf-actions"></div></div><div class="wf-rows"><div class="sim-focus"><span>/docs/mcp</span><small>Public guides</small></div><div class=""><span>API key</span><small>Not required</small></div></div></div><div class="sim-panel"><div class="ds-head"><strong>Project MCP</strong><div class="wf-actions"></div></div><div class="wf-rows"><div class="sim-focus"><span>/mcp</span><small>Templates · Assets</small></div><div class=""><span>API key</span><small>Project-scoped</small></div></div></div></div></div>
<figcaption>Docs MCP reads guidance · Project MCP works on templates</figcaption>
</figure>

## 2. Create a project API key

If you already have an API key for this project with the required MCP scopes, skip this step.

In the intended project, open **API Keys** and create a key with the appropriate permissions:

- `mcp:read`: inspect templates, resources, and authoring context.
- Add `mcp:write`: allow creation, copying, and saving through writing tools.

The key determines which project AI can access. Put it in your AI application’s connection configuration; it does not need to appear in your editing prompt.

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="API Keys → mcp:read · add mcp:write for editing">
<div class="sim-stage"><div class="sim-panel"><div class="ds-head"><strong>API Keys · MCP</strong><div class="wf-actions"></div></div><div class="wf-rows"><div class=""><span>mcp:read</span><small>Read content</small></div><div class="sim-focus"><span>mcp:write</span><small>Create and save edits</small></div></div></div></div>
<figcaption>API Keys → mcp:read · add mcp:write for editing</figcaption>
</figure>

## 3. Choose your AI client

Open your project’s **MCP (Beta)** page, choose your client and copy its commands or configuration. Replace `YOUR_API_KEY` with the project key before running a command or saving a file. The examples below use `https://api.tembuilder.com/mcp`; use the endpoint shown in your app for your environment, rather than the dashboard URL.

### Claude Code

With Claude Code installed, run this command from the folder where you use the agent:

```sh
claude mcp add --transport http --scope local tembuilder-project https://api.tembuilder.com/mcp --header "ApiKey: YOUR_API_KEY"
```

The CLI saves the connection for this folder and your user (`--scope local`). Reopen Claude Code, run `claude mcp list`, then open `/mcp` to check the connection.

### Codex

Replace `YOUR_API_KEY` and add this configuration to `~/.codex/config.toml`. Codex connects directly over HTTP; no Node.js or extra packages are needed.

```toml
[mcp_servers.tembuilder-project]
url = "https://api.tembuilder.com/mcp"
http_headers = { "ApiKey" = "YOUR_API_KEY" }
```

If this server already exists, replace its entire block, including command, args, and any env subtable. Save the file and fully quit and reopen Codex.

### Other clients and authentication

Use a client that supports **Streamable HTTP** and custom authentication headers. Adapt the JSON below to your client’s format, or enter the endpoint and header in its connection settings.

```json
{
  "mcpServers": {
    "tembuilder-project": {
      "url": "https://api.tembuilder.com/mcp",
      "headers": {
        "ApiKey": "YOUR_API_KEY"
      }
    }
  }
}
```

Project MCP accepts the same API key as `ApiKey: YOUR_API_KEY`, `Authorization: ApiKey YOUR_API_KEY`, or `Authorization: Bearer YOUR_API_KEY`. All forms retain the same project and scope restrictions. Clients supporting OAuth sign-in only cannot use this API-key setup.

> [!WARNING] Warning
>
> Keep keys out of source control, chat prompts and shared terminal history. Revoke unused keys in **API Keys**. If authentication fails, check the endpoint, key and `mcp:read` scope; changes also require `mcp:write`.

## 4. Start by reading a template

After connecting, try this request:

> Read the capabilities and list templates in the project. For the template I select, explain its structure and Parameters without changing content.

Once AI has found the intended template, describe the change you want and ask it to inspect a preview before saving. Then open the template in the editor to review its content and data.

> [!WARNING] Warning
>
> Project MCP supports template creation, editing, and visual previews. To use the changes in a final PDF, [save and publish in the app](/docs/publishing/save-publish/), then [run a render](/docs/renders/preview-render/). MCP has no tool for publication or retained PDF jobs.

<figure class="doc-sim data-assets-illustration workflow-illustration" aria-label="workspace_capabilities → template_list → template_context">
<div class="sim-stage"><div class="sim-panel"><div class="ds-head"><strong>MCP · tools</strong><div class="wf-actions"></div></div><div class="wf-tools"><div class="wf-tool"><small>01</small><code>workspace_capabilities</code><span>Connection capabilities</span></div><div class="wf-tool"><small>02</small><code>template_list</code><span>Find project templates</span></div><div class="wf-tool"><small>03</small><code>template_context</code><span>Revision and template structure</span></div><div class="wf-tool sim-focus"><small>04</small><code>template_read</code><span>Relevant sources or schema</span></div></div></div></div>
<figcaption>workspace_capabilities → template_list → template_context</figcaption>
</figure>
