origin-mcp-server
v0.1.0
Published
Local stdio MCP server exposing an Origin project's RPML documents to coding agents.
Maintainers
Readme
origin-mcp-server
A Model Context Protocol server that gives a coding agent read access to one Origin project's RPML documents, plus an incremental "what changed since last time" feed.
It authenticates with a project-scoped API key (generated in the Origin web app under
接入 MCP on a project, or the user menu → API 密钥) and talks to the origin-mcp
Supabase Edge Function. The Supabase service-role secret never leaves the backend — this
package only ever holds the scoped key.
Run it with no install via npx -y origin-mcp-server (requires Node.js ≥ 18).
Tools
| Tool | Input | Returns |
|------|-------|---------|
| list_documents | — | Every file/folder in the project (id, name, kind, parent_id, position, updated_at). No content. |
| get_document | file_id | A single document including its full content. |
| get_changes | — | Documents changed since the last sync, each with change_type (added/modified/deleted) and latest content (null when deleted). |
Incremental sync & .origin-lock.json
get_changes reads the cursor from .origin-lock.json in the current working directory,
requests everything newer from the backend, returns it to the agent, then advances the
cursor to the new head version. So:
- First call (no lock, or
version: 0) replays the full current document set asadded. - Subsequent calls return only what changed since the previous
get_changes, including deletions.
list_documents and get_document are read-through and do not move the cursor — only
get_changes is a sync point. The lock file holds { project_id, version, hash, last_synced_at }
where hash is a SHA-256 of the last consumed change set (integrity/debugging).
Configuration
Two environment variables, supplied by your MCP client config (recommended) or a local
.env in the working directory:
ORIGIN_API_KEY=origin_... # generated in the Origin web app
ORIGIN_API_URL=https://<project-ref>.supabase.co/functions/v1/origin-mcpThe Origin web app's 接入 MCP dialog generates the key and emits a ready-to-paste config block with both values filled in.
Register with an MCP client
{
"mcpServers": {
"origin": {
"command": "npx",
"args": ["-y", "origin-mcp-server"],
"env": {
"ORIGIN_API_KEY": "origin_...",
"ORIGIN_API_URL": "https://<project-ref>.supabase.co/functions/v1/origin-mcp"
}
}
}
}Try it with the inspector
ORIGIN_API_KEY=origin_... ORIGIN_API_URL=https://<ref>.supabase.co/functions/v1/origin-mcp \
npx @modelcontextprotocol/inspector npx -y origin-mcp-serverLocal development
cd mcp-server
npm install
npm run build # → dist/
npm run dev # run from source via tsxRotating a key
Revoke or delete the key in the Origin web app (project → 接入 MCP, or user menu → API 密钥)
and generate a new one. The key is a project secret — keep .env and .origin-lock.json
out of version control (both are gitignored).
