stacki mcp serves the Stacki CLI to AI agents over the Model Context Protocol.
- Same commands, same rules. The tool list is the CLI’s command table: 36 tools, plus any an enabled app adds.
- Plans first. Every write tool returns a plan unless the call sends
apply: true. Deletes also needyes: true. - Role pinned by you, in the server’s arguments. A tool call cannot change it.
- Local, stdio only. No network, no port, no dependency: newline-delimited JSON-RPC 2.0 on stdin and stdout.
Install
- Build the CLI: see Install. You need the absolute path to
dist/cli/stacki.cjs. - Add the server to your agent, below.
- If the project has
.stacki/roles.json, pass--roleor--login. Without one the server runs no tool:tools/listis empty, every call is refused withusage, and the reason is printed on stderr at start. It never falls back to admin; pass--role adminto run as admin.- A project without
roles.jsonhas one role, the owner (admin), and needs no--role.
- A project without
Server options
stacki mcp [--project <dir>] [--role <role>] [--login <github-login>] | Option | Does |
|---|---|
--project <dir> | The project. Default: found from the folder the agent starts the server in |
--role <role> | The role every tool runs as. --as-role is the same option |
--login <github-login> | Run as the role roles.json gives that login (the default role for an unlisted login) |
- Always pass
--projectwith an absolute path. Claude Desktop and Cursor do not start servers in your project folder. - An unknown option exits 2 with
stacki mcp: unknown or incomplete option.
Claude Code
From the project folder:
claude mcp add --scope project stacki -- node /absolute/path/to/stacki/dist/cli/stacki.cjs mcp --project /absolute/path/to/my-site That writes .mcp.json in the project, which you can also write by hand:
{ "mcpServers": { "stacki": { "type": "stdio", "command": "node", "args": ["/absolute/path/to/stacki/dist/cli/stacki.cjs", "mcp", "--project", "/absolute/path/to/my-site"], "env": {} } } } - Claude Code asks once to approve a project-scoped server.
claude mcp get stackishows its state. --scope projectshares it with everyone who opens the repository; the defaultlocalkeeps it to you.- Stacki’s own Settings > MCP tab edits this same
.mcp.json.
Claude Desktop
Edit claude_desktop_config.json (Settings > Developer > Edit Config), then restart Claude Desktop:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "stacki": { "command": "/usr/local/bin/node", "args": ["/absolute/path/to/stacki/dist/cli/stacki.cjs", "mcp", "--project", "/absolute/path/to/my-site", "--role", "admin"] } } } - Use the absolute path of
node(which node). Desktop apps do not see aPATHset up by nvm or your shell profile.
Cursor
.cursor/mcp.json in the project (or ~/.cursor/mcp.json for every project):
{ "mcpServers": { "stacki": { "command": "node", "args": ["/absolute/path/to/stacki/dist/cli/stacki.cjs", "mcp", "--project", "/absolute/path/to/my-site"] } } } - Check the server is switched on in Cursor’s settings, in its MCP section.
Tools
Each tool is stacki_ plus the command’s words. Inputs are the command’s arguments by name; ? marks optional.
| Tool | Access | Inputs |
|---|---|---|
stacki_schema | read | file? string |
stacki_list | read | what components|apps|guides|breakpoints|roles|folders |
stacki_doctor | read | none |
stacki_config_get | read | file string, path? string |
stacki_config_set | write | file string, path string, value any JSON |
stacki_config_unset | write | file string, path string |
stacki_config_add | write | file string, path string, value any JSON, position? integer |
stacki_config_remove | deletes | file string, path string, value? any JSON |
stacki_guides_set | write | visible? boolean, numbers? boolean, color? string, opacity? number, columns? string, margin? string, gutter? string, widthMax? string |
stacki_guides_clear | deletes | field margin|gutter|widthMax|all |
stacki_breakpoints_set | write | id string, value? number, unit? rem|px, name? string |
stacki_breakpoints_add | write | name string, value number, unit rem|px |
stacki_breakpoints_remove | deletes | id string |
stacki_breakpoints_sync | write | id string, value number, unit? rem|px, from? string (a length such as 64rem), places? checked|all. Moves the boundary and the media queries, see Breakpoints |
stacki_roles_add | write | name string |
stacki_roles_remove | deletes | role string |
stacki_roles_members_add | write | role string, login string |
stacki_roles_members_remove | deletes | role string, login string |
stacki_roles_access_grant | write | role string, feature string |
stacki_roles_access_revoke | deletes | role string, feature string |
stacki_roles_components_hide | write | role string, path string |
stacki_roles_components_show | write | role string, path string |
stacki_folders_add | write | kind components|layouts|assets|styles|variables, folder string |
stacki_folders_remove | deletes | kind (as above), folder string |
stacki_folders_reset | deletes | kind (as above) |
stacki_apps_commands | read | none |
stacki_apps_add | write | source string: a local folder or .zip |
stacki_apps_remove | deletes | app string |
stacki_apps_settings_set | write | app string, setting string, value string |
stacki_apps_enable | write | app string, network? boolean |
stacki_apps_disable | write | app string |
stacki_components_rename | write | path string, name string (.astro optional; spaces and case are normalised) |
stacki_components_move | write | path string, folder string |
stacki_components_duplicate | write | path string |
stacki_components_delete | deletes | path string |
stacki_undo | write | id string |
- Every write tool also takes
apply?boolean (defaultfalse: plan only). - Every delete tool also takes
yes?boolean, required withapply: true. - Inputs are closed: an unknown input is refused with
usage. Theroleinput of therolestools names the role being edited; no input changes the role the server runs as. - Annotations:
readOnlyHintis true for read tools;destructiveHintis true for delete tools. - What each command does: Commands.
- App tools: an enabled app’s commands appear as
stacki_<app-id>_<command>, for examplestacki_notes_set-title.
Output
Every tool answers the CLI’s JSON envelope, twice:
structuredContent: the envelope as an object.content[0].text: the same envelope as a JSON string.isError:truewhen the envelope’s exit code is not 0.
Example: plan, then apply
The agent asks for a plan:
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "stacki_guides_set", "arguments": { "opacity": 0.1 } } } The server answers with the plan; nothing is written:
{ "jsonrpc": "2.0", "id": 3, "result": { "structuredContent": { "schemaVersion": 1, "ok": true, "command": "guides set", "project": "/Users/you/my-site", "role": "admin", "notes": [], "summary": "Set the column guide.", "mode": "plan", "applied": false, "files": [ { "file": ".stacki/guide.json", "action": "modify", "beforeDigest": "c420a375…", "afterDigest": "d81b1f2d…", "changes": [{ "path": "settings.opacity", "before": 0.06, "after": 0.1 }] } ] }, "content": [{ "type": "text", "text": "{\"schemaVersion\":1,\"ok\":true,…}" }], "isError": false } } After you approve, the agent calls again with "apply": true. The answer has "mode": "apply", "applied": true and an undoId for stacki_undo.
Example: a refusal
A delete sent with apply: true but no yes:
{ "structuredContent": { "schemaVersion": 1, "ok": false, "command": "guides clear", "error": { "code": "confirmation-required", "message": "\"guides clear\" removes things people made. Show the plan to the person; call the tool again with apply=true and yes=true only when they approve." } }, "isError": true } Resources
| URI | Holds | Listed |
|---|---|---|
stacki://schema/<id> | The key reference of one settings file (stacki schema <id>) | always, one per settable file |
stacki://state/<id> | The file’s current text | only for files that exist in the project |
<id>is a file id fromstacki schema:guide,breakpoints,roles,components,styles, …- MIME type
application/json. - An unknown URI answers JSON-RPC error
-32002.
No prompts. prompts/list answers -32601 Method not found.
Protocol
| Method | Answer |
|---|---|
initialize | Protocol 2025-06-18, 2025-03-26 or 2024-11-05 (the one asked, else the newest). Server stacki version 1 |
ping | {} |
tools/list | The tools the pinned role may run |
tools/call | The envelope |
resources/list, resources/read | Above |
| notifications | Accepted, no reply |
The server sends two notifications:
| Notification | When |
|---|---|
notifications/tools/list_changed | An applied call changed the tools this role may run (apps enable, apps disable, roles edits) |
notifications/resources/list_changed | An applied call made a settings file appear or disappear |
| anything else | -32601 Method not found |
| Error | When |
|---|---|
-32700 | A line is not JSON |
-32600 | Not a JSON-RPC 2.0 request, or a line over 4 MiB |
-32601 | Unknown method |
-32602 | Unknown tool |
-32002 | Unknown resource |
-32603 | Internal error |
Permissions and safety
- Read tools change nothing.
stacki_schema,stacki_list,stacki_doctor,stacki_config_get,stacki_apps_commands. - Write tools plan unless
apply: true. Their descriptions tell the agent to show you the plan and apply only after you approve. - Deletes need
apply: trueandyes: true. - Your agent’s own approval prompt is the gate. Allow read tools freely; keep write tools on ask, so you see each
applycall. - The role is yours, not the agent’s. It comes from
--roleor--login; withroles.jsonand neither, nothing runs.tools/listshows only what that role may run,tools/callchecks again, and a denied tool answersrole-deniedwith no plan detail. - Roles are a guardrail on your own machine, not a security boundary: the agent runs as your user and could edit
roles.jsonwith other tools. - What it can touch: inside the project, the settable
.stackifiles, component files forcomponentstools, stylesheets, pages and components whose media queriesstacki_breakpoints_syncmoves,.stacki/apps/forappstools, and its own journal and lock in.stacki/io/. Outside the project,stacki_apps_addreads the folder or.zipthe call names. Nothing else is written. - Never read: secrets, credentials,
.env, generated folders. The full list is in What it reads and writes. - App code runs only after an admin trusts it (
apps enable), in a child process with no environment, no project read and no file write.
Big projects
- One message in memory at a time. Input is read line by line; a line over 4 MiB is refused and skipped, not buffered.
- No tool timeout on core tools: a rename in a large project takes as long as the scan. App module handlers stop at their declared timeout.
stacki_listwithcomponentslists every component, at any depth: on a very large project the answer is large.- A plan lists at most 200 changes per file.
- One command carries at most 16 effects, each at most 50,000 files (a component folder or an app bundle).
- Writes wait for no one: a busy project answers
lockedat once. Retry the call.
Troubleshooting
| You see | Do |
|---|---|
| No tools listed | Two causes. No project found: pass --project with an absolute path. Or the project has roles.json and the server has no --role or --login: the server’s stderr says so |
Every call refused with usage and needs a role | Add --role <role> (for example --role admin) or --login <github-login> to the server’s arguments |
| Server fails to start in Claude Desktop | Use the absolute path of node; Node 22.18 or later |
stacki mcp: unknown or incomplete option | Only --project, --role, --as-role and --login, each with a value |
| Fewer tools than expected | The pinned role lacks those features. Grant them in Settings > Roles, or pin another --role |
role-denied | Same: the role may not run that command |
"x" is not a role in .stacki/roles.json | Fix --role; the message lists the roles that exist |
An app’s tools missing after apps enable | The server sends tools/list_changed after the apply; if your agent ignores it, restart the server |
confirmation-required | The tool deletes: the call needs apply: true and yes: true |
unknown option "role" | The role the server runs as is set in its arguments, never in a tool call |
locked or conflict | The app or another writer is busy. Plan again, then apply |
| Claude Code shows the server as pending | Run claude in the project and approve it, or check claude mcp get stacki |