Skip to main content

Project MCP

把一个本地项目作为 token 保护的 MCP 服务暴露给 ChatGPT。

Project MCP 故意保持很小:

  • 一个本地项目根目录
  • 一个固定项目 token
  • 一个 Streamable HTTP MCP 端点:/mcp
  • 通过 Cloudflare quick tunnel 暴露公网 HTTPS
  • 不做登录、不做托管 relay、不做 ChatGPT 自定义 UI 卡片

快速开始

不安装,直接运行:

uvx project-mcp

或安装成持久 CLI:

uv tool install project-mcp
project-mcp

默认会把当前目录作为项目目录,并输出 ChatGPT 需要粘贴的 Server URL,例如:

https://example.trycloudflare.com/mcp?project_mcp_token=pmcp_...

如果保存的本地端口被占用,start 会自动换一个空闲端口继续启动;公网 tunnel URL 不受影响。 Cloudflare quick tunnel 的 *.trycloudflare.com Host 会被默认允许,其他公网 Host 默认拒绝。

在 ChatGPT Developer Mode 里创建 app/connector:

Connection: Server URL
Authentication: None / No Authentication

命令

project-mcp
project-mcp --root /path/to/project
project-mcp --read-only
project-mcp --no-bash
project-mcp setup --root . --port 8080
project-mcp start --root .
project-mcp doctor
project-mcp token rotate
project-mcp settings show

项目配置保存在仓库外:

~/.project-mcp/workspaces/<sha256-realpath>.json

token 按“设备 + 项目根目录”固定保存,直到你显式轮换它。

MCP 工具

Project MCP 暴露:

  • server_config
  • workspace_info
  • tree
  • search
  • grep
  • read_file
  • write_file
  • edit_file
  • show_changes
  • run_check

--read-only 会隐藏 write_file 和 edit_file。--no-bash 会隐藏 run_check。

grep 是 search 的安全别名,方便 ChatGPT 按直觉查代码;它不会执行 shell grep,仍然遵守项目 root、blocked globs、二进制拒绝和结果数量限制。

run_check 默认使用安全白名单,覆盖 codexpro 风格的只读/验证命令,并额外支持更多常见检查器:

  • pwd、ls、find
  • git status、git diff、git log、git show、git branch、git rev-parse、git ls-files
  • pytest、python -m pytest、python -m unittest、uv run pytest
  • npm/pnpm/yarn/bun test|lint|typecheck|build|check|validate
  • npm/pnpm/yarn/bun run build:clients、bun run smoke:network-propagation 这类带冒号后缀的检查/验证脚本
  • bun --filter @scope/pkg smoke:case-name 这类 Bun monorepo 定向验证脚本
  • go test、cargo test/check/clippy
  • tsc、eslint、biome check、prettier --check
  • ruff check、ruff format --check、mypy、pyright、basedpyright

危险命令和参数仍会被拦截,例如 rm、curl、git push、--fix、--write、find -delete、管道和重定向。

Project MCP 默认不会屏蔽 .tmp/、.pi/、data/ 这类项目运行目录,因为它们可能是理解项目状态所必需的上下文。若某个项目希望减少噪音,可以通过 PROJECT_MCP_BLOCKED_GLOBS 追加自己的排除规则。

开发

uv sync
uv run ruff check .
uv run pytest
uv build
uv publish

Metadata

Release files for project-mcp 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for project-mcp 0.1.7
File Size Uploaded
project_mcp-0.1.7.tar.gz 16.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for project-mcp 0.1.7
File Interpreter ABI Platform
project_mcp-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 36.0 kB

Release files / project_mcp-0.1.7.tar.gz

Download URL project_mcp-0.1.7.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
96641a98606bb0b74dfdfb070a25996661d5aed33b6a4375b4fd067701682792
BLAKE2b-256 checksum
How to use checksums
edb12b5ebf811d7f3a520c52228de64c2f850b2de126981282d5be7d789451b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / project_mcp-0.1.7-py3-none-any.whl

Download URL project_mcp-0.1.7-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9906e4d383f4a02e548d4b642e6d7d4a7f39403aade756b73cad0e2f00a7e2c2
BLAKE2b-256 checksum
How to use checksums
dd8803b28f1ed69c40eff3ef7ef8e8cfc4c4742b3724722806539506e396e567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page