@workpowers/speckle
v0.10.0
Published
Local MCP router for Speckle — resolves project context from a committed .speckle marker and forwards calls to the remote Speckle MCP endpoint.
Readme
@workpowers/speckle
The local MCP router for Speckle.
Speckle keeps a living specification of a product — what is true about it, what
you intend to do about it, and what changes are being proposed to that truth.
This package is the small stdio bridge that puts it in front of an AI agent. It
resolves which project you are in from a committed .speckle marker, then
forwards MCP calls to the remote Speckle endpoint.
Register it once per machine. Every repo you work in selects its own project through its own marker file — there is no per-project setup beyond that file.
Install
You do not install it directly; your MCP client runs it through npx. For
Claude Code:
claude mcp add speckle -s user \
-e SPECKLE_MCP_BASE_URL=https://speckle.workpowers.ai \
-e SPECKLE_MCP_KEY=lsk_your_key_here \
-- npx -y @workpowers/speckleGenerate the key at Account → MCP (/account#mcp) on your Speckle host. One
key covers every project you have access to.
Desktop and other GUI hosts
A desktop client starts the router from a fixed directory of its own — usually
your home directory — and its MCP client negotiates no roots capability, so
there is no way for it to tell the router where you are working. Name the
directory yourself:
{
"mcpServers": {
"speckle": {
"command": "npx",
"args": ["-y", "@workpowers/speckle"],
"env": {
"SPECKLE_MCP_BASE_URL": "https://speckle.workpowers.ai",
"SPECKLE_MCP_KEY": "lsk_your_key_here",
"SPECKLE_MCP_WORKSPACE_ROOT": "/Users/you/code/your-repo"
}
}
}
}Without it the session still works, but it runs rootless: discovery tools only,
and it cannot tell the server anything about your checkout — so freshness stays
unknown no matter what is installed on disk. speckle-mcp doctor prints which
directory it searched.
Cloud sessions (Claude Code on the web)
A cloud session starts in a fresh container that has no user-scope
registration, and it loads MCP servers before any SessionStart hook runs, so
a hook that writes .mcp.json comes too late. Register the router from the
cloud environment's Setup script instead (claude.ai → Settings →
Environments), which runs before Claude Code launches:
#!/bin/bash
# Speckle MCP for cloud sessions. Claude Code loads MCP servers before SessionStart hooks run, so the repo hook comes too late; this runs before launch.
root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
printf '%s\n' '{"generated-by":"session-start-hook","mcpServers":{"speckle":{"command":"npx","args":["-y","@workpowers/speckle"],"env":{"SPECKLE_MCP_BASE_URL":"https://speckle.workpowers.ai","SPECKLE_MCP_KEY":"${SPECKLE_MCP_KEY}"}}}}' > "$root/.mcp.json"The same environment needs:
- the environment variable
SPECKLE_MCP_KEY=lsk_...(from/account#mcp); - network access to
speckle.workpowers.ai(package registries stay allowed, sonpxcan fetch the router).
The key is written into .mcp.json as the literal ${SPECKLE_MCP_KEY}, which
Claude Code expands when it reads the file, so the key itself never reaches
disk. The file is gitignored; the generated-by marker is kept from the retired
SessionStart hook so the file is recognisably machine-written.
Point a repo at a project
Commit a .speckle marker at the repo root:
npx -y @workpowers/speckle init --project 5The marker is committed on purpose — it is how every agent working in that checkout agrees on which project it is looking at, without any local config.
Two modes
The router boots into one of two shapes depending on what it can see:
- Bound — a
.specklemarker resolved. The session is tied to that project and is served the full toolset for it. - Coordinator — no marker (the client launched outside a Speckle repo, such as Claude Desktop). Discovery tools are registered instead, so the agent can find its way to a project first.
Keep workflow guidance current
The router observes dedicated local Speckle guidance on each tool call and
surfaces process revisions during an open session. Fetch speckle_get_workflow
before planning/resuming. The guide and the small repository bootstrap have
independent revisions; local file observations are attributed to the router,
never presented as independent server verification.
From a repository with a .speckle marker and the router environment configured:
npx -y @workpowers/speckle workflow # preview only
npx -y @workpowers/speckle workflow --apply # dedicated bootstrap + local receipt
npx -y @workpowers/speckle workflow --apply --cache # also retain an offline planning cacheReview the diff and reference SPECKLE.md from AGENTS.md or CLAUDE.md.
Reconcile old copied Speckle guidance while preserving project-specific rules.
Keep .speckle-workflow.json local (for example via Git's local exclude file).
The command refuses edited/unowned files and symlinks. No commits are made.
Unavailable live guidance is reported explicitly with any valid cache's revision
and age; a cache is never called current. Server releases carry new guidance;
restart the router after updating the router package itself.
Put the project's spec in AGENTS.md
The bootstrap above says "ask Speckle". The instructions command adds what
THIS project's spec says, for the coding tools that read AGENTS.md and never
call MCP: the project's charter and its Knowledge index (a table of contents
over every perspective with its P-code, rows and rules; no rows, never cut),
generated from confirmed main with no model and fenced between two markers.
npx -y @workpowers/speckle instructions # preview the section
npx -y @workpowers/speckle instructions --apply # write it into AGENTS.md
npx -y @workpowers/speckle instructions --apply --file CLAUDE.md --file AGENTS.mdSpeckle owns only the text between <!-- speckle:agent-instructions:begin -->
and <!-- speckle:agent-instructions:end -->. The file is created when absent,
the section appended when the file has none, and every byte outside the markers
is written back unchanged. A .speckle-instructions.json receipt beside the
file records which revision this checkout installed; keep it local. The command
refuses a section edited since that receipt rather than overwriting it, and it
is a no-op while the section is current. The section's revision is its content
hash, independent of the planning and bootstrap revisions. No commits are made.
The section is a snapshot: it is only as current as the last run. A repository
whose agents all reach Speckle over MCP does not need it — they read the
charter live with speckle_get_workflow and the index with
get_standards_brief — and Speckle's own repositories do not commit it
(I-7085). Use it for tools that cannot call Speckle.
Upload recordings
upload sends video and audio recordings to a project from the command line,
so a multi-hour recording does not need a browser tab left open:
npx -y @workpowers/speckle upload "2025-07-23 14-08-54.mkv"
npx -y @workpowers/speckle upload --project 5 --card I-42 talk.mp4 interview.m4aAccepted files: mp4, mov, mkv, webm, m4v, avi, mp3, m4a, aac, wav, flac, ogg,
opus. Files go one after another; each is hashed, then sent in parts, four at
a time. The recording date comes from an OBS-style name
(YYYY-MM-DD HH-MM-SS, read as this machine's local time), otherwise from the
file's modification time. A file that changes while it is being hashed or sent
is refused rather than uploaded half-written.
Re-running is safe. Speckle knows a file by its SHA-256: one it already has is reported as already uploaded and nothing is sent, and an interrupted upload of the same file picks up from the parts that already landed.
| Flag | Meaning |
|---|---|
| --project <id> | Project to upload to. Default: the .speckle marker's project, then SPECKLE_PROJECT_ID. Works outside any repo. |
| --card <ref> | Attach the recordings to a card, such as I-42. |
| --dry-run | Hash each file and say whether Speckle has it, has part of it, or not. Sends nothing. |
| --json | One JSON object per file on stdout (file, status, document_id, sha256, recorded_at, error), nothing else. |
Progress goes to stderr; results go to stdout. Exit codes: 0 every file is
uploaded or was already there, 1 at least one file failed, 2 a usage or
configuration problem (an unknown flag, no key, no project).
It needs SPECKLE_MCP_BASE_URL and SPECKLE_MCP_KEY. Those usually live in
your MCP client's config, which a shell or a watcher script does not see, so
export them there. From a folder watcher, call it once per new file:
export SPECKLE_MCP_BASE_URL=https://speckle.workpowers.ai SPECKLE_MCP_KEY=lsk_...
npx -y @workpowers/speckle upload --project 5 --json "$NEW_FILE" >> uploads.logYour agent setup in Claude Code and Codex
Speckle can hold your coding-agent setup (instructions, preferences, rules,
skills and memory) in layers: Speckle's own, your organisation's, yours, the
project's, and yours within the project. The setup commands deliver it into
Claude Code and Codex and report back the memory your agents write. The
Speckle plugin (plugins/speckle) runs them from its hooks; you rarely run
them by hand.
npx -y @workpowers/speckle setup sync --harness claude_code # or codex
npx -y @workpowers/speckle setup import- Your own setup goes into files every project loads. Claude Code gets one
file per item under
~/.claude/rules/speckle/and skills as~/.claude/skills/speckle-*. Codex getsdeveloper_instructionsin~/.codex/config.tomland skills as~/.agents/skills/speckle-*. - A project's own items reach a session only as its session-start context, so nothing from one organisation or project lands in another's sessions. Files written at session start are read only from the next session, so the context also carries what changed in your own setup.
- Speckle writes only what it owns. It records the hash of everything it
writes, and leaves alone (and reports) anything changed since. In
config.tomlit touchesdeveloper_instructionsand nothing else; a value that was there before Speckle is imported into your setup and backed up first. - Memory. Claude Code's memory folder is imported once. After that, the plugin's hooks report each memory an agent writes (with its session), and a sweep at session start reports changes made outside a session as yours. Codex's own memory stays off: it gets the project's memory as files in the state folder, listed in its session context.
Its own state lives in ~/.local/state/speckle (or $XDG_STATE_HOME/speckle,
or $SPECKLE_STATE_DIR).
Diagnosing
npx -y @workpowers/speckle doctorResolves the marker, the workspace, and the environment, then prints what it found. It makes no network request — it diagnoses local configuration only, which makes it the right first command when something feels off.
It also reports the agent setup: what the last syncs delivered, files Speckle
left alone because someone edited them, what Claude Code reported loading,
skills installed twice, and whether Codex trusts Speckle's hook (asked of the
local Codex app-server; Speckle never trusts a hook on your behalf). Pass
--no-setup to leave that out.
Environment
| Variable | Required | Purpose |
|---|---|---|
| SPECKLE_MCP_KEY | yes | Your API key. The only secret the router accepts. |
| SPECKLE_MCP_BASE_URL | yes | The Speckle host. A marker's own speckle_url wins over it, so a repo can point at a different host than your default. |
| SPECKLE_MCP_WORKSPACE_ROOT | no | Directory to resolve the .speckle marker from, for hosts that cannot launch the router inside your repo. Takes priority over the process working directory. |
| SPECKLE_PROJECT_ID | no | Fallback project binding for contexts with no marker. |
| SPECKLE_MCP_ALLOW_REPO_MISMATCH | no | Set to 1 to proceed when the marker's repo does not match the checkout. |
| SPECKLE_STATE_DIR | no | Where the agent-setup sync keeps its receipt and project files. |
| SPECKLE_SETUP_DISABLE | no | Set to 1 to make the plugin's hooks do nothing, for example in helper or probe sessions. |
SPECKLE_MCP_WORKSPACE_ROOT and SPECKLE_PROJECT_ID answer different
questions and do not substitute for each other. The project id says which
project a markerless session talks to; the workspace root says which
directory on disk to read. Only the second gives the router a checkout to
observe, so only the second lets it report whether your SPECKLE.md is current.
A key is scoped to one Speckle host. If the marker selects a host your
SPECKLE_MCP_BASE_URL disagrees with, the router refuses rather than sending
your key somewhere it does not belong.
Releases
Published from plugins/speckle-mcp in the Speckle monorepo by
.github/workflows/publish-router.yml, which fires when this package's
version field changes on main. It publishes over npm's OIDC trusted
publishing, so no npm token is stored anywhere in the repository.
License
MIT
