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

# MCP for agents

> Build with any agent through the Keystroke MCP server.

The **Keystroke MCP server** lets you build agents, workflows, triggers, and integrations from any [MCP](https://modelcontextprotocol.io)-capable agent — ChatGPT, Claude, Cursor, and more. Connect once, and your agent can create projects, edit code in a hosted workspace, run it, and deploy it, without leaving the chat.

It's a single hosted [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) endpoint:

```
https://api.keystroke.ai/v1/mcp
```

<Note>
  This page is about building Keystroke **with** an MCP client. It's the reverse of giving your *Keystroke agents* tools from an external MCP server — for that, see [MCP tools](/docs/learn/agents/build-agents#mcp-tools).
</Note>

## When to use MCP

Keystroke gives you three ways to build with AI: this MCP server, the [CLI with a local project](/docs/build-with-ai/cli-for-agents), and the in-app [platform agent](/docs/build-with-ai/platform-agent). **We recommend the CLI and a local project** whenever your agent can work in an editor on your machine — better tooling, git, tests, and the most mature build loop. When you don't want to involve your own agent at all, use the platform agent in the web app instead of MCP.

Use **this MCP server** when a chat-first agent (ChatGPT, Claude, or similar) should build without a local install, or when connecting Keystroke as an MCP tool is the only practical option. Code lives in a hosted workspace instead of your repo; deploys still land on the same platform.

<Note>
  The hosted-workspace MCP path is newer than the CLI. Prefer local development when you can; use MCP when the chat-only or zero-install workflow is worth the tradeoff.
</Note>

|                      | MCP server (this page)                       | [Local CLI](/docs/build-with-ai/cli-for-agents) (recommended) |
| -------------------- | -------------------------------------------- | -------------------------------------------------------- |
| **Where you work**   | A chat-first agent (ChatGPT, Claude, Cursor) | Your own editor (Cursor, Claude Code)                    |
| **Where code lives** | A hosted Keystroke workspace                 | Your machine                                             |
| **Setup**            | Connect a URL, sign in once                  | `npm i -g @keystrokehq/cli`, scaffold a project          |
| **Best for**         | No local setup; pure chat workflows          | Full control of files, git, tests, and editor tooling    |
| **Maturity**         | Newer hosted path                            | Primary, most stable agent experience                    |

Both build the same projects and deploy to the same platform. Many teams start on the CLI and only add MCP for teammates who build entirely from chat.

## Connect a client

Add the Keystroke MCP server to your client, then sign in. Authentication uses **OAuth** — there's no API key to paste. The first time your client calls the server, it registers itself and opens a Keystroke login in your browser.

<Tabs>
  <Tab title="Cursor">
    Add Keystroke to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (per project):

    ```json theme={null}
    {
      "mcpServers": {
        "keystroke": {
          "type": "http",
          "url": "https://api.keystroke.ai/v1/mcp"
        }
      }
    }
    ```

    Open **Cursor Settings → MCP**, then click **Login** next to the Keystroke server to complete the OAuth flow.
  </Tab>

  <Tab title="Claude">
    In **Settings → Connectors**, add a custom connector with the URL:

    ```
    https://api.keystroke.ai/v1/mcp
    ```

    Claude opens the Keystroke sign-in to authorize the connection.
  </Tab>

  <Tab title="ChatGPT">
    In a Developer mode / connector-capable workspace, add a connector pointing at:

    ```
    https://api.keystroke.ai/v1/mcp
    ```

    Authorize it when prompted to complete sign-in.
  </Tab>

  <Tab title="Other clients">
    Any MCP client that supports remote (Streamable HTTP) servers with OAuth can connect. Point it at:

    ```
    https://api.keystroke.ai/v1/mcp
    ```

    The server advertises its OAuth endpoints automatically, so most clients can self-register with no extra configuration.
  </Tab>
</Tabs>

Once connected, your agent receives Keystroke's authoring guidance automatically and can start building.

## The build loop

Building over MCP follows the same deploy-first loop as the [CLI](/docs/build-with-ai/cli-for-agents): create or open a project, edit code in its workspace, run it to check the output, then deploy. Your agent drives this with MCP tools — you just describe what you want.

<Steps>
  <Step title="Pick a project">
    The agent calls `list_organizations` and `list_projects`, or `create_project` to start fresh. A new project comes with a hosted workspace and the Keystroke CLI ready to go.
  </Step>

  <Step title="Build in the workspace">
    The agent reads and edits TypeScript under `src/` with `read_file`, `write_file`, `edit_file`, `list_files`, and `delete_file` — authoring [agents](/docs/learn/agents/overview), [workflows](/docs/learn/workflows/overview), [triggers](/docs/learn/triggers/overview), and [actions](/docs/learn/actions/overview) just like a local project.
  </Step>

  <Step title="Run and inspect">
    `exec_command` runs shell commands in the workspace — including the `keystroke` CLI, which is authenticated automatically. The agent runs workflows and agents and reads the real output before wiring up dependent steps.
  </Step>

  <Step title="Connect integrations">
    A workspace can't open a browser, so when a build needs a connected app, the agent calls `connect_app` to get a link. You open it to authorize the integration in the web app. See [connect and manage apps](/docs/learn/credentials/connect-credentials).
  </Step>

  <Step title="Deploy">
    Run `keystroke deploy` through `exec_command` to build and ship the workspace. The dedicated `deploy_project` tool is temporarily disabled. See [deploy a project](/docs/learn/projects/deploy-a-project).
  </Step>
</Steps>

## Tools

The server exposes two groups of tools.

### Docs

Always available. These let your agent search and read the Keystroke documentation on demand — the same docs access the [CLI](/docs/build-with-ai/cli-for-agents) exposes, served straight from the MCP server.

| Tool          | Description                                                                       |
| ------------- | --------------------------------------------------------------------------------- |
| `search_docs` | Broad or conceptual lookups; returns matching pages and their paths.              |
| `query_docs`  | Exact keyword/regex search and reading pages by path against the docs filesystem. |

See [docs for agents](/docs/build-with-ai/docs-for-agents) for how these work.

### Projects and workspaces

Tools for building in a hosted workspace. Every tool is scoped to your account and the projects you can access.

| Tool                 | Description                                                           |
| -------------------- | --------------------------------------------------------------------- |
| `list_organizations` | List organizations you belong to.                                     |
| `list_projects`      | List projects you can access in an organization.                      |
| `create_project`     | Create a project and provision its managed repository + shared draft. |
| `read_file`          | Read a file from the shared unpublished draft.                        |
| `write_file`         | Write a file in the shared draft.                                     |
| `edit_file`          | Apply exact text replacements to a draft file.                        |
| `list_files`         | List files in a draft directory.                                      |
| `delete_file`        | Delete a file or directory in the draft.                              |
| `exec_command`       | Run a shell command on a disposable draft checkout.                   |
| `deploy_project`     | Temporarily disabled; use `exec_command` with `keystroke deploy`.     |
| `connect_app`        | Get a web link to connect an integration to the project.              |

## Next steps

<CardGroup cols={2}>
  <Card title="CLI for agents" href="/docs/build-with-ai/cli-for-agents">
    Build locally in your own editor with the Keystroke CLI.
  </Card>

  <Card title="Docs for agents" href="/docs/build-with-ai/docs-for-agents">
    How your agent searches and reads the docs while it builds.
  </Card>

  <Card title="Build agents" href="/docs/learn/agents/build-agents">
    Author agents, configure models, and add tools.
  </Card>

  <Card title="Deploy a project" href="/docs/learn/projects/deploy-a-project">
    How a workspace becomes a running cloud project.
  </Card>
</CardGroup>
