Skip to main content
Glama
agentpages-mcp

agentpages-mcp

README.md
# agentpages-mcp

A small [MCP](https://modelcontextprotocol.io) server that lets an AI assistant publish a
static website through the [AgentPages](https://github.com/mrprogrammingx/agentpages) API.

AgentPages is the service: it stores and serves static sites behind an HTTP API
(`POST /v1/sites`). This repository is only a client for it. It gives an MCP client
(Claude Code, Claude Desktop, Gemini CLI, ...) one tool, `create_website`, which sends
the model's files to AgentPages and returns the public URL.

- Transports: **stdio** (default; runs on the user's machine with their key in the
  environment) and **Streamable HTTP** (`--http`; a hosted server where each caller sends
  their own key as an `Authorization: Bearer` header). See [Hosted mode](#hosted-mode-http).
- One tool: `create_website(files)`, where each file is `{path, content, encoding}` and
  `encoding` is `"utf8"` (default) or `"base64"`.
- The tool description tells the model the AgentPages limits and sandbox rules, so it
  writes a valid site on the first try.
- No client-side validation beyond "files is a non-empty list": AgentPages is the single
  source of truth. Its errors come back to the model as `<code>: <message>` tool errors
  (for example `index_missing: ...`), so the model can fix the files and retry.

## Install and run

Requires Python 3.12 and [uv](https://docs.astral.sh/uv/).

```bash
git clone https://github.com/mrprogrammingx/agentpages-mcp.git
cd agentpages-mcp
uv sync
```

Configuration is read from the environment only:

| Variable             | Example                 | Notes                       |
| -------------------- | ----------------------- | --------------------------- |
| `AGENTPAGES_API_URL` | `http://localhost:8000` | Base URL, no trailing slash |
| `AGENTPAGES_API_KEY` | `ap_...`                | Bearer key                  |

If either is missing, the tool returns a clear error (the server still starts). The key is
never logged or returned.

Run the server (it speaks MCP over stdin/stdout, so you normally let your MCP client
start it):

```bash
AGENTPAGES_API_URL=http://localhost:8000 AGENTPAGES_API_KEY=... uv run agentpages-mcp
```

Run the tests (no network needed; the API is mocked with `respx`):

```bash
uv run pytest -q
```

### A local AgentPages to try it against

In a checkout of the [agentpages](https://github.com/mrprogrammingx/agentpages) repo:

```bash
docker compose up -d
```

```bash
docker compose exec -T api agentpages create-key --name mcp
```

## Client configuration

Replace `/path/to/agentpages-mcp` with the absolute path of this checkout, and the URL and
key with your own.

### Claude Code

```bash
claude mcp add agentpages -e AGENTPAGES_API_URL=http://localhost:8000 -e AGENTPAGES_API_KEY=your-key -- uv run --directory /path/to/agentpages-mcp agentpages-mcp
```

### Claude Desktop

In `claude_desktop_config.json` (Settings > Developer > Edit Config):

```json
{
  "mcpServers": {
    "agentpages": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/agentpages-mcp", "agentpages-mcp"],
      "env": {
        "AGENTPAGES_API_URL": "http://localhost:8000",
        "AGENTPAGES_API_KEY": "your-key"
      }
    }
  }
}
```

Claude Desktop may not see your shell's `PATH`; if `uv` is not found, use its absolute
path (`which uv`) as `command`.

### Gemini CLI

In `~/.gemini/settings.json` (or `.gemini/settings.json` in a project):

```json
{
  "mcpServers": {
    "agentpages": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/agentpages-mcp", "agentpages-mcp"],
      "env": {
        "AGENTPAGES_API_URL": "http://localhost:8000",
        "AGENTPAGES_API_KEY": "your-key"
      }
    }
  }
}
```

## Hosted mode (HTTP)

`agentpages-mcp --http` serves MCP over Streamable HTTP at `/mcp` (stateless, JSON
responses) and a health check at `/healthz`. It is meant to run next to AgentPages, so
users can add it by URL instead of installing anything.

- **Each caller's own key.** The tool reads the key from the request's
  `Authorization: Bearer <AgentPages key>` header and forwards it to the API. The server
  has no key of its own: it refuses to start in `--http` mode if `AGENTPAGES_API_KEY` is
  set, so nobody can ever publish with a shared key.
- Listing tools works without a key; calling `create_website` without one returns
  `unauthorized: ...` as a tool error.
- `MCP_ALLOWED_HOSTS` (comma-separated) limits the accepted `Host` headers, for example to
  the public hostname. Other hosts get `421`.
- Request bodies up to 6 MiB are accepted; the API enforces its own 5 MiB limit.
- Keys are never logged or returned.

Run it locally:

```bash
AGENTPAGES_API_URL=http://localhost:8000 uv run agentpages-mcp --http --port 8080
```

Deploying with Docker next to AgentPages (Cloudflare Tunnel, no host ports):
[docs/DEPLOY.md](docs/DEPLOY.md).

### Connecting to a hosted server

Replace the URL with your server's and `your-key` with your own AgentPages key.

Claude Code:

```bash
claude mcp add --transport http agentpages https://agentpages-mcp.example.com/mcp --header "Authorization: Bearer your-key"
```

Gemini CLI (`~/.gemini/settings.json`):

```json
{
  "mcpServers": {
    "agentpages": {
      "httpUrl": "https://agentpages-mcp.example.com/mcp",
      "headers": { "Authorization": "Bearer ${AGENTPAGES_API_KEY}" }
    }
  }
}
```

Cursor, VS Code and other clients that accept a URL plus headers work the same way. Chat
apps that only offer OAuth sign-in (claude.ai, ChatGPT, the Gemini app) are not supported
yet: see Out of scope.

## Example prompt

> Create a one-page website for a coffee shop and publish it.

The assistant writes `index.html` (and any CSS, JS or images), calls `create_website`,
and answers with the URL, for example:

```
Published: http://localhost:8001/s/k3j9x2/
id: ...
slug: k3j9x2
version: 1
```

## AgentPages rules the tool description passes on

- `index.html` is required at the root.
- Allowed extensions: html, css, js, svg, png, jpg, jpeg, webp, ico, txt, json.
- At most 100 files per site, 1 MiB per file after decoding, 5 MiB per request, 10 sites
  per key.
- Sites run in a sandbox with an opaque origin: only classic `<script src>` works; no ES
  modules, no fetching the site's own files, no localStorage, no cookies, and no
  external network resources.

## Out of scope (for now)

- Update, delete and list tools.
- OAuth sign-in for hosted mode (needed by chat apps such as claude.ai, ChatGPT and the
  Gemini app).
- Instagram import.

## Note on the MCP SDK

This uses the official `mcp` Python SDK 2.x, where `FastMCP` was renamed `MCPServer`
(`from mcp.server.mcpserver import MCPServer`). It is the same decorator-based API.

## License

MIT

TDQS

A4.3/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool there is no possible overlap or misselection; the tool's purpose (publish a static site) is unmistakable from its name and description.

Naming Consistency5/5

The single name `create_website` follows a clean verb_noun snake_case convention, so there is no inconsistency to speak of.

Tool Count3/5

The surface is a single tool for a domain (hosted site management) that the description itself implies has more state, e.g. a 10-site-per-key quota. It is thin rather than wrong, and the one tool is heavyweight enough to justify its place.

Completeness2/5

Only create/publish is exposed: there is no list_sites, get_site, update/redeploy, or delete_site, so an agent that hits the 10-site limit or needs to fix a published site has no path forward. Coverage of the site lifecycle is significantly incomplete.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues