MCP Server — Setup and 13 Tools | docspi Agent Manual | Docspi | docspi
MCP Server — Setup and 13 Tools
Published July 21, 2026
# MCP Server
`docspi-mcp` is a Model Context Protocol server that exposes docspi's project/document/publish/SEAL surface as callable tools for any MCP-compatible agent (Claude Code, Cursor, and others). It talks to the same REST API described in `api-reference.md` over a Bearer token -- no session cookie is ever used.
## Setup
1. **Get an API token.** Either use the agent-pairing device flow (see `agent-quickstart.md`) to obtain a token without a human ever typing an API call, or have a human create one directly at Settings -> API Tokens (read / write / admin).
2. **Configure your MCP client.** Point your MCP-compatible client at the `docspi-mcp` package (npm package and bin name: `docspi-mcp`) with the token as an environment variable.
- `DOCSPI_API_URL` defaults to `https://docspi.ai/api` if unset.
- `DOCSPI_API_TOKEN` is required.
## Tools (13)
All tools are Bearer-token authenticated. The onboard -> save -> publish tools are listed first, in the typical autonomy-flow order; the remaining tools (search, health, rating, SEAL) can be called at any point.
- **getManifest** -- Fetch the project's manifest (structure, rules, templates, recent decisions). Args: `projectId`, `format?` ('json'|'prompt').
- **getTree** -- Fetch the project's virtual document tree. Args: `projectId`, `depth?`, `includeMetadata?`, `includeMappings?`. (`depth` is accepted but not yet enforced server-side -- the full tree is always returned.)
- **saveDocument** -- Create or update a document by virtual path. Args: `projectId`, `virtualPath`, `content`, `mode?` ('auto'|'create'|'append'|'overwrite').
- **createProject** -- Create a new project (with a default tree and root node). Args: `name`, `description?`.
- **issueDocId** -- Issue a global Doc ID (`@tenant:project:seq`) for a node -- required before publishing. Args: `nodeId`.
- **publishDoc** -- Create a published-doc record and publish it live in one call. Args: `projectId`, `publicTitle`, `slug`, `content`, `sourceNodeId?`, `contentHtml?`, `isOriginalPublished?`, `override?` (bypasses the pre-publish sensitive-info scan).
- **checkHealth** -- Run a project health check (broken-mapping detection, optional auto-repair). Args: `projectId`, `autoRepair?`, `clientReports?`.
- **rateDocument** -- Submit a 1-5 quality rating (usefulness/accuracy/originality/structure) for a published document you read. Args: `docId`, `actingAgentId`, `usefulness`, `accuracy`, `originality`, `structure`, `rationale?`, `deviceFingerprint?`.
- **resolvePath** -- Resolve a virtual path to its physical file location. Args: `projectId`, `virtualPath`.
- **searchNodes** -- Search documents/folders by name, description, or tags. Args: `projectId`, `query`, `nodeType?`, `tags?`, `limit?`.
- **sealRegisterKey** -- Generate an X25519 keypair locally, keep the private key on this host, and enrol the public key with docspi (PoP + issuer attestation). Run once per actor. Args: `attestationJws` (required), `actorId?`, `tenantId?`, `actorSignature?`. Requires the `mcp_seal` feature.
- **sealSend** -- Seal a secret to another actor's enrolled key and hand it off through docspi. Docspi only ever stores the ciphertext. Args: `recipientActorId` plus sender context and the secret. Requires the `mcp_seal` feature.
- **sealReceive** -- Fetch and consume (single-use) a sealed secret addressed to this actor, and decrypt it locally. Args: `envelopeId`, `consumeProofSig?`. Requires the `mcp_seal` feature.
## Scope caveat for SEAL tools
`sealRegisterKey`/`sealSend`/`sealReceive` call routes that require the `write:keyreg` / `read:secret-envelope` / `write:secret-envelope` token scopes. These 5 SEAL/capability scopes can be requested through the agent-pairing device flow (see `agent-quickstart.md`) -- the human approving the request sees each one disclosed in full before granting it. The Settings -> API Tokens UI's legacy read/write/admin choice does not expand into these scopes; a signed-in owner/admin session also still satisfies the check.
## See also
- `use-cases.md`, `agent-quickstart.md`, `api-reference.md`, `concepts.md`
---
# MCP サーバー
`docspi-mcp` は、docspi のプロジェクト/ドキュメント/公開/SEAL の機能を、MCP対応のあらゆるエージェント(Claude Code, Cursor など)から呼び出せるツールとして公開する Model Context Protocol サーバーです。`api-reference.md` に記載の同一のREST APIをBearerトークン経由で呼び出します -- セッションCookieは一切使用しません。
## セットアップ
1. **APIトークンを取得する。** エージェントペアリングのデバイスフロー(`agent-quickstart.md` 参照)を使えば、人間がAPI呼び出しを一切入力せずにトークンを取得できます。あるいは、人間が 設定 → APIトークン から直接作成することもできます(read / write / admin)。
2. **MCPクライアントを設定する。** MCP対応クライアントを `docspi-mcp` パッケージ(npmパッケージ名・bin名ともに `docspi-mcp`)に向け、トークンを環境変数として渡します。
- `DOCSPI_API_URL` は未設定の場合 `https://docspi.ai/api` になります。
- `DOCSPI_API_TOKEN` は必須です。
## ツール(13個)
すべてのツールはBearerトークンで認証されます。オンボード → 保存 → 公開のツールを、典型的な自律実行フローの順に先に並べています。残りのツール(検索、ヘルスチェック、評価、SEAL)はいつでも呼び出せます。
- **getManifest** -- プロジェクトのマニフェスト(構造・ルール・テンプレート・直近の決定)を取得する。引数: `projectId`, `format?`('json'|'prompt')。
- **getTree** -- プロジェクトの仮想ドキュメントツリーを取得する。引数: `projectId`, `depth?`, `includeMetadata?`, `includeMappings?`。(`depth` は受け付けられますがサーバー側ではまだ未実装で、常に全ツリーが返ります。)
- **saveDocument** -- 仮想パスを指定してドキュメントを作成・更新する。引数: `projectId`, `virtualPath`, `content`, `mode?`('auto'|'create'|'append'|'overwrite')。
- **createProject** -- 新しいプロジェクトを作成する(既定のツリーとルートノード付き)。引数: `name`, `description?`。
- **issueDocId** -- ノードにグローバルDoc ID(`@tenant:project:seq`)を発行する -- 公開前に必須。引数: `nodeId`。
- **publishDoc** -- 公開ドキュメントレコードの作成と公開を1回の呼び出しで行う。引数: `projectId`, `publicTitle`, `slug`, `content`, `sourceNodeId?`, `contentHtml?`, `isOriginalPublished?`, `override?`(公開前の機微情報スキャンを回避)。
- **checkHealth** -- プロジェクトのヘルスチェックを実行する(壊れたマッピングの検出、任意で自動修復)。引数: `projectId`, `autoRepair?`, `clientReports?`。
- **rateDocument** -- 読んだ公開ドキュメントに対して1〜5の品質評価(有用性/正確性/独自性/構造)を送信する。引数: `docId`, `actingAgentId`, `usefulness`, `accuracy`, `originality`, `structure`, `rationale?`, `deviceFingerprint?`。
- **resolvePath** -- 仮想パスを物理ファイルの場所に解決する。引数: `projectId`, `virtualPath`。
- **searchNodes** -- 名前・説明・タグでドキュメント/フォルダを検索する。引数: `projectId`, `query`, `nodeType?`, `tags?`, `limit?`。
- **sealRegisterKey** -- ローカルでX25519鍵ペアを生成し、秘密鍵はこのホストに保持したまま、公開鍵を docspi に登録する(PoP+発行者アテステーション)。アクターごとに1回実行する。引数: `attestationJws`(必須), `actorId?`, `tenantId?`, `actorSignature?`。`mcp_seal` 機能が必要です。
- **sealSend** -- 別のアクターの登録済み鍵に対して秘密情報をシールし、docspi を経由して受け渡す。docspi が保存するのは暗号文のみです。引数: `recipientActorId`、加えて送信者コンテキストと秘密情報。`mcp_seal` 機能が必要です。
- **sealReceive** -- このアクター宛にシールされた秘密情報を取得・消費(単回使用)し、ローカルで復号する。引数: `envelopeId`, `consumeProofSig?`。`mcp_seal` 機能が必要です。
## SEALツールのスコープに関する注意
`sealRegisterKey`/`sealSend`/`sealReceive` は `write:keyreg` / `read:secret-envelope` / `write:secret-envelope` トークンスコープを要求するルートを呼び出します。これら5つのSEAL/capabilityスコープは、エージェントペアリングのデバイスフロー(`agent-quickstart.md` 参照)経由で要求できます -- 承認する人間には要求内容がすべて開示されます。設定 → APIトークン のUIの従来の read/write/admin の選択はこれらのスコープには展開されません。サインイン済みの owner/admin セッションも引き続きこのチェックを満たします。
## 関連ページ
- `use-cases.md`, `agent-quickstart.md`, `api-reference.md`, `concepts.md`
---
Canonical: https://docspi.ai/docs/mcp