notion-local-ops-mcp
notion-local-ops-mcp
将 Notion AI 与你的本地文件、shell 和备用本地代理结合使用。
提供功能
list_filessearch_filesread_filereplace_in_filewrite_filerun_commanddelegate_taskget_taskcancel_task
delegate_task 支持本地 codex 和 claude CLI。
Related MCP server: Notion Cowork Bridge
要求
Python 3.11+
cloudflared带有自定义 MCP 支持的 Notion 自定义代理
可选:
codexCLI可选:
claudeCLI
安装
git clone https://github.com/<your-account>/notion-local-ops-mcp.git
cd notion-local-ops-mcp
python3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .配置
复制 .env.example 并至少设置以下内容:
export NOTION_LOCAL_OPS_WORKSPACE_ROOT="/absolute/path/to/workspace"
export NOTION_LOCAL_OPS_AUTH_TOKEN="replace-me"可选:
export NOTION_LOCAL_OPS_CODEX_COMMAND="codex"
export NOTION_LOCAL_OPS_CLAUDE_COMMAND="claude"
export NOTION_LOCAL_OPS_COMMAND_TIMEOUT="30"
export NOTION_LOCAL_OPS_DELEGATE_TIMEOUT="1800"启动
source .venv/bin/activate
notion-local-ops-mcp本地端点:
http://127.0.0.1:8766/mcp使用 cloudflared 暴露服务
快速隧道
cloudflared tunnel --url http://127.0.0.1:8766将生成的 HTTPS URL 与 /mcp 一起使用。
命名隧道
编辑 cloudflared-example.yml,然后运行:
cloudflared tunnel --config ./cloudflared-example.yml run <your-tunnel-name>添加到 Notion
使用:
URL:
https://<your-domain-or-tunnel>/mcp认证类型:
Bearer令牌: 你的
NOTION_LOCAL_OPS_AUTH_TOKEN
推荐的代理指令:
Use direct tools first: list_files, search_files, read_file, replace_in_file, write_file, run_command.
Use delegate_task only for complex multi-file work, long-running tasks, or when direct tools are insufficient.环境变量
变量 | 必需 | 默认值 |
| 否 |
|
| 否 |
|
| 是 | 主目录 |
| 否 |
|
| 否 | 空 |
| 否 |
|
| 否 |
|
| 否 |
|
| 否 |
|
工具说明
list_files: 列出文件和目录search_files: 在文件中搜索文本read_file: 读取带有偏移量和限制的文本文件replace_in_file: 替换一个精确的文本片段write_file: 写入完整的文件内容run_command: 运行本地 shell 命令delegate_task: 将任务发送到本地codex或claudeget_task: 读取任务状态和输出尾部cancel_task: 停止已委托的任务
验证
source .venv/bin/activate
pytest -q
python -m compileall src tests故障排除
Notion 显示无法连接
检查 URL 是否以
/mcp结尾检查认证类型是否为
Bearer检查令牌是否与
NOTION_LOCAL_OPS_AUTH_TOKEN匹配检查
cloudflared是否仍在运行
SSE 路径在本地有效但在隧道上无效
使用命名隧道而不是快速隧道重试
确认
GET /mcp返回text/event-stream
delegate_task 失败
检查
codex --help检查
claude --help如有必要,设置
NOTION_LOCAL_OPS_CODEX_COMMAND或NOTION_LOCAL_OPS_CLAUDE_COMMAND
This server cannot be deployed
Maintenance
Related MCP Connectors
Your workspace as agent tools — docs, canvases, slides, sheets, projects, tickets, and a shell.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.
- mcp-serverOAuthcom.make
Give your AI agents the tools to build, manage, and run automation workflows.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables GPT Desktop to interact with local file systems and execute shell commands. Supports file operations (read, write, edit, delete), directory management, file search, and git status checks through natural language.-
- AlicenseNot gradedqualityAmaintenanceGives Notion Custom Agents real file tools and a real terminal over the Model Context Protocol, enabling them to read, edit, and run commands directly on the user's machine.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search, update, and manage files, run terminal commands, and automate workflows on a user's computer.156,453 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to remotely execute terminal commands and perform filesystem operations on the host machine, with secure authentication and optional ngrok tunneling for integration with Notion and other clients.MIT