Skip to main content
Glama
mcp-cosense
by mu373

mcp-cosense

An MCP server for reading, searching, and safely editing Cosense projects through Helpfeel's official @helpfeel/cosense-cli.

The server exposes a fixed set of MCP tools instead of a general shell. Project access is restricted by an exact URL allowlist, and writes use the official CLI's two-step, five-minute preview and submit flow.

Requirements

  • Node.js 24 or later, or Docker

  • A Cosense Personal Access Token or project Service Account

Related MCP server: workspace-mcp

Authenticate

Credentials are stored by the official Cosense CLI under ~/.cosense. Pass the Cosense origin to store a Personal Access Token, or an exact project URL to store a Service Account for that project.

npx mcp-cosense login https://scrapbox.io

The token is entered interactively and is not passed through MCP.

Local MCP over stdio

Set COSENSE_ALLOWED_PROJECTS to the exact project URLs the server may access. Separate multiple projects with commas. An empty allowlist disables all Cosense operations.

{
  "mcpServers": {
    "cosense": {
      "command": "npx",
      "args": ["-y", "mcp-cosense"],
      "env": {
        "COSENSE_ALLOWED_PROJECTS": "https://scrapbox.io/example-project"
      }
    }
  }
}

Running mcp-cosense without arguments uses stdio. --stdio selects it explicitly.

Docker and Streamable HTTP

Copy .env.example to .env, configure the allowlist, authenticate into the dedicated volume, and start the server:

cp .env.example .env
docker compose --profile setup run --rm login
docker compose up -d --build server

The endpoint is http://127.0.0.1:8798/mcp by default. The published port binds only to loopback unless COSENSE_BIND_ADDRESS is changed.

The image also runs directly:

docker build -t mcp-cosense .
docker run --rm --read-only -p 127.0.0.1:8798:8798 \
  -e COSENSE_ALLOWED_PROJECTS=https://scrapbox.io/example-project \
  -v mcp-cosense-credentials:/home/cosense/.cosense:ro \
  mcp-cosense

Tools

  • browse_page

  • browse_related_pages

  • read_page

  • search_full_text

  • search_vector

  • preview_edit

  • preview_new_page

  • submit_edit

preview_edit and preview_new_page do not change Cosense. Only submit_edit mutates a page. A preview expires after five minutes and can be submitted only once.

Configuration

Variable

Default

Description

COSENSE_ALLOWED_PROJECTS

empty

Comma-separated exact project URLs; empty disables access

COSENSE_HOME

current home

Home containing .cosense credentials

COSENSE_CLI_TIMEOUT_SECONDS

120

Per-command timeout

COSENSE_CLI_MAX_OUTPUT_BYTES

4194304

Per-stream output limit

COSENSE_CLI_CONCURRENCY

4

Maximum concurrent CLI processes

COSENSE_MCP_HOST

127.0.0.1

HTTP listen address; Docker sets 0.0.0.0

COSENSE_MCP_PORT

8798

HTTP listen port

COSENSE_MCP_ALLOWED_HOSTS

localhost values

Accepted HTTP Host headers

Security

  • The Cosense CLI child process receives a minimal environment and no unrelated application secrets.

  • The Docker image is distroless, unprivileged, and contains neither npm nor a shell.

  • The Compose service uses a read-only root filesystem, drops all Linux capabilities, and mounts credentials read-only outside the interactive login job.

  • Input size, output size, execution time, process count, and concurrency are bounded.

  • Project URLs are checked against the operator-configured allowlist before the CLI is invoked.

Development

npm ci
npm test

Available Tools

8 tools
browse_pageB
Read-onlyIdempotent

Read one Cosense page in an agent-friendly format with metadata and links.

Inputs: page_url (required). Returns: content, warnings

preview_editA

Preview an explicitly requested edit without changing the page. First call read_page and use its top-level page ID and lines[].id values. Inspect the returned complete post-edit page before calling submit_edit.

Inputs: page_id (required), operations (required), project_url (required). Returns: content, warnings

preview_new_pageA

Preview creation of a new page without changing Cosense. Use this only for an explicitly requested write. The title and each item in lines represent one Cosense line. Inspect the preview before submitting it.

Inputs: lines (required), title (required), project_url (required). Returns: content, warnings

read_pageA
Read-onlyIdempotent

Read structured page JSON, including page ID and line IDs used for edits.

Inputs: page_url (required). Returns: data, warnings

search_full_textA
Read-onlyIdempotent

Search complete Cosense page text with AND or OR matching.

Inputs: query (required), project_url (required), sort, match_any. Returns: data, warnings

search_vectorB
Read-onlyIdempotent

Semantically search Cosense titles and link notation.

Inputs: query (required), project_url (required). Returns: data, warnings

submit_editA
Destructive

Commit one inspected Cosense edit preview. This mutates Cosense. Call it only for the same explicit user write request that produced the preview. Never retry an ambiguous result before read_page confirms whether the intended change already landed.

Inputs: preview_id (required), project_url (required). Returns: content, warnings

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation4/5

    browse_page and read_page both read a single page, but their purposes are differentiated by output format and edit intent. The search tools, related-pages tool, and preview/submit tools are clearly distinct, so an agent can generally select correctly.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb-first pattern such as browse_, read_, search_, preview_, and submit_. The naming conventions are uniform and predictable across the entire set.

    Tool Count5/5

    Eight tools is a well-scoped count for a Cosense page server, covering browsing, reading, searching, previewing edits, and submitting writes without unnecessary duplication. Each tool has a clear role in the workflow.

    Completeness4/5

    Read, browse, search, edit-preview, and submit workflows are covered, and the preview-before-submit flow is well defined. The main gaps are the lack of explicit page deletion, page history, and a dedicated new-page submission tool, though the core page lifecycle is mostly functional.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      Enables AI clients such as ChatGPT and Claude to safely read, analyze, update, verify, and audit GitHub Projects v2 through OAuth-secured MCP connections with role-based access control, guarded writes, bulk preview/approval/apply, checkpoints/deltas, and durable audit trails.
      40
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients to safely read, write, edit, search, and optionally run commands within one or more named project workspaces, while maintaining a work journal and tracking changes.
      19
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to read only explicitly allowlisted Linux project files and selected Codex conversation turns. It supports listing projects and files, reading UTF-8 files, bounded text search, and paged reading of authorized conversations.
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients to read a project's Git-backed kickoff, acceptance criteria, handoff package, progress, and next step, and to append validated, audited progress events as project records. It provides short-lived scoped credentials and fail-closed tool allowlisting for safe, resumable AI-assisted development.
      -