42 lines
2.4 KiB
Markdown
42 lines
2.4 KiB
Markdown
# MCP server
|
|
|
|
`cmd/mcp` builds `renewcms-mcp`, a stdio [MCP](https://modelcontextprotocol.io) server for Claude Desktop, Claude Code, Cursor and similar clients. It is an HTTP client of the public API: it holds no database access and sends the API key as `Authorization: Bearer`, so what the key's user may do is the limit of what the model may do.
|
|
|
|
Build it with `task build:mcp` (`bin/renewcms-mcp`).
|
|
|
|
## Configuration
|
|
|
|
| Name | Description |
|
|
| --- | --- |
|
|
| `RENEWCMS_URL` | Address of the instance, for example `https://cms.example`. |
|
|
| `RENEWCMS_API_KEY` | An API key created at `/integration/api-keys`. |
|
|
|
|
They belong to the MCP binary only and are not server variables.
|
|
|
|
```json
|
|
{
|
|
"mcpServers": {
|
|
"renewcms": {
|
|
"command": "/path/to/renewcms-mcp",
|
|
"env": { "RENEWCMS_URL": "https://cms.example", "RENEWCMS_API_KEY": "rcms_..." }
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## Tools
|
|
|
|
`list_articles`, `get_article`, `create_article` (always a draft), `update_article_body`, `publish_article`, `check_seo`, `list_media`, `upload_media` (local `path`, or `base64` with `filename`), `list_sites`, `get_sitemap`.
|
|
|
|
`--allow-destructive` adds `delete_article` and `delete_media`.
|
|
|
|
Routes that need a browser session, such as creating a site, are not exposed. API errors come back as tool errors with the status and the plain-text message.
|
|
|
|
## Why it calls the HTTP API
|
|
|
|
`renewcms-mcp` runs on the machine of the person using the model (Claude Desktop, Cursor), usually not on the server, and talks to a remote instance. Calling the use cases directly would need the database, the storage and the secrets of the instance in that process, and would skip what the HTTP layer enforces for every client: API-key authentication and its rate limit, the role permissions checked by the router middleware, the activity context, validation of the request bodies and the plain-text error contract. Going through the published routes keeps the model inside the same limits as any API key and keeps one contract to test. It uses the authenticated routes (`/v1/article`, `/v1/media`, `/v1/site`), not the public `/v1/public` routes, so drafts stay reachable for the key's user. Running it in-process with the server is not supported.
|
|
|
|
## Resources and prompts
|
|
|
|
The resource `renewcms://docs/llms-full.txt` is the instance's own [`/llms-full.txt`](llms.md), so the model reads the documentation of the exact version it talks to. The prompt `write_and_publish_article` drafts, checks the SEO and asks before publishing.
|