Scrapbox Cosense
STDIOMCP server for managing and retrieving content from cosense/Scrapbox platform.
MCP server for managing and retrieving content from cosense/Scrapbox platform.
MCP server for cosense/scrapbox.
get_page
list_pages
search_pages
create_page
get_page_url
insert_lines
git clone https://github.com/worldnine/scrapbox-cosense-mcp.git cd scrapbox-cosense-mcp npm install npm run build
To use with Claude Desktop, add the server configuration as follows:
For MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
For Windows: %APPDATA%/Claude/claude_desktop_config.json
Single Project Configuration:
{ "mcpServers": { "scrapbox-cosense-mcp": { "command": "npx", "args": ["github:worldnine/scrapbox-cosense-mcp"], "env": { "COSENSE_PROJECT_NAME": "your_project_name", "COSENSE_SID": "your_sid", // Required for private projects "COSENSE_PAGE_LIMIT": "25", // Optional (default: 100) "COSENSE_SORT_METHOD": "created", // Optional (default: "updated") "SERVICE_LABEL": "scrapbox(cosense)" // Optional (default: "cosense(scrapbox)") } } } }
Once configured, you can use the tools in Claude:
# Get a specific page
Please get the content of page "Meeting Notes" using get_page.
# List recent pages
Please list the 10 most recently updated pages using list_pages.
# Search for content
Please search for pages containing "JavaScript tutorial" using search_pages.
# Create a new page
Please create a new page titled "Today's Learning" using create_page.
# Get page URL
Please get the URL for page "Project Plan" using get_page_url.
This server uses the following environment variables:
COSENSE_PROJECT_NAME
: Project nameCOSENSE_SID
: Session ID for Scrapbox/Cosense authentication (required for private projects) - See how to get this cookieAPI_DOMAIN
: API domain (default: "scrapbox.io")SERVICE_LABEL
: Service identifier (default: "cosense (scrapbox)")COSENSE_PAGE_LIMIT
: Initial page fetch limit (1-1000, default: 100)COSENSE_SORT_METHOD
: Initial page fetch order (updated/created/accessed/linked/views/title, default: updated)COSENSE_TOOL_SUFFIX
: Tool name suffix for multiple server instances (e.g., "main" creates "get_page_main")COSENSE_CONVERT_NUMBERED_LISTS
: Convert numbered lists to bullet lists in Markdown (true/false, default: false)For accessing private Scrapbox projects, you need to obtain the connect.sid
cookie from your browser. Follow these steps:
Navigate to your Scrapbox project
https://scrapbox.io/YOUR_PROJECT_NAME
YOUR_PROJECT_NAME
with your actual project nameLog in to Scrapbox
Open Developer Tools
F12
or Ctrl+Shift+I
Cmd+Option+I
Navigate to Cookies
https://scrapbox.io
Find and copy the connect.sid cookie
connect.sid
s%3Axxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
s:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(note the :
after s
)Set the environment variable
:
instead of %3A
) as your COSENSE_SID
environment variableCOSENSE_SID=s:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
COSENSE_SID=s%3Axxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Important Notes:
connect.sid
cookie value secure and never share it publiclyAll tools support an optional projectName
parameter to target different projects from a single server:
COSENSE_PROJECT_NAME
environment variable when no project is specifiedprojectName
parameter to access different projectsUsage Examples:
# Get page from default project
Please get the content of page "Meeting Notes" using get_page.
# Get page from specific project
Please get the content of page "Design Guidelines" from project "help-ja" using get_page.
# Search in different project
Please search for pages containing "API documentation" in project "developer-docs" using search_pages.
# Create page in specific project
Please create a new page titled "Weekly Report" in project "team-updates" using create_page.
Important Limitations:
This approach works best with public projects or projects that share the same authentication. For multiple private projects with different access credentials, use Method 2 below.
For best user experience with multiple private projects, run separate MCP server instances for each project:
{ "mcpServers": { "main-scrapbox": { "command": "npx", "args": ["github:worldnine/scrapbox-cosense-mcp"], "env": { "COSENSE_PROJECT_NAME": "main-project", // Actual project name for API calls "COSENSE_SID": "s:main_sid_here...", // Session ID for this project "COSENSE_TOOL_SUFFIX": "main", // Creates tools like get_page_main "SERVICE_LABEL": "Main Scrapbox" // Human-readable label in tool descriptions } }, "team-cosense": { "command": "npx", "args": ["github:worldnine/scrapbox-cosense-mcp"], "env": { "COSENSE_PROJECT_NAME": "team-workspace", // Actual project name for API calls "COSENSE_SID": "s:team_sid_here...", // Session ID for this project "COSENSE_TOOL_SUFFIX": "team", // Creates tools like get_page_team "SERVICE_LABEL": "Team Cosense" // Human-readable label in tool descriptions } } } }
Key Configuration Points:
scrapbox.io/main-project
)get_page_main
and get_page_team
This creates tools like get_page_main
, list_pages_main
, get_page_team
, list_pages_team
, allowing LLMs to automatically select the appropriate project.
Install dependencies:
npm install
Build the server:
npm run build
Auto-rebuild during development:
npm run watch
Run tests:
npm test
Run linting:
npm run lint
This project includes automated quality checks to ensure code reliability:
npm run lint
and npm test
locallyThe quality management system prevents debug logs and broken code from reaching production.
Since MCP servers communicate via stdio, debugging can be challenging. This server includes comprehensive debug logging to help troubleshoot issues.
The server outputs detailed debug information to help identify configuration and API issues:
Using MCP Inspector is recommended for interactive debugging:
npm run inspector
The Inspector provides a URL to access debugging tools in the browser.
When running multiple server instances, check the debug logs for:
COSENSE_TOOL_SUFFIX
is set differently for each servercosense/scrapbox 用のMCPサーバーです。
get_page
list_pages
search_pages
create_page
get_page_url
insert_lines
git clone https://github.com/worldnine/scrapbox-cosense-mcp.git cd scrapbox-cosense-mcp npm install npm run build
Claude Desktopで使用するには、以下のようにサーバー設定を追加してください:
MacOSの場合: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windowsの場合: %APPDATA%/Claude/claude_desktop_config.json
単一プロジェクト設定:
{ "mcpServers": { "scrapbox-cosense-mcp": { "command": "npx", "args": ["github:worldnine/scrapbox-cosense-mcp"], "env": { "COSENSE_PROJECT_NAME": "your_project_name", "COSENSE_SID": "your_sid", // プライベートプロジェクトの場合は必須 "COSENSE_PAGE_LIMIT": "25", // オプション(デフォルト: 100) "COSENSE_SORT_METHOD": "created", // オプション(デフォルト: "updated") "SERVICE_LABEL": "scrapbox(cosense)" // オプション(デフォルト: "cosense(scrapbox)") } } } }
設定完了後、Claudeで以下のようにツールを使用できます:
# 特定のページを取得
get_page を使用してページ「会議メモ」の内容を取得してください。
# 最近のページ一覧
list_pages を使用して最近更新された10件のページを一覧表示してください。
# コンテンツ検索
search_pages を使用して「JavaScript チュートリアル」を含むページを検索してください。
# 新しいページを作成
create_page を使用して「今日の学び」というタイトルでページを作成してください。
# ページURLを取得
get_page_url を使用してページ「プロジェクト計画」のURLを取得してください。
このサーバーは以下の環境変数を使用します:
COSENSE_PROJECT_NAME
: プロジェクト名COSENSE_SID
: Scrapbox/Cosenseの認証用セッションID(プライベートプロジェクトの場合は必須) - Cookieの取得方法API_DOMAIN
: APIドメイン(デフォルト: "scrapbox.io")SERVICE_LABEL
: サービスの識別名(デフォルト: "cosense (scrapbox)")COSENSE_PAGE_LIMIT
: 初期取得時のページ数(1-1000、デフォルト: 100)COSENSE_SORT_METHOD
: 初期取得時の取得ページ順(updated/created/accessed/linked/views/title、デフォルト: updated)COSENSE_TOOL_SUFFIX
: 複数サーバーインスタンス用のツール名サフィックス(例:"main"で"get_page_main"が作成されます)プライベートなScrapboxプロジェクトにアクセスするには、ブラウザから connect.sid
Cookieを取得する必要があります。以下の手順に従ってください:
Scrapboxプロジェクトにアクセス
https://scrapbox.io/あなたのプロジェクト名
を開きますあなたのプロジェクト名
を実際のプロジェクト名に置き換えてくださいScrapboxにログイン
開発者ツールを開く
F12
キーまたは Ctrl+Shift+I
を押しますCmd+Option+I
を押しますCookieを確認
https://scrapbox.io
をクリックしますconnect.sid Cookieを見つけてコピー
connect.sid
という名前のCookieを探しますs%3Axxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
s:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(s
の後は:
です)環境変数に設定
%3A
の代わりに:
)を COSENSE_SID
環境変数として使用しますCOSENSE_SID=s:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
COSENSE_SID=s%3Axxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
重要な注意事項:
connect.sid
Cookieの値は機密情報のため、安全に管理し、公開しないでくださいすべてのツールで、単一サーバーから異なるプロジェクトを対象とするオプションのprojectName
パラメータをサポートしています:
COSENSE_PROJECT_NAME
環境変数を使用projectName
パラメータを指定して異なるプロジェクトにアクセス使用例:
# デフォルトプロジェクトからページを取得
get_page を使用してページ「会議メモ」の内容を取得してください。
# 特定のプロジェクトからページを取得
get_page を使用して、プロジェクト名「help-ja」からページ「使い方」の内容を取得してください。
# 異なるプロジェクトでページを検索
search_pages を使用して、プロジェクト名「developer-docs」で「API ドキュメント」を含むページを検索してください。
# 特定のプロジェクトにページを作成
create_page を使用して、プロジェクト名「team-updates」に「週次レポート」というタイトルでページを作成してください。
重要な制限事項:
この方法は、パブリックプロジェクトや同じ認証情報を共有するプロジェクトで最も効果的です。異なるアクセス認証情報を持つ複数のプライベートプロジェクトには、以下の方法2をご利用ください。
複数のプライベートプロジェクトで最良のユーザー体験を得るには、プロジェクトごとに別々のMCPサーバーインスタンスを実行します:
{ "mcpServers": { "main-scrapbox": { "command": "npx", "args": ["github:worldnine/scrapbox-cosense-mcp"], "env": { "COSENSE_PROJECT_NAME": "main-project", // API呼び出しで使用される実際のプロジェクト名 "COSENSE_SID": "s:main_sid_here...", // このプロジェクト用のセッションID "COSENSE_TOOL_SUFFIX": "main", // get_page_main のようなツール名を作成 "SERVICE_LABEL": "Main Scrapbox" // ツール説明で表示される人間向けの名前 } }, "team-cosense": { "command": "npx", "args": ["github:worldnine/scrapbox-cosense-mcp"], "env": { "COSENSE_PROJECT_NAME": "team-workspace", // API呼び出しで使用される実際のプロジェクト名 "COSENSE_SID": "s:team_sid_here...", // このプロジェクト用のセッションID "COSENSE_TOOL_SUFFIX": "team", // get_page_team のようなツール名を作成 "SERVICE_LABEL": "Team Cosense" // ツール説明で表示される人間向けの名前 } } } }
設定のポイント:
scrapbox.io/main-project
)get_page_main
や get_page_team
のような固有のツール名を作成これにより get_page_main
、list_pages_main
、get_page_team
、list_pages_team
のようなツールが作成され、LLMが自動的に適切なプロジェクトを選択できるようになります。
依存関係のインストール:
npm install
サーバーのビルド:
npm run build
開発時の自動リビルド:
npm run watch
テストの実行:
npm test
リンティングの実行:
npm run lint
このプロジェクトでは、コードの信頼性を確保するための自動品質チェックが導入されています:
npm run lint
と npm test
を実行この品質管理システムにより、デバッグログや壊れたコードの本番環境への混入を防げます。
MCPサーバーはstdioを介して通信を行うため、デバッグが難しい場合があります。MCP Inspectorの使用を推奨します。以下のコマンドで実行できます:
npm run inspector
InspectorはブラウザでデバッグツールにアクセスするためのURLを提供します。