Logo: scrapbox-cosense-mcp

scrapbox-cosense-mcp

Communautéit
worldnine

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.

Editeurworldnine
Repositoryscrapbox-cosense-mcp
SproochTypeScript
Forks
19
Stären
52
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    scrapbox-cosense-mcp bitt MCP-Funktiounen un, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • Disponibel Tools: 0

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an deem MCP-Client ze konfiguréieren, deen Dir am léifste benotzt.

  • Interessi vun der Communautéit um Open-Source-Projet

    Zuele vum verlinkte Repository – Stären: 52, Forks: 19.

scrapbox-cosense-mcp

日本語ドキュメント / Japanese

Overview

MCP server for Cosense (formerly Scrapbox).

ToolDescriptionAuth Required
get_pageGet page content, metadata, and linksFor private projects
list_pagesBrowse pages with sorting and pagination (max 1000)For private projects
search_pagesFull-text search with keyword highlighting (max 100 results)For private projects
create_pageCreate a page via WebSocket API with Markdown/Scrapbox bodyYes
get_page_urlGenerate direct URL for a pageNo
insert_linesInsert text after a specified line in a pageYes
edit_linesReplace exact-match line(s), including a multi-line block (first match, or all with matchAll)Yes
delete_linesDelete exact-match line(s), including a multi-line block (first match, or all with matchAll)Yes
delete_pageDelete a page by emptying every line — opt-in, see belowYes
rewrite_pageReplace a page's entire content — opt-in, see belowYes
get_smart_contextGet a page and its linked pages (1-hop/2-hop) in AI-optimized formatYes

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-in

