# Nanopage MCP Interface

Canonical HTML: https://nanopage.site/mcp (sign-in required to mint tokens)

Connect an AI coding agent (Claude Code, Claude Desktop, Cursor, Codex) to Nanopage over the Model Context Protocol. Your agent generates the site with its own model; Nanopage validates, stores, and hosts it at `{slug}.nanopage.site`.

## Endpoint

- **URL**: `https://api.nanopage.site/mcp` (also reachable at `https://nanopage.site/mcp` for POST)
- **Transport**: Streamable HTTP (JSON-RPC 2.0 over POST)
- **Auth**: `Authorization: Bearer np_YOUR_TOKEN` — mint a personal access token at [nanopage.site/mcp](https://nanopage.site/mcp) (requires a Nanopage account). OAuth is not shipped yet; skip your client's OAuth-based "Add server" dialog and use a config file with a static header.
- **Scopes**: tokens carry the single scope `mcp` (publishing + read-back only, never dashboard/billing/admin), declared machine-readably per RFC 9728 at [api.nanopage.site/.well-known/oauth-protected-resource/mcp](https://api.nanopage.site/.well-known/oauth-protected-resource/mcp)
- **REST twin**: the same seven operations are available as a plain HTTPS + JSON API at `https://api.nanopage.site/v1`, described by [nanopage.site/openapi.json](https://nanopage.site/openapi.json)

Example Claude Code config (`.mcp.json`):

```json
{
  "mcpServers": {
    "nanopage": {
      "type": "http",
      "url": "https://api.nanopage.site/mcp",
      "headers": { "Authorization": "Bearer np_YOUR_TOKEN" }
    }
  }
}
```

## Tools

- `publish_website` (write) — create a new site from a file bundle (index.html + assets + images)
- `publish_version` (write) — add a version to an existing site; auto-promotes unless `promote:false`
- `list_websites`, `get_website`, `list_versions` (read)
- `get_job_status` (read) — publish jobs land ready immediately
- `suggest_slug` (read) — slug validity, availability, and fallback suggestion

## Resources & prompts

- Resource `nanopage://spec/authoring-guide.md` — the authoring spec (file layout, hard rules, size limits). Read it before generating.
- Prompt `nanopage_publish_site` — bootstraps a publishable site from a topic with the spec inlined.

## Authoring rules (enforced at publish time)

Static sites only. Rejected: external scripts/styles/fonts (bundle inline), iframes/objects/embeds, `javascript:` URLs, service workers, off-site meta-refresh, forms posting to external hosts, anything needing a backend. Allowed layout: `index.html` plus up to 14 more `{slug}.html`, `assets/site.css`, `assets/{slug}.js`, `images/`, `files/`, `videos/`. Limits: 40 files, 2MB per file, 8MB total.

## Related

- [Developer resources](https://nanopage.site/developers/)
- [Blog: Nanopage Now Has an MCP Server](https://nanopage.site/blog/nanopage-mcp-server-ai-coding-agents/)
