cosense-mcp-worker
Provides tools for interacting with a Cosense (formerly Scrapbox) project, including retrieving pages with related-page links, listing recently updated pages, performing full-text search, and inserting lines into pages.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cosense-mcp-workerSearch the project for 'roadmap' and show me the results"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cosense-mcp-worker
A stateless Remote MCP server that operates on a single Cosense (formerly Scrapbox) project. It runs on Cloudflare Workers, using Hono for HTTP routing and Cloudflare Agents' createMcpHandler() with MCP SDK v2 for MCP. OAuth implementation is not held in the Worker; it is delegated to Cloudflare Access Managed OAuth.
One Worker is fixed to one Cosense project and one connect.sid. MCP tool arguments cannot specify or change a different project or credentials.
How to use from various MCP clients
Name Cosense
MCP endpoint
https://<worker-host>/mcpAuthentication OAuth
Related MCP server: Remote MCP Server with Bearer Auth
One-click deploy to Cloudflare
From this button, you can create, build, and deploy a Worker to your own Cloudflare account. On the setup screen, enter the Worker name, COSENSE_PROJECT_NAME, CF_ACCESS_TEAM_DOMAIN, CF_ACCESS_AUD, and the Secret COSENSE_SID.
Creating the Cloudflare Access Application, enabling Managed OAuth, and configuring the Access Policy must be done by the user after deployment.
Provided endpoints
Endpoint | Description |
| Returns a service overview. Does not return the project name or secrets. |
| Health check that does not require authentication. |
| Streamable HTTP MCP endpoint protected by Cloudflare Access. |
MCP tools
Tool | Input | Description |
|
| Retrieves the page body, direct links, 1-hop and 2-hop related pages, and external and other-project links. |
| None | Retrieves up to 100 pages in order of update time, with descriptions and update timestamps. |
|
| Runs a Cosense full-text search within the configured project. |
|
| Inserts after the first line that exactly matches. If there is no match, appends to the end. |
Local setup
You need Node.js 20 or later, Corepack, a Cloudflare account that can use Cloudflare Zero Trust, and a session ID with permissions for the target Cosense project.
git clone <リポジトリURL> cosense-mcp-worker
cd cosense-mcp-worker
corepack enable
pnpm installSet non-secret values in wrangler.jsonc.
"vars": {
"COSENSE_PROJECT_NAME": "your-project",
"CF_ACCESS_TEAM_DOMAIN": "https://your-team.cloudflareaccess.com",
"CF_ACCESS_AUD": "YOUR_ACCESS_APPLICATION_AUDIENCE_TAG"
}Always set the session ID as a Worker Secret. Do not save it in wrangler.jsonc, source code, or Git.
pnpm wrangler secret put COSENSE_SIDFor local development only, set it in .dev.vars, which is not committed.
COSENSE_SID=your-connect.sid-valueVerification and local execution are as follows. pnpm check runs lint, type checking, unit tests, Worker binding type synchronization checks, and pre-deploy bundle validation all together.
pnpm check
pnpm wrangler dev --localCloudflare Access Managed OAuth setup
Only when you are ready to deploy, run the following command.
pnpm run deployNext, in the Cloudflare Zero Trust dashboard, create an Access Application for the Worker's hostname.
Create an MCP server application targeting the Worker's domain and the
/mcppath.Configure an Access Policy with the users or ID groups allowed to use the target Cosense project.
Copy the Application Audience (AUD) Tag and set it to
CF_ACCESS_AUD.Confirm that the Zero Trust Team Domain matches
CF_ACCESS_TEAM_DOMAIN.Enable Managed OAuth in the Application's Advanced settings.
Register
https://<worker-host>/mcpin the MCP client.
Authorization Code Flow, PKCE, login, refresh tokens, OAuth discovery, and Access Policy are all handled by Cloudflare Access. The Worker itself does not implement an OAuth server.
The Worker receives Cf-Access-Jwt-Assertion, verifies the RS256 signature, issuer, and AUD using the Team's JWKS endpoint, and only then passes requests to /mcp to the MCP handler.
When Managed OAuth is used, the OAuth discovery information is returned to the client from the Access layer. Do not add OAuth endpoints or a custom authorization server inside the Worker.
Security properties
COSENSE_SIDis treated as a Secret binding and is not included in JSON responses or logs./mcprejects requests with a missing or invalid Access assertion with401.The Access JWT signature is verified against
https://<team-domain>/cdn-cgi/access/certs, and the issuer and AUD are also verified.The Origin of
/mcpis fully open. Priority is given to compatibility with Remote MCP clients; access control is performed by Cloudflare Access OAuth tokens and JWT verification inside the Worker.The MCP tool schemas reject undefined inputs, so callers cannot override the project or credentials.
Arbitrary error content from Cosense is not returned as-is; errors are limited to per-operation errors.
Tool output is capped at 100,000 characters to avoid unintentionally returning extremely large responses.
Directory structure
src/
config.ts Worker bindingの検証
index.ts Honoルートとstateless MCP HTTP transport
middleware/access-auth.ts Access JWTの検証
mcp/server.ts MCP SDK v2 server factory
mcp/tools/ ツールごとのスキーマと登録処理
cosense/client.ts Cosense adapter
cosense/formatter.ts LLM向けページ整形
cosense/insert-lines.ts 純粋な挿入位置計算
test/ 外部Cosense APIを呼ばないユニットテストReferences
This project is inspired by yosider/cosense-mcp-server. It does not copy code from that repository; it is a new implementation for Cloudflare Workers.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol server implementation that runs on Cloudflare Workers with OAuth authentication support, allowing users to connect MCP clients like Claude Desktop or the MCP Inspector to utilize remote AI tools.
- FlicenseNot gradedqualityCmaintenanceA Cloudflare Workers-based MCP server implementation that supports OAuth/bearer token authentication, enabling secure remote interaction with Model Context Protocol tools.
- FlicenseNot gradedqualityCmaintenanceA Model Context Protocol server implementation designed to run on Cloudflare Workers with integrated OAuth authentication. It enables hosting and securely accessing MCP tools remotely via SSE transport from clients like Claude Desktop.
- FlicenseNot gradedqualityCmaintenanceA remote MCP server deployed on Cloudflare Workers with OAuth login, enabling tools like math operations to be called via natural language.
Related MCP Connectors
Hosted remote MCP server for YNAB on Cloudflare Workers with OAuth
Cloudflare Workers MCP server: crypto-signal
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ogatomo21/cosense-remote-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server