Skip to main content
Glama
README.md
<p align="center">
  <img src="docs/assets/mcp-title.jpg" alt="KAI MCP — your agent can build here now" width="100%" />
</p>

# KAI MCP

### Your AI writes it. KAI builds it.

Connect Claude, Cursor, ChatGPT, or any MCP-compatible agent to KAI. Your agent chooses a design architecture, writes the content, and calls KAI to produce a real, hosted website — without KAI running another AI model behind the scenes.

<p align="center">
  <a href="https://gofile.io/d/8XlnT0tW">
    <img src="docs/assets/kai-mcp-trailer.gif" alt="Watch the KAI MCP trailer" width="100%" />
  </a>
</p>

<p align="center">
  <strong><a href="https://gofile.io/d/8XlnT0tW">▶ Watch the full 53.7-second trailer</a></strong><br />
  <sub>Real KAI interface. Real external-agent tool calls. A real website built through MCP.</sub>
</p>

## What is open source here?

This repository contains the **MCP connector, protocol examples, and documentation**. It does not contain KAI's website templates, compiler, private blueprint catalog, or application source code.

The connector is a small local bridge for MCP clients that need a stdio server:

```text
Your AI / MCP client
        │ stdio
        ▼
  kai-mcp (this repo)
        │ HTTPS + your KAI bearer token
        ▼
KAI hosted MCP → private build engine → your hosted website
```

Clients with native Streamable HTTP support can connect directly to KAI and skip the local bridge entirely.

## Quick start

### 1. Create a KAI agent token

Open [KAI](https://kai-website-builder.pages.dev/), go to **Connect agent**, and create a scoped token. Copy it once and store it like a password.

### 2A. Connect directly with Streamable HTTP

Use this configuration in clients that support remote MCP servers:

```json
{
  "mcpServers": {
    "kai": {
      "type": "http",
      "url": "https://kai-website-builder.pages.dev/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_KAI_AGENT_TOKEN"
      }
    }
  }
}
```

For Claude Code:

```bash
claude mcp add --transport http kai \
  https://kai-website-builder.pages.dev/mcp \
  --header "Authorization: Bearer YOUR_KAI_AGENT_TOKEN"
```

Do not commit a real token to a shared configuration file.

### 2B. Or use the local stdio bridge

From this repository:

```bash
npm install
export KAI_AGENT_TOKEN="your-token-from-kai"
npm run check
```

`npm run check` connects to KAI and prints the available tools. It never prints your token.

Then point your MCP client at the local connector:

```json
{
  "mcpServers": {
    "kai": {
      "command": "node",
      "args": ["/absolute/path/to/kai-mcp/src/index.js"],
      "env": {
        "KAI_AGENT_TOKEN": "your-token-from-kai",
        "KAI_MCP_CLIENT_NAME": "claude-desktop"
      }
    }
  }
}
```

See [`examples/`](examples/) for more configurations.

## Try this prompt

> Build a website for my independent architecture studio. Use KAI: search the available design architectures, read the template contract, write all of the website copy yourself, create the project, and give me the preview link.

Your agent should call KAI's tools in this order:

1. `kai_search_templates`
2. `kai_get_template_contract`
3. `kai_create_project`
4. Optionally `kai_update_project` and `kai_export_project`

## Tools

| Tool | What it does |
|---|---|
| `kai_search_templates` | Searches the live design catalog using deterministic matching. |
| `kai_get_template_contract` | Returns editable slots, character budgets, pages, and media guidance. |
| `kai_create_project` | Creates a site from an explicit architecture and caller-authored copy. |
| `kai_get_project` | Reads an owned project and its current version. |
| `kai_list_projects` | Lists only the authenticated user's projects. |
| `kai_update_project` | Applies caller-authored patches with optimistic version checks. |
| `kai_export_project` | Creates short-lived, owner-bound HTML or ZIP export links. |

All agent tools run in **external-agent mode** with `inference: "none"`. Your AI does the reasoning. KAI validates, compiles, hosts, and exports the result.

## Does this expose KAI's template source?

**No.** This repository contains no template HTML, CSS, JavaScript, blueprint files, compiler code, or private catalog data.

At runtime, an authenticated agent receives public catalog metadata, preview URLs, and editable slot contracts so it can author content. KAI's private backend performs the build. Your agent does not need — and does not receive — the underlying template source.

## Security model

- The local connector reads `KAI_AGENT_TOKEN` from its environment.
- The token is sent only in the `Authorization` header to the configured KAI MCP endpoint.
- HTTPS is required, except for localhost development.
- Credentials embedded in URLs are rejected.
- The connector does not cache projects, template data, or tokens.
- Projects and exports are owner-scoped by KAI.
- Export links are signed and expire after 15 minutes.

Read [SECURITY.md](SECURITY.md) before reporting a vulnerability or deploying a modified connector. See [the protocol reference](docs/PROTOCOL.md) for tool arguments, scopes, and retry behavior.

## Development

Requirements: Node.js 18.17 or newer.

```bash
npm install
npm test
npm pack --dry-run
```

The integration tests start a local mock KAI MCP server, launch the stdio bridge, verify tool discovery and tool calls, and confirm that bearer authentication is forwarded without being logged.

## License

Connector source code is available under the [MIT License](LICENSE).

KAI's name, logos, product captures, and trailer media are brand assets, not MIT-licensed code. The trailer uses **“Odd Beats 01” by Lily J** under the [Mixkit Stock Music Free License](https://mixkit.co/license/#musicFree).

---

<p align="center">
  <strong>Ideas in. Websites out.</strong><br />
  <a href="https://kai-website-builder.pages.dev/">Open KAI</a> ·
  <a href="https://gofile.io/d/8XlnT0tW">Watch the trailer</a>
</p>