StoryOS
v0.1.2Your StoryOS workspace (records, approvals and agents) for Claude, ChatGPT and any MCP client.
The StoryOS Model Context Protocol server — it exposes your StoryOS workspace to AI agents (Claude first; ChatGPT-compatible by design). It's a thin, stateless translator over the same /api/v1 the web app uses, so it can never drift from the product, and every response is scoped and validated server-side. Design + roadmap: docs/product/mcp-plan.md. Ticket: MN-076. A workspace's skills are also exposed as native MCP resources and prompts, for clients that understand those primitives (not just tools):
Summary extracted from the README.
@storyos/mcp
The StoryOS Model Context Protocol server — it
exposes your StoryOS workspace to AI agents (Claude first; ChatGPT-compatible by
design). It's a thin, stateless translator over the same /api/v1 the web app
uses, so it can never drift from the product, and every response is scoped and
validated server-side.
Design + roadmap: docs/product/mcp-plan.md.
Ticket: MN-076.
Tools
Read
| Tool | What it does |
|---|---|
get_started |
Orientation + a workspace map; with section it returns one reference section (the filter cheat-sheet, icons, working notes, a tool's full notes). |
list_workspaces |
Workspaces the token can access. |
list_databases |
Databases in a workspace. |
describe_database |
A database's schema — exact api_names, types, options, relation targets: what a write is keyed by. |
search |
Full-text record search — turn a name into a real id. |
query_records |
Filter / sort / paginate records (structured filter AST). |
get_record |
One record in full, by uuid or public number. |
get_links |
Web-app URLs for a database, its saved views, and/or a batch of records — without a round-trip per record. |
Write (each returns the resulting record; each 422 is surfaced verbatim)
| Tool | What it does |
|---|---|
create_record |
Create a record; values by api_name, selects accept the label, relations accept an array of target numbers/ids (linked in the same write). |
update_record |
Merge-update (null clears); record by uuid or public number. Naming a relation sets it to exactly those targets. |
delete_record |
Trash a record (restorable 30 days). |
link_records |
Link a record to targets through a relation field. replace: true sets the link set to exactly targets — how you re-point or clear a one-to-many link. |
unlink_records |
Remove specific links from a relation field (the relation itself stays). |
add_comment |
Post a comment. |
attach_file |
Attach a file to a record — from a public url (fetched server-side) or inline content_base64; images get a thumbnail. |
list_attachments / delete_attachment |
List a record's files, or remove one by id. |
run_button |
Press a button field, running its automation actions. |
Build / schema (agents design the workspace, not just fill it)
| Tool | What it does |
|---|---|
list_spaces / create_space |
List / create spaces (a space holds databases). |
create_database / update_database / delete_database |
Create, rename/move, or delete a database (delete needs confirm = name). |
add_field / update_field / delete_field / change_field_type |
Manage fields; select options by label; convert a field's type (dry_run to preview). |
create_view / update_view / delete_view |
Manage views; accepts group_by / card_fields / date fields plus filters + sorts. |
create_relation / delete_relation |
Link two databases (one_to_many / many_to_many) — paired relation fields. |
reorder_fields / reorder_views |
Set field / view order by name. |
Skills (a workspace's saved skills, over MCP)
| Tool | What it does |
|---|---|
list_skills |
Skills visible to the caller — their own personal ones, plus every shared one (same visibility rule the in-app Skills list enforces). |
run_skill |
Resolve a skill's instructions/when_to_use by name or id, and record the run (last_run_at/last_run_status). The call invokes no model, so you — the connected agent — carry out the instructions against the inputs you pass; they're echoed back, not executed server-side (an agent set to "StoryOS AI" can have the skill named in its Skills field instead). |
A workspace's skills are also exposed as native MCP resources and prompts, for clients that understand those primitives (not just tools):
- Resources: a
storyos-skill://{workspace}/{skill}template.resources/listreturns one entry per visible skill (across every workspace the token can see); reading one returns the skill rendered as portable Markdown — the exact shapeGET /skills/:id/export?format=markdownproduces. - Prompts: one named prompt per visible skill (e.g.
skill_weekly_status_digest), disambiguated by workspace name on a name collision.prompts/getreturns the skill's instructions as a single user-role message, ready to paste into context.
Both are read-only and best-effort: a catalog fetch failing for one workspace
never blanks out another's, and a failure registering them never breaks the
tools (see server.ts).
Automations (build a complete workflow — admin-scoped, #334)
| Tool | What it does |
|---|---|
list_automations |
The rules on a database — each with its trigger (field/relation names resolved), condition, actions, enabled state, failure streak and last-run status. |
get_automation |
One rule's full, editable definition — human-readable database/field/select names alongside their stable ids — ready to feed back into update_automation. |
create_automation |
Create a rule = trigger (record_created / record_updated / record_linked / schedule / webhook_received) + optional condition (a query_records-style filter) + 1–10 actions (set_values / create_record / add_comment / notify_user / update_linked / send_slack_message / send_webhook / send_email / http_request / run_agent). Field/relation/person names and select labels resolve server-side; the in-app validator (AutomationActionsService.validate) validates the whole rule, so a bad reference comes back as a structured error, not a 500. |
update_automation |
Rename, enable/disable, or replace a rule's trigger / condition / actions — every field optional, re-validated the same way. |
delete_automation |
Delete a rule (requires confirm=true); reports the removed rule's name, trigger and action summary. |
Automations are an admin surface (the API is @RequiresScope('admin') and
creator-gated), so all five tools are advertised only to an admin-scoped token — a
read- or write-scoped PAT never sees them and therefore can never mutate a rule.
These tools call the same endpoints the in-app RuleEditor does; there is no
parallel validation path. Diagnose why a rule did (or didn't) fire with get_runs.
Conveniences: query_records / get_record return select values as labels (not option ids) and rich_text as Markdown; create_record / update_record accept Markdown on a rich_text field (headings, lists, links, code → parsed to blocks) and select labels; create_record reports any unset template fields. get_record / query_records / create_record / update_record all include a url — a clickable web-app link for that record — so an agent never has to describe a manual navigation path.
Hosted Streamable HTTP (for ChatGPT / claude.ai connectors without a local process) is the remaining phase — it lands with the cloud tier (see MN-069).
Light enough for capped clients (ticket #1262)
Every listed tool description is billed on every request of every session, so the listing is kept small:
under 60,000 characters in total and no description over 1,500 (src/tool-description-budget.test.ts
enforces both against the live registry). A description in the source can be as long as the tool needs;
tools/list carries a short lead plus [Full notes: get_started section "TOOL NOTES <tool>"] (the one canonical pointer
format, double quotes), naming the exact section. get_started with no argument returns only the overview and an index of section names (under 10,000
characters, so no client truncates it); get_started with section set to a name from that index returns that one section: the
full text of one tool (the long reference grammars are TOOL NOTES create_automation, install_pack,
add_field, create_source), FILTERS, ICONS or WORKING NOTES. Matching is exact first, then case-insensitive; an unknown
name returns a text answer listing the valid names. One 85,000-character result was the alternative, and a client
that truncates a single result would have silently dropped the grammars. A section is only loaded when called,
so it costs a capped client nothing up front (src/get-started-sections.test.ts checks every lead points at a
section that exists). Where a lead must say something at call time, it is hand-written with a short: key next to the
description. The agent-run profile (?profile=agent-run, the Runner's runs) offers get_started too, because parameter hints (FILTERS, ICONS) name it, but keeps every description WHOLE (WHOLE_DESCRIPTION_PROFILES in src/tool-profiles.ts): its 9 tools total about 3k characters, only ~1k more than leads would cost, and a lead is a round trip. src/profile-pointers.test.ts checks, for every profile, that a pointer names a tool the profile offers and a section its own index lists.
Maintainer-only tools (get_branch_name, get_pinned_tabs, set_pinned_tabs, get_dismissed_hints,
set_dismissed_hints, list_icon_set; INTERNAL_TOOLS in src/tool-profiles.ts) are not offered on any customer
connection. They appear with ?profile=internal over HTTP, or STORYOS_MCP_PROFILE=internal for a stdio server.
The icon names list_icon_set used to return are in get_started section ICONS.
Descriptions state facts and references, never instructions (ticket #1288)
The Claude connector directory policy for tool metadata is that a description contains no instructions about model behaviour or other
tools. A tool description says what the tool does, takes and returns; it may state a product fact and carry a neutral reference
(See also: describe_database, [Full notes: get_started section "TOOL NOTES <tool>"]). Guidance for the model (look at the schema
before writing, count with count_records, do not retry a held write, ...) lives in get_started section WORKING NOTES, which is a
tool RESULT and not a description. src/tool-description-policy.test.ts enforces this against the live registry: every tool
description and every parameter description, on every profile, is scanned for imperatives about another tool, sequencing words
around a tool name, "read this before"-style calls to action and behavioural instructions (FORBIDDEN_PATTERNS), with self-tests
and an explicit ALLOWED_PHRASES list that needs a reason per entry.
Why it doesn't hallucinate
- Schema-first:
describe_databasegives exactapi_names; you read before you write. - Validation-as-teacher: the API's typed error is surfaced verbatim, so a wrong field/value comes back naming the problem and the model self-corrects in one turn.
- Structured filters, not a query language: nothing to invent; the op×type matrix
ships in
get_startedsectionFILTERS. - Never invent ids: they come only from
search/list_*/ a prior result; names and slugs are accepted and resolved server-side.
Configure
1. Get a token — in StoryOS, sidebar → API tokens → create one for the
workspace you want. Copy the mn_pat_… (shown once; scoped to that workspace).
Without this, the server starts and immediately exits with fatal STORYOS_TOKEN is required — that's the config check working, not a broken install.
2a. Claude Code
claude mcp add storyos \
-e STORYOS_URL=https://app.storyos.dev \
-e STORYOS_TOKEN=mn_pat_xxx \
-- npx -y @storyos/mcp
2b. Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json)
{
"mcpServers": {
"storyos": {
"command": "npx",
"args": ["-y", "@storyos/mcp"],
"env": {
"STORYOS_URL": "https://app.storyos.dev",
"STORYOS_TOKEN": "mn_pat_xxx"
}
}
}
}
STORYOS_URL is https://app.storyos.dev for the cloud box, or
http://localhost:3001 for local dev. Restart Claude, then ask it to "list my
StoryOS databases".
Running from this repo instead (contributing, or testing an unreleased
change): build first, then swap the command/args above for node +
/ABSOLUTE/PATH/to/repo/packages/mcp/dist/index.js.
pnpm install
pnpm --filter @storyos/mcp build # → packages/mcp/dist/index.js
Hosted (Streamable HTTP) — no local process
For cloud use, run the same tools over HTTP so teammates connect with just a URL +
token (claude.ai / ChatGPT connectors, MCP Inspector, etc.) — no repo, no node path.
- Entry:
dist/http.js(pnpm --filter @storyos/mcp start:http), listens onPORT(3002). - Endpoint:
POST /mcp(stateless Streamable HTTP);GET /healthfor liveness. - Auth is per-request: each call sends its own PAT as
Authorization: Bearer mn_pat_…, so one endpoint serves every user and the API scopes each response. No shared token. - Deploy: the
mcpservice indocker-compose.ymlruns it; route a subdomain (mcp.your-domain.com → mcp:3002) in your Caddy TLS drop-in (seedocker/tls.d/origin.caddy.example).
Connect a client to https://mcp.your-domain.com/mcp:
{
"mcpServers": {
"storyos": {
"url": "https://mcp.your-domain.com/mcp",
"headers": { "Authorization": "Bearer mn_pat_xxx" }
}
}
}
Develop
pnpm --filter @storyos/mcp dev # run from source over stdio (needs STORYOS_TOKEN)
pnpm --filter @storyos/mcp build # compile to dist/