Skip to main content
Glama
Scrapbox Cosense MCP Server

Scrapbox Cosense MCP Server

scrapbox-cosense-mcp

日本語ドキュメント / Japanese

개요

Cosense(이전 Scrapbox)용 MCP 서버입니다.

도구

설명

인증 필요

get_page

페이지 콘텐츠, 메타데이터 및 링크 가져오기

비공개 프로젝트의 경우

list_pages

페이지 정렬 및 페이지네이션으로 탐색(최대 1000개)

비공개 프로젝트의 경우

search_pages

키워드 하이라이트가 포함된 전체 텍스트 검색(최대 100개 결과)

비공개 프로젝트의 경우

create_page

WebSocket API를 통해 Markdown/Scrapbox 본문으로 페이지 생성

예

get_page_url

페이지의 직접 URL 생성

아니요

insert_lines

페이지의 지정된 줄 뒤에 텍스트 삽입

예

edit_lines

정확히 일치하는 줄(들)을 교체하며, 여러 줄 블록 포함(matchAll 사용 시 첫 번째 일치 또는 전체)

예

delete_lines

정확히 일치하는 줄(들)을 삭제하며, 여러 줄 블록 포함(matchAll 사용 시 첫 번째 일치 또는 전체)

예

delete_page

모든 줄을 비워 페이지 삭제 — 옵트인(opt-in), 아래 참조

예

rewrite_page

페이지의 전체 콘텐츠 교체 — 옵트인(opt-in), 아래 참조

예

get_smart_context

페이지와 연결된 페이지(1-hop/2-hop)를 AI 최적화 형식으로 가져오기

예

create_page, insert_lines, edit_lines, rewrite_page는 콘텐츠 변환을 제어하는 format 매개변수("markdown" 또는 "scrapbox")를 지원합니다.

edit_lines는 기본적으로 첫 번째 일치 줄만 교체합니다. matchAll: true로 설정하면 모든 항목을 교체합니다. 기본값은 의도적으로 보수적입니다. 글머리 기호나 빈 줄 같은 줄은 페이지에서 여러 번 반복될 수 있으며, 한 번에 모두 교체하는 경우는 호출자가 의도한 경우가 드물기 때문입니다.

targetLineText는 연속된 여러 줄 블록을 매칭하기 위해 줄바꿈을 포함할 수 있습니다. 블록은 전체적으로 교체되므로 n개 줄이 m개 줄이 될 수 있습니다(예: 여러 줄을 한 줄로 축소). matchAll: true를 사용한 블록 매칭은 겹치지 않습니다.

delete_lines는 동일한 정확히 일치(및 블록) 의미를 사용하지만, 교체 대신 일치하는 줄을 제거합니다. 제목 줄(첫 번째 줄)을 삭제하는 것은 거부합니다. 제목 줄을 삭제하면 페이지 자체가 이름 변경되거나 제거될 수 있기 때문입니다. 이 경우 delete_page를 사용하세요.

delete_page 및 rewrite_page는 옵트인(opt-in)입니다

delete_page와 rewrite_page는 COSENSE_ENABLE_DELETE=true가 설정되지 않으면 등록되지 않습니다. 설정이 없으면 두 도구 모두 도구 목록에 아예 나타나지 않으므로 에이전트가 실수로 호출할 수도 없습니다. 이 서버는 공유 MCP 설정에 추가되는 경우가 많으므로, 페이지 전체 삭제는 의도적으로 활성화한 사람에게만 노출됩니다.

이유: insert_lines, edit_lines, delete_lines는 모두 정확히 일치해야 하므로 호출자가 실제로 페이지를 읽은 경우에만 가능합니다. 즉, 이미 알고 있는 줄만 변경할 수 있습니다. delete_page와 rewrite_page는 호출자가 페이지를 읽었는지 여부와 관계없이 페이지 전체에 영향을 주므로 별도의 옵트인 게이트가 필요합니다.