delete_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 empties every one of a page's lines, and Cosense removes a page once all of its lines are empty. There is no undo. Two further guards are built in:

  • The page must already exist. A missing page returns an error rather than a silent success. (The REST API returns a title line even for a page that was never created, so the check looks at 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 projects

Every tool accepts a projectName override, which is how one server serves several projects. 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:

  • The page must already exist — the persistent check is inverted relative to create_page, so a typo cannot silently create a new page.
  • Empty content is rejected — removing a page is delete_page's job.
  • dryRun: true reports the before/after line counts and previews without touching the page.

When you run several instances of this server for different projects, set the variable on each instance that should be allowed to delete:

json
{
  "mcpServers": {
    "cosense-notes": {
      "command": "npx",
      "args": ["-y", "scrapbox-cosense-mcp"],
      "env": {
        "COSENSE_PROJECT_NAME": "notes",
        "COSENSE_SID": "s:your-session-id",
        "COSENSE_TOOL_SUFFIX": "notes",
        "COSENSE_ENABLE_DELETE": "true"
      }
    },
    "cosense-archive": {
      "command": "npx",
      "args": ["-y", "scrapbox-cosense-mcp"],
      "env": {
        "COSENSE_PROJECT_NAME": "archive",
        "COSENSE_SID": "s:your-session-id",
        "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.

Quick Start

Desktop Extension (.mcpb) — Easiest

  1. Download scrapbox-cosense-mcp.mcpb from GitHub Releases
  2. Double-click — Claude Desktop opens an install dialog
  3. Enter your project name (and Session ID for private projects)

Claude Code Plugin

  1. Add the marketplace:
    /plugin marketplace add worldnine/scrapbox-cosense-mcp
  2. Install the plugin:
    /plugin install scrapbox-cosense@worldnine-scrapbox-cosense-mcp
    Installs globally by default. Use --scope project or --scope local for other scopes.
  3. Set environment variables in your settings file:
    json
    {
      "env": {
        "COSENSE_PROJECT_NAME": "your_project_name",
        "COSENSE_SID": "your_sid"
      }
    }
    FileScope
    ~/.claude/settings.jsonAll projects (global)
    .claude/settings.local.jsonThis project only (gitignored)

The plugin includes MCP server configuration and a /cosense skill for CLI operations.

Claude Code (Manual MCP Setup)

If you prefer manual configuration over the plugin:

bash
claude mcp add scrapbox-cosense-mcp \
  -e COSENSE_PROJECT_NAME=your_project \
  -e COSENSE_SID=your_sid \
  -- npx -y scrapbox-cosense-mcp

Claude Desktop / Other MCP Clients

Add to your config file:

ClientConfig File
Claude Desktop (macOS)~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows)%APPDATA%/Claude/claude_desktop_config.json
Cursor.cursor/mcp.json (project root)
Windsurf~/.codeium/windsurf/mcp_config.json
json
{
  "mcpServers": {
    "scrapbox-cosense-mcp": {
      "command": "npx",
      "args": ["-y", "scrapbox-cosense-mcp"],
      "env": {
        "COSENSE_PROJECT_NAME": "your_project_name",
        "COSENSE_SID": "your_sid"
      }
    }
  }
}

Build from Source

bash
git clone https://github.com/worldnine/scrapbox-cosense-mcp.git
cd scrapbox-cosense-mcp
npm install && npm run build

Configuration

Required

VariableDescription
COSENSE_PROJECT_NAMEYour Scrapbox/Cosense project name
COSENSE_SIDSession ID (connect.sid cookie) for private projects — How to get it

Optional

VariableDefaultDescription
API_DOMAINscrapbox.ioAPI domain
SERVICE_LABELcosense (scrapbox)Display name in tool descriptions
COSENSE_PAGE_LIMIT100Initial page fetch limit (1–1000)
COSENSE_SORT_METHODupdatedInitial sort: updated, created, accessed, linked, views, title
COSENSE_TOOL_SUFFIX—Tool name suffix for multiple instances (e.g. main → get_page_main)
COSENSE_CONVERT_NUMBERED_LISTSfalseConvert numbered lists to bullet lists in Markdown conversion
COSENSE_EXCLUDE_PINNEDfalseExclude pinned pages from initial resource list
COSENSE_ENABLE_DELETEfalseRegister the delete_page and rewrite_page tools (and the delete / rewrite CLI commands). Without it, none are available
COSENSE_PROJECT_ALLOW_LIST—Comma-separated project names that projectName / --project may target. COSENSE_PROJECT_NAME is always allowed. Unset means no restriction; set to an empty value means the default project only

CLI Usage

The same binary also works as a standalone CLI:

bash
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"
FlagDescription
--compactToken-efficient compact output (recommended for AI agents)
--project=NAMEOverride project name
--jsonOutput as JSON
--helpShow help (supports <command> --help for details)

Multiple Projects

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.

Development

CommandDescription
npm run buildBuild (TypeScript → JavaScript)
npm run watchAuto-rebuild during development
npm testRun test suite
npm run lintRun ESLint
npm run inspectorDebug with MCP Inspector

Contributing

  1. Create a feature branch from main
  2. Add tests for your changes
  3. Run npm run lint && npm test
  4. Create a pull request — CI runs automatically

License

MIT


MseeP.ai Security Assessment Badge

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "worldnine-scrapbox-cosense-mcp": {
      "command": "",
      "args": []
    }
  }
}

scrapbox-cosense-mcp MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal scrapbox-cosense-mcp verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung, fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector: D'Optioun „Dësen Apparat“ ass ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Setzt de kopéierte Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

scrapbox-cosense-mcp als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a setzt d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Setzt d'MCP-Serverkonfiguratioun fir scrapbox-cosense-mcp an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert d'Säit, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "worldnine-scrapbox-cosense-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "scrapbox-cosense-mcp"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vun der Integratioun scrapbox-cosense-mcp. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vun der Integratioun scrapbox-cosense-mcp.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierten MCP-Tools an engem ausgewielte KI-Modell
Kënnt Dir mir mat scrapbox-cosense-mcp bei dëser Aufgab hëllefen?
scrapbox-cosense-mcp
Jo. Ech hunn et gelies.
Dat hunn ech mat scrapbox-cosense-mcp fonnt.

Heefeg gestallte Froen

Fir wat gëtt den MCP-Server scrapbox-cosense-mcp benotzt?

scrapbox-cosense-mcp ass en MCP-Server, deen et kompatibele KI-Clienten erlaabt, op extern Tools a Kontextinformatioune zouzegräifen. An TypingMind kënnt Dir dësen MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech scrapbox-cosense-mcp MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir scrapbox-cosense-mcp mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni den MCP-Server fir all Modell separat anzeriichten.

Firwat scrapbox-cosense-mcp MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann scrapbox-cosense-mcp verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Ären Aarbechtsoflaf beim Chatten an TypingMind organiséieren.

Wéi verbannen ech scrapbox-cosense-mcp MCP mat TypingMind?

scrapbox-cosense-mcp leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann den MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt scrapbox-cosense-mcp MCP an TypingMind zur Verfügung?

scrapbox-cosense-mcp stellt MCP-Funktioune zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agente zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir scrapbox-cosense-mcp MCP ze benotzen?

Nee. TypingMind ass nom Local-first-Prinzip opgebaut a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann scrapbox-cosense-mcp eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir deen MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