scrapbox-cosense-mcp
Overview
MCP server for Cosense (formerly Scrapbox).
接入你的智能体
从发布者处安装。不是 PlugMCP 端点。
远程 URL 还是本机命令? 两种安装方式的区别
来自发布者
MCP server for Cosense (formerly Scrapbox).
MCP server for Cosense (Scrapbox) — read, search, create, and edit wiki pages from Claude and other AI agents. Also works as a CLI and Claude Code plugin.
create_page, insert_lines, edit_lines, and rewrite_page support a format parameter ("markdown" or "scrapbox") to control content conversion.
edit_lines replaces only the first matching line by default. Set matchAll: true to replace every occurrence. The default is deliberately conservative: a line such as a bullet marker or a blank line can repeat many times in a page, and replacing all of them at once is rarely what the caller intended.
targetLineText may contain newlines to match a contiguous block of lines. The block is replaced as a whole, so n lines can become m lines (for example, collapsing several lines into one). Block matches with matchAll: true are non-overlapping.
delete_lines uses the same exact-match (and block) semantics but removes the matched lines instead of replacing them. It refuses to delete the title line (the first line), because that would rename or remove the page itself — use delete_page for that.
delete_page and rewrite_page are opt-indelete_page and rewrite_page are not registered unless COSENSE_ENABLE_DELETE=true is set. Without it neither tool appears in the tool list at all, so an agent cannot call them even by mistake. This server is often added to a shared MCP configuration, so whole-page destruction is exposed only to those who deliberately turn it on.
The reasoning: insert_lines, edit_lines, and delete_lines all require an exact match, which is only possible if the caller has actually read the page — they can only destroy lines they already know. delete_page and rewrite_page act on the entire page regardless of whether the caller has read it, so they get a separate opt-in gate.
delete_page removes the whole page. There is no undo. Two further guards are built in:
persistent, the same way create_page does.)dryRun: true reports how many lines would be removed and shows the first five of them, without touching the page.COSENSE_PROJECT_ALLOW_LIST limits reachable projectsEvery tool accepts a projectName override, which is how one server serves several projects. A credential (a Personal Access Token or a session ID) often reaches more projects than the default one, so without a limit an agent that names the wrong project can read or write there. COSENSE_PROJECT_ALLOW_LIST is the opt-in fence: when set, only the listed projects and COSENSE_PROJECT_NAME are accepted, and anything else fails before a request is sent. Names are matched exactly, including case, so a spelling variant cannot slip through. Setting the variable to an empty value restricts to the default project alone. Unset keeps the old unrestricted behavior.
rewrite_page replaces a page's entire content (the title is preserved as the first line). It has the same guards, plus two of its own:
persistent check is inverted relative to create_page, so a typo cannot silently create a new page.delete_page's job.dryRun: true reports the before/after line counts and previews without touching the page.rewrite_page replaces the whole page. If another edit lands while a rewrite is in flight, the rewrite re-applies on the 409 retry and the concurrent edit is lost silently.
When you run several instances of this server for different projects, set the variable on each instance that should be allowed to delete:
{
"mcpServers": {
"cosense-notes": {
"command": "npx",
"args": ["-y", "scrapbox-cosense-mcp"],
"env": {
"COSENSE_PROJECT_NAME": "notes",
"COSENSE_MCP_PAT": "your-personal-access-token",
"COSENSE_TOOL_SUFFIX": "notes",
"COSENSE_ENABLE_DELETE": "true"
}
},
"cosense-archive": {
"command": "npx",
"args": ["-y", "scrapbox-cosense-mcp"],
"env": {
"COSENSE_PROJECT_NAME": "archive",
"COSENSE_MCP_PAT": "your-personal-access-token",
"COSENSE_TOOL_SUFFIX": "archive"
}
}
}
}
Here the notes instance exposes delete_page_notes, while the archive instance exposes no deletion tool at all.
Note that insert_lines and edit_lines behave differently when the target line is absent. insert_lines appends to the end of the page, because "add this text somewhere" still has a reasonable outcome. edit_lines returns an error and leaves the page untouched, because "replace this specific line" has no meaningful fallback — appending the replacement would silently produce a page the caller never asked for.
scrapbox-cosense-mcp.mcpb from GitHub Releases/plugin marketplace add worldnine/scrapbox-cosense-mcp
/plugin install scrapbox-cosense@worldnine-scrapbox-cosense-mcp
Installs globally by default. Use --scope project or --scope local for other scopes.{
"env": {
"COSENSE_PROJECT_NAME": "your_project_name",
"COSENSE_MCP_PAT": "your_personal_access_token"
}
}
The plugin includes MCP server configuration and a /cosense skill for CLI operations.
If you prefer manual configuration over the plugin:
claude mcp add scrapbox-cosense-mcp \
-e COSENSE_PROJECT_NAME=your_project \
-e COSENSE_MCP_PAT=your_personal_access_token \
-- npx -y scrapbox-cosense-mcp
Add to your config file:
{
"mcpServers": {
"scrapbox-cosense-mcp": {
"command": "npx",
"args": ["-y", "scrapbox-cosense-mcp"],
"env": {
"COSENSE_PROJECT_NAME": "your_project_name",
"COSENSE_MCP_PAT": "your_personal_access_token"
}
}
}
}
git clone https://github.com/worldnine/scrapbox-cosense-mcp.git
cd scrapbox-cosense-mcp
npm install && npm run build
Public projects can be read without a credential. Private projects, editing, and get_smart_context need one — see Authentication.
A Service Account access key (Business plan, starts with cs_) also goes in COSENSE_MCP_PAT.
The same binary also works as a standalone CLI:
scrapbox-cosense-mcp get "Page Title"
scrapbox-cosense-mcp search "keyword"
scrapbox-cosense-mcp list --sort=updated --limit=20
scrapbox-cosense-mcp create "New Page" --body="Markdown content"
scrapbox-cosense-mcp insert "Page" --after="target line" --text="new text"
scrapbox-cosense-mcp edit "Page" --target="old line" --text="new text"
scrapbox-cosense-mcp delete-lines "Page" --target="old line"
scrapbox-cosense-mcp delete "Page" --dry-run # needs COSENSE_ENABLE_DELETE=true
scrapbox-cosense-mcp rewrite "Page" --body="new content" --dry-run # needs COSENSE_ENABLE_DELETE=true
scrapbox-cosense-mcp url "Page Title"
All tools accept an optional projectName parameter to target a different project from a single server. For multiple private projects with different credentials, run separate server instances with COSENSE_TOOL_SUFFIX.
To limit which projects an agent can reach, set COSENSE_PROJECT_ALLOW_LIST (comma-separated). Requests naming any other project are rejected before any API call, and the error lists the permitted projects. Matching is case-sensitive.
See docs/multiple-projects.md for detailed configuration examples.
mainnpm run lint && npm testThanks to everyone who has contributed to this project:
get_page, JSR dependency resolution (#20)format parameter, bare URL doubling fix (#29)edit_lines, opt-in delete_page (#52, #57)COSENSE_PROJECT_ALLOW_LIST (#68)The full list is on the contributors graph.
MIT
MCP server for Cosense (Scrapbox) — read, search, create, and edit wiki pages from Claude and other AI agents. Also works as a CLI and Claude Code plugin.
工具
暂无工具列表。远程服务器在首次健康检查后会获得工具列表。
常见问题
在本页复制适用于 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 配置。它使用发布者的安装方式,而不是 PlugMCP 代理。
此记录未列出必需的环境变量。
Scrapbox Cosense 通过 stdio 在本地运行。
上次检查时间:2026-11-15。 MCP server for Cosense (Scrapbox) — read, search, create, and edit wiki pages from Claude and other AI agents. Also works as a CLI and Claude Code plugin.