delete_page는 페이지의 모든 줄을 비우며, Cosense는 모든 줄이 비워지면 페이지를 제거합니다. 실행 취소는 불가능합니다. 두 가지 추가 안전장치가 내장되어 있습니다.

  • 페이지가 이미 존재해야 합니다. 페이지가 없으면 조용히 성공하지 않고 오류를 반환합니다. (REST API는 생성된 적 없는 페이지에도 제목 줄을 반환하므로, create_page와 같은 방식으로 persistent를 확인합니다.)

  • dryRun: true는 페이지에 영향을 주지 않고 제거될 줄 수와 그중 처음 5개를 보고합니다.

rewrite_page는 페이지의 전체 콘텐츠를 교체합니다(제목은 첫 번째 줄로 유지됩니다). 동일한 안전장치에 두 가지가 추가됩니다.

  • 페이지가 이미 존재해야 합니다. persistent 확인이 create_page와 반대이므로 오타로 새 페이지가 조용히 생성되지 않습니다.

  • 빈 콘텐츠는 거부됩니다. 페이지 제거는 delete_page의 역할입니다.

  • dryRun: true는 페이지에 영향을 주지 않고 변경 전후 줄 수와 미리보기를 보고합니다.

이 서버를 여러 프로젝트에 대해 여러 인스턴스로 실행하는 경우, 삭제를 허용할 각 인스턴스에 변수를 설정하세요:

{
  "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"
      }
    }
  }
}

여기서 notes 인스턴스는 delete_page_notes를 노출하고, archive 인스턴스는 삭제 도구를 전혀 노출하지 않습니다.

insert_lines와 edit_lines는 대상 줄이 없을 때 다르게 동작합니다. insert_lines는 페이지 끝에 추가합니다. "어딘가에 이 텍스트를 추가"는 여전히 합리적인 결과가 있기 때문입니다. edit_lines는 오류를 반환하고 페이지를 건드리지 않습니다. "이 특정 줄을 교체"에는 의미 있는 대체 동작이 없기 때문입니다. 교체 내용을 추가하면 호출자가 요청한 적 없는 페이지가 조용히 생성될 수 있습니다.

Related MCP server: scrapbox-cosense-mcp-editable

빠른 시작

데스크톱 확장(.mcpb) — 가장 쉬운 방법

  1. GitHub Releases에서 scrapbox-cosense-mcp.mcpb 다운로드

  2. 더블 클릭 — Claude Desktop에 설치 대화상자가 열립니다

  3. 프로젝트 이름(비공개 프로젝트의 경우 세션 ID)을 입력합니다

Claude Code 플러그인

  1. 마켓플레이스 추가:

    /plugin marketplace add worldnine/scrapbox-cosense-mcp
  2. 플러그인 설치:

    /plugin install scrapbox-cosense@worldnine-scrapbox-cosense-mcp

    기본적으로 전역으로 설치됩니다. 다른 범위는 --scope project 또는 --scope local을 사용하세요.

  3. 설정 파일에서 환경 변수를 설정하세요:

    {
      "env": {
        "COSENSE_PROJECT_NAME": "your_project_name",
        "COSENSE_SID": "your_sid"
      }
    }

파일

범위

~/.claude/settings.json

모든 프로젝트(전역)

.claude/settings.local.json

이 프로젝트만(gitignore됨)

플러그인에는 MCP 서버 구성과 CLI 작업을 위한 /cosense 스킬이 포함되어 있습니다.

Claude Code(수동 MCP 설정)

플러그인 대신 수동 구성을 선호하는 경우:

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

Claude Desktop / 기타 MCP 클라이언트

구성 파일에 추가하세요:

클라이언트

구성 파일

Claude Desktop (macOS)

~/Library/Application Support/Claude/claude_desktop_config.json

Claude Desktop (Windows)

%APPDATA%/Claude/claude_desktop_config.json

Cursor

.cursor/mcp.json (프로젝트 루트)

