Skip to main content

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

Project description

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
  • read_file
  • write_file
  • edit_file
  • show_changes
  • run_check

--read-only 会隐藏 write_fileedit_file--no-bash 会隐藏 run_check

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

  • pwdlsfind
  • git statusgit diffgit loggit showgit branchgit rev-parsegit ls-files
  • pytestpython -m pytestpython -m unittestuv run pytest
  • npm/pnpm/yarn/bun test|lint|typecheck|build|check|validate
  • npm/pnpm/yarn/bun run build:clientsbun run smoke:network-propagation 这类带冒号后缀的检查/验证脚本
  • bun --filter @scope/pkg smoke:case-name 这类 Bun monorepo 定向验证脚本
  • go testcargo test/check/clippy
  • tsceslintbiome checkprettier --check
  • ruff checkruff format --checkmypypyrightbasedpyright

危险命令和参数仍会被拦截,例如 rmcurlgit push--fix--writefind -delete、管道和重定向。

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

开发

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

project_mcp-0.1.6.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

project_mcp-0.1.6-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file project_mcp-0.1.6.tar.gz.

File metadata

  • Download URL: project_mcp-0.1.6.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for project_mcp-0.1.6.tar.gz
Algorithm Hash digest
SHA256 92560131412365ff2ac38c7fb23b63bb860ed5da4b60a57f44791e31fc977045
MD5 b938eb6e76855ea66fa92aadb3bd580e
BLAKE2b-256 5b9a19d4c2edb55bfeebae510327f8444b8fff9e451130124fdacc68744eb33e

See more details on using hashes here.

File details

Details for the file project_mcp-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: project_mcp-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for project_mcp-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b9f83751d5f2ca72e6f721d1f9a9733d75ef187317ef077fd2020be78df75962
MD5 7062cd015f90a1dd934ec4233f8a6409
BLAKE2b-256 71db26488245f88e49a9a1b3ab89bdf6610e02d04d4d42d86a37238f5eacd72e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page