Claude Code
Connect Claude Code to a Mojimoto project, point it at llms.txt, give it a prompt that works and check what it did.
This page sets Claude Code up to read and write one Mojimoto project: a skill that holds your content model, the project's MCP server, and the one instruction that stops it guessing. It takes about ten minutes.
The guide Use Mojimoto with Claude Code covers the same ground as a tutorial, and the command below sets up Cursor and Codex too.
1. Create two tokens
On the project's API keys page:
- A read token, used once to download your content model. The project's public read token will do.
- A write token for Claude Code to use over MCP. Under Custom tokens, give it a name such as
claude-code, tickwrite, then narrow it under What it can do and Content types. For an agent that should draft blog posts, leave only Create and edit drafts ticked and tick only the post type.
The public read token cannot be used with MCP, so the second token is needed even for an agent that only reads.
2. Connect the MCP server
Run this in the root of your site's repository:
npx @mojimoto/cli init --agent claude --project acme --token mjmt_your_read_token✓ Wrote .claude/skills/mojimoto/SKILL.md
✓ Wrote .claude/skills/mojimoto/reference/content-model.md
✓ Updated CLAUDE.md
✓ Added the mojimoto server to .mcp.json
Next steps:
1. In Mojimoto, open the project's API keys page and create a token with write access.
2. Export it before starting your agent: export MOJIMOTO_WRITE_TOKEN=<token>
The MCP config reads it from the environment, so it never sits in your repo.
3. MCP server: https://mojimoto.com/mcp/acme| File | What it is |
|---|---|
.claude/skills/mojimoto/SKILL.md |
How to read, write and model content in this project. |
.claude/skills/mojimoto/reference/content-model.md |
Your content types and fields, as TypeScript types. |
CLAUDE.md |
A short note that points Claude Code at the skill and the MCP server. |
.mcp.json |
The project's MCP server, added next to any servers you already have. |
No token is written to any of them. .mcp.json reads the write token from the environment, so export it in the shell you start Claude Code from:
export MOJIMOTO_WRITE_TOKEN=mjmt_your_write_token
claudeLeave out --agent claude to set up Cursor and Codex in the same run. Every flag is on the CLI page.
Or add the server by hand
claude mcp add --transport http mojimoto https://mojimoto.com/mcp/acme \
--header "Authorization: Bearer mjmt_your_write_token"This connects the server and nothing else: no skill and no content model file.
3. Point Claude Code at llms.txt
https://mojimoto.com/llms.txt is the full reference for agents: how to model content, the write format of every field type, both APIs and the MCP tools. The skill covers the everyday rules, and llms.txt covers the rest.
Add this line to your CLAUDE.md, outside the part between the mojimoto markers so that running init again does not replace it:
Read https://mojimoto.com/llms.txt before you model or write any Mojimoto content.4. A prompt that works
To build a front end from content that already exists, this is the prompt the Get started screen of your project offers, with your own project id and public read token filled in:
Read https://mojimoto.com/llms.txt first. My content is in the Mojimoto project acme. The delivery API is https://mojimoto.com/api/v1 and this read token is safe to use in the browser: mjmt_your_read_token Build a small site that lists the entries and renders each one, in the framework this repo already uses.To change the model and write content, say which entry, say draft or publish, and say what must not change:
Read https://mojimoto.com/llms.txt before you model or write any Mojimoto content.
Then read the mojimoto://content-model resource.
Add a "quote" block type to the sections field of the page type, with a required
text field and an author field. Keep every block type the field already has.
Add a quote block to the end of the page entry with uid "home" and save it as a
draft. Do not publish. Tell me the ids of everything you changed.What makes these work:
- The model is read before anything is written. The agent uses your real field ids, not likely-sounding ones.
- The entry is named by type and
uid.pageandhomecannot be mistaken for another entry. - Draft or publish is stated. A saved draft does not change the live site. Publishing does.
- What to keep is stated. Changing a field replaces its whole definition, so an agent that is not told to keep the existing block types can drop them.
5. Check what it did
In Claude Code, run /mcp. The mojimoto server should be listed as connected, with the tools its token allows. A token limited to drafts shows create-document-tool and update-document-tool but no publish-document-tool.
In Mojimoto:
- Content. Open the entry the agent changed. A draft it saved is not live until someone publishes it. The Versions panel lists every version with the name of the token that wrote it.
- Content model. New content types and fields appear here as soon as the agent adds them.
- Media. Files the agent uploaded are in the media library.
- API keys. Each token shows when it was last used.
Then, after a change to the content model:
npx @mojimoto/cli init --agent claude --project acme --token mjmt_your_read_tokenRunning init again refreshes the content model file in the skill and keeps your edits to SKILL.md. If your site uses Generated types, download those again as well.
When something does not work
| What you see | What to check |
|---|---|
| The server is not connected | MOJIMOTO_WRITE_TOKEN has to be exported in the shell that started claude. |
| The server is connected but has no tools | The token is the public read token. Create a custom token. |
| Only the two list tools are there | The token does not have write. |
A tool such as publish-document-tool is missing |
The token is limited to other operations. |
This token can only work with these content types: post. |
The token is limited to those content types. |
Cannot publish - Title is required. |
The entry fails a field rule. The message names each field. |
This project has no locale "fr-fr". |
Add the locale under Settings, Locales, then write to it. |
Every tool, its arguments and what it returns is on the MCP server page.
Something wrong or missing on this page? Tell us and we will fix it.