# REST and MCP

Use Stowpot's MCP tools from a client such as Claude Code or Codex. Both MCP and REST work with the same content items and use Stowpot bearer credentials.

## Connect an MCP client

Start a [local Stowpot instance](/docs/quickstart). Its Streamable HTTP endpoint is `http://127.0.0.1:8080/mcp`. Use the URL of your own instance if it runs elsewhere. Issue a read credential for search and retrieval and make it available as `STOWPOT_TOKEN` in the environment where you start the client. To create or revise content, use a separate credential with item write access.

### Claude Code

Add this server to the `mcpServers` object in your project's `.mcp.json`. Claude Code expands the environment variable when it connects.

```json
{
  "mcpServers": {
    "stowpot": {
      "type": "http",
      "url": "http://127.0.0.1:8080/mcp",
      "headers": {
        "Authorization": "Bearer ${STOWPOT_TOKEN}"
      }
    }
  }
}
```

Open Claude Code in that project and check the connection with `/mcp`. [Claude Code MCP docs](https://code.claude.com/docs/en/mcp).

### Codex CLI

Add this server to `~/.codex/config.toml`, then start Codex from the environment containing the token.

```toml
[mcp_servers.stowpot]
url = "http://127.0.0.1:8080/mcp"
bearer_token_env_var = "STOWPOT_TOKEN"
```

Use `/mcp` in Codex to check the connection. [Codex MCP docs](https://learn.chatgpt.com/docs/extend/mcp?surface=cli).

## Try a prompt

- **Find and read:** “Find the Stowpot note tagged onboarding and summarize the setup steps.” The client can use `list_items` and `get_item`.
- **Save a draft:** “Save a Markdown draft called Release notes in Stowpot and tag it release-notes.” The client can use `capture_item` with write access.
- **Revise a page:** “Read the current onboarding note in Stowpot, then add a troubleshooting section.” The client can use `get_item` followed by `revise_item` with the revision it just read.

## REST

Read an item using `GET /v1/items/{id}` or search with `GET /v1/items?q=quickstart`. The running CMS serves its REST contract at `/openapi.yaml`.
