MCP Servers

Every Keel project exposes an MCP (opens in a new tab) (Model Context Protocol) server. This lets AI assistants like Claude, Cursor, and Codex discover your data model and execute actions — without writing any integration code.

Endpoint

Keel exposes an MCP server for each API defined in your schema. The endpoint follows the pattern /{apiName}/mcp.

For example, given this schema:

api Web {
    models {
        Product
        Order
    }
}
 
api Internal {
    models {
        AuditLog
    }
}

Two MCP endpoints are available:

  • https://your-app.keelapps.xyz/web/mcp
  • https://your-app.keelapps.xyz/internal/mcp

If you don't define any APIs in your schema, Keel creates a default API called api, and the MCP endpoint is:

https://your-app.keelapps.xyz/api/mcp

Each MCP server only exposes the actions belonging to its API, so you can control what each AI assistant has access to.

Connecting AI tools

Claude Desktop

Open your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add your Keel MCP server:

{
  "mcpServers": {
    "my-keel-app": {
      "url": "https://your-app.keelapps.xyz/web/mcp"
    }
  }
}

Restart Claude Desktop. On the first message, Claude will walk you through authenticating with your Keel app in the browser.

Claude Code

Add the MCP server using the Claude Code CLI:

claude mcp add my-keel-app --transport http https://your-app.keelapps.xyz/web/mcp

Claude Code will handle OAuth authentication automatically when you first interact with the server.

Cursor

Open Cursor's MCP configuration file at ~/.cursor/mcp.json (or .cursor/mcp.json in your project root for project-scoped servers) and add:

{
  "mcpServers": {
    "my-keel-app": {
      "url": "https://your-app.keelapps.xyz/web/mcp"
    }
  }
}

Restart Cursor. The MCP server will appear in Cursor's tool list, and authentication will be handled when you first use it.

OpenAI Codex CLI

Add the MCP server using the Codex CLI:

codex --mcp-config '{"my-keel-app": {"url": "https://your-app.keelapps.xyz/web/mcp"}}'

Or add it to your ~/.codex/config.yaml for persistent configuration:

mcpServers:
  my-keel-app:
    url: https://your-app.keelapps.xyz/web/mcp

Codex will handle OAuth authentication automatically on first use.

Authentication

Your Keel app must have at least one authentication provider configured for MCP authentication to work. MCP clients handle the OAuth flow automatically — a browser window will open for you to log in on first use.

Local development

When running your Keel app locally with keel run, you can connect AI tools to your local MCP server:

{
  "mcpServers": {
    "my-keel-app-local": {
      "url": "http://localhost:8000/api/mcp"
    }
  }
}

The MCP server's OAuth authentication flow requires an SSO authentication provider (such as Google or Auth0) to be configured. If you don't have an SSO provider set up locally, you can authenticate manually by generating a bearer token and passing it in the MCP server configuration as a header:

{
  "mcpServers": {
    "my-keel-app-local": {
      "url": "http://localhost:8000/api/mcp",
      "headers": {
        "Authorization": "Bearer <your-token>"
      }
    }
  }
}

If your actions allow public access, no authentication is needed.

Example

Given a Keel schema like this:

model Product {
    fields {
        name Text
        price Number
        inStock Boolean
    }
 
    actions {
        list listProducts()
        create createProduct() with (name, price, inStock)
    }
}

An AI assistant connected to your MCP server can handle natural language requests such as:

  • "Show me all products that are in stock" — resolves to a query call on listProducts
  • "Add a new product called Widget for $9.99" — resolves to a mutate call on createProduct