Windsurf

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "scrapbox-cosense-mcp": {
      "command": "npx",
      "args": ["-y", "scrapbox-cosense-mcp"],
      "env": {
        "COSENSE_PROJECT_NAME": "your_project_name",
        "COSENSE_SID": "your_sid"
      }
    }
  }
}

소스에서 빌드

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

구성

필수

변수

설명

COSENSE_PROJECT_NAME

사용자의 Scrapbox/Cosense 프로젝트 이름

COSENSE_SID

비공개 프로젝트용 세션 ID(connect.sid 쿠키) — 얻는 방법

선택 사항

변수

기본값

설명

API_DOMAIN

scrapbox.io

API 도메인

SERVICE_LABEL

cosense (scrapbox)

도구 설명에 표시되는 이름

COSENSE_PAGE_LIMIT

100

초기 페이지 가져오기 제한(1–1000)

COSENSE_SORT_METHOD

updated

초기 정렬: updated, created, accessed, linked, views, title

COSENSE_TOOL_SUFFIX

—

여러 인스턴스용 도구 이름 접미사(예: main → get_page_main)

COSENSE_CONVERT_NUMBERED_LISTS

false

Markdown 변환 시 번호 목록을 글머리 기호 목록으로 변환

COSENSE_EXCLUDE_PINNED

false

초기 리소스 목록에서 고정된 페이지 제외

COSENSE_ENABLE_DELETE

false

delete_page 및 rewrite_page 도구(및 delete / rewrite CLI 명령)를 등록합니다. 설정하지 않으면 사용할 수 없습니다.

CLI 사용법

동일한 바이너리는 독립형 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"

플래그

설명

--compact

토큰 효율적인 간결한 출력(AI 에이전트 권장)

--project=NAME

프로젝트 이름 재정의

--json

JSON으로 출력

--help

도움말 표시(자세한 내용은 <command> --help 지원)

여러 프로젝트

모든 도구는 선택적 projectName 매개변수를 허용하여 단일 서버에서 다른 프로젝트를 대상으로 지정할 수 있습니다. 자격 증명이 다른 여러 비공개 프로젝트의 경우 COSENSE_TOOL_SUFFIX를 사용하여 별도의 서버 인스턴스를 실행하세요.

자세한 구성 예시는 docs/multiple-projects.md를 참조하세요.

개발

명령

설명

npm run build

빌드(TypeScript → JavaScript)

npm run watch

개발 중 자동 재빌드

npm test

테스트 스위트 실행

npm run lint

ESLint 실행

npm run inspector

MCP Inspector로 디버그

기여

  1. main에서 기능 브랜치를 만듭니다

  2. 변경 사항에 대한 테스트를 추가합니다

  3. npm run lint && npm test를 실행합니다

  4. 풀 리퀘스트를 생성합니다 — CI가 자동으로 실행됩니다

라이선스

MIT


Available Tools

9 tools
create_pageB

Create a new page in Scrapbox project on cosense (scrapbox). Creates a new page with the specified title and optional body text. Returns the page creation URL without opening browser. Uses my-cosense-project project as default if projectName is not specified.

Inputs: title (required), body, format, projectName, +1 more.

delete_linesA

Delete one or more lines from a Scrapbox page on cosense (scrapbox). Matches the target by exact text. If targetLineText contains newline characters, it is matched as a contiguous block of lines and removed as a whole. By default only the first match is removed; set matchAll to remove every (non-overlapping) occurrence. Refuses to delete the title line (the first line), which would rename or remove the page — use delete_page for that. Returns an error if no match is found. Requires COSENSE_MCP_PAT or COSENSE_SID. Uses my-cosense-project project as default if projectName is not specified.

Inputs: pageTitle (required), targetLineText (required), matchAll, projectName.

edit_linesA

Replace one or more lines in a Scrapbox page on cosense (scrapbox). Matches the target by exact text and substitutes it with new content (which may span multiple lines). If targetLineText contains newline characters, it is matched as a contiguous block of lines, so any n lines can be replaced with m lines. By default only the first match is replaced; set matchAll to replace every (non-overlapping) occurrence. Returns an error if no match is found. Requires COSENSE_MCP_PAT or COSENSE_SID. Uses my-cosense-project project as default if projectName is not specified.

Inputs: newText (required), pageTitle (required), targetLineText (required), format, +2 more.

get_pageB

Get a page from Scrapbox project on cosense (scrapbox). Returns page content and its linked pages. Page content includes title and description in plain text format. Uses my-cosense-project project as default if projectName is not specified.

Inputs: pageTitle (required), projectName.

get_page_urlA

Generate URL for a page in Scrapbox project on cosense (scrapbox). Returns the direct URL to the specified page without opening it in browser. Uses my-cosense-project project as default if projectName is not specified.

Inputs: title (required), projectName.

get_smart_contextA

Get smart context for a page on cosense (scrapbox). Returns the target page and its linked pages (1-hop or 2-hop) with full content in AI-optimized format. Useful for understanding the context and related knowledge around a specific topic. Requires COSENSE_MCP_PAT or COSENSE_SID. Uses my-cosense-project project as default if projectName is not specified.

Inputs: title (required), hopCount, projectName.

insert_linesA

Insert text after a specified line in a Scrapbox page on cosense (scrapbox). If target line not found, text is appended to the end of the page. Uses my-cosense-project project as default if projectName is not specified.

Inputs: text (required), pageTitle (required), targetLineText (required), format, +1 more.

list_pagesA

Browse and list pages from Scrapbox project on cosense (scrapbox) with flexible sorting and pagination. Use this tool to discover pages by recency, popularity, or alphabetically. Returns page metadata and first 5 lines of content. Available sorting methods: updated (last update time), created (creation time), accessed (access time), linked (number of incoming links), views (view count), title (alphabetical). Different from search_pages which finds content by keywords. Uses my-cosense-project project as default if projectName is not specified.

Inputs: skip, sort, limit, projectName, +1 more.

search_pagesA

Search for content within pages in Scrapbox project on cosense (scrapbox). Use this tool to find pages containing specific keywords or phrases. Returns matching pages with highlighted search terms and content snippets. Limited to 100 results maximum. Supports basic search ("keyword"), multiple keywords ("word1 word2" for AND search), exclude words ("word1 -word2"), and exact phrases (""exact phrase""). Different from list_pages which browses pages by metadata. Uses my-cosense-project project as default if projectName is not specified.

Inputs: query (required), projectName.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools target distinct operations (URL, create, edit, delete, insert, list, search). However, get_page and get_smart_context overlap notably since both return page content plus linked pages, differing mainly in formatting and hop depth, which could cause misselection.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern (get_page_url, get_smart_context, create_page, edit_lines, delete_lines, get_page, insert_lines, list_pages, search_pages). No mixed conventions or vague verbs.

    Tool Count5/5

    Nine tools is well-scoped for a note-taking/wiki server, with each tool earning its place across read, write, discovery, and navigation operations.

    Completeness3/5

    The surface covers create, read, line-level edit/insert/delete, list, and search, but lacks a page-level delete or rename tool—ironically delete_lines explicitly references a delete_page tool that is not present, creating a dead end for removing or renaming whole pages.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for Wiki.js projects that enables full-text search, page retrieval, and page management capabilities. It allows LLMs to interact with wiki content through specialized tools for searching, listing, and creating pages.
      ISC
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for Cosense (formerly Scrapbox) that enables page creation, editing, deletion, and searching with WebSocket-based operations. Extends the original server with page-deletion and line-editing tools.
      2 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Read-only MCP server for the Cosense project 'shiyui' that provides tools for fetching pages, full-text search, vector search, and related page retrieval. It uses Cloudflare Access OAuth for authentication.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A stateless Remote MCP server on Cloudflare Workers for operating a single Cosense (formerly Scrapbox) project. It enables page retrieval, listing, full-text search, and line insertion via natural language, protected by Cloudflare Access Managed OAuth and JWT validation.
      MIT