Mcp Portal

io.github.apollion69由 GitHub 账号 apollion69 发布v0.1.0更新于 Oct 24, 2026

Cursor CLI delegation for verified bulk reads and reference-driven code generation.

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

一个本地 stdio MCP 服务器,把受限的文件读取和基于参考文件的代码生成交给 Cursor CLI,使用其独立配额。

可以做什么
读取指定文件并仅依据这些文件回答问题,返回经核验的引文、缺口和指标(bulk_read)。根据规格和参考文件生成代码,可选由服务器写入目标文件(code_write)。查看 CLI 路径、认证提示、默认模型、策略摘要和缓存位置(status)。
适用场景
适合希望把明确选定文件的大批量读取或样板代码生成卸载到 Cursor 独立配额的主机代理,借助哈希清单和服务端引文核验,避免整文件读取。
运行要求
以 uvx(或 pipx/pip)运行的本地进程;需要 Python 3.10+,并安装且已登录 Cursor CLI(cursor-agent)。可选环境变量 MCP_PORTAL_CLI(CLI 路径)和 MCP_PORTAL_HOME(缓存与证据目录,默认 ~/.cache/mcp-portal)。Windows 上使用本地 CLI 或 WSL 桥接。
安装前请注意
所选文件内容会发送给 Cursor CLI,由你决定哪些文件离开本机;会拦截类似凭据的路径和密钥模式,但不能替代密钥卫生。code_write 可向目标路径写入文件。运行会消耗 Cursor 配额,与主机模型配额分开。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Portal,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-portal

[CI] [PyPI]

mcp-portal is a stdio Model Context Protocol server that lets a frontier agent (Claude Code, Codex, Cursor, or any MCP host) delegate two jobs to the Cursor CLI on its own quota: bounded bulk_read (read explicitly selected files, answer with verified quotes) and code_write (generate boilerplate from a reference file + spec; the server writes the target file). Python stdlib only—no Node runtime and no MCP SDK dependency.

On 2026-09-08, composer-2.5-fast generated roughly 5× faster than a frontier model on the same brief (line-rate measurement). Cursor quota is separate from the host model's.

Quick start

bash
uvx mcp-portal

Also available as pipx install mcp-portal / pip install mcp-portal, and listed in the MCP Registry as io.github.apollion69/mcp-portal. To run the development head instead of the release:

bash
uvx --from git+https://github.com/apollion69/mcp-portal mcp-portal

Requirements: Python 3.10+, the Cursor CLI (cursor-agent) installed and logged in.

Doctor (CLI inventory, no model call):

bash
mcp-portal-doctor

Configure per host

Claude Code

bash
claude mcp add --scope user mcp-portal -- uvx mcp-portal

Codex (~/.codex/config.toml)

toml
[mcp_servers.mcp-portal]command = "uvx"args = ["mcp-portal"]tool_timeout_sec = 150

Cursor (~/.cursor/mcp.json)

json
{  "mcpServers": {    "mcp-portal": {      "command": "uvx",      "args": ["mcp-portal"]    }  }}

VS Code (.vscode/mcp.json, servers key)

json
{  "servers": {    "mcp-portal": {      "type": "stdio",      "command": "uvx",      "args": ["mcp-portal"]    }  }}

Generic mcpServers JSON

json
{  "mcpServers": {    "mcp-portal": {      "command": "uvx",      "args": ["mcp-portal"]    }  }}

Environment (optional):

VariablePurpose
MCP_PORTAL_HOMECache, receipts, evidence (default ~/.cache/mcp-portal)
MCP_PORTAL_CLIPath to cursor-agent / agent

Tools

bulk_read

ArgumentRequiredDescription
pathsyes1–16 file paths (relative to root or absolute)
questionyesQuestion answered only from those files
rootnoCommon root; default = longest common parent of paths
modelnoOverride model; policy applies when omitted

Returns status, run_id, answer.findings[] (file, start, end, quote, fact), gaps[], metrics, model_decision.

code_write

ArgumentRequiredDescription
specyesWhat to generate
reference_pathyesStyle/context reference file
target_pathnoIf set, server writes this path
modelnoOverride model

Returns generated code, optional bytes_written, run_id, metrics.

status

No arguments. Returns CLI path, auth hint, default model, policy summary, cache location, receipt counters.

Model policy

Shipped in model-policy.json (package data). Defaults:

  • Prefer Cursor-native models (composer-2.5, then cursor-grok-*)
  • Strip -fast suffixes (never auto-select fast variants)
  • Other vendors only when explicitly requested and listed by cursor-agent --list-models

Override by editing model-policy.json in the installed package or setting policy fields via a custom file at MCP_PORTAL_HOME (future) — today, replace the package file or patch preferred in your fork. Each tool result includes model_decision.reason (default_preferred, fast_suffix_stripped, cursor_native_explicit, explicit_other_vendor, requested_unavailable_fallback).

How it works

  1. Authorize — Server reads only listed paths; blocks credential-like paths and secret patterns.
  2. Manifest — Request JSON includes per-file SHA-256 hashes.
  3. Isolate — Cursor CLI runs with fresh CURSOR_CONFIG_DIR, deny-all permissions, --mode ask, sandbox enabled.
  4. Verify — Every quote in bulk_read answers must appear verbatim in the cited line range; bad citations are dropped or fail closed.
  5. Evidence — Per-run directory under MCP_PORTAL_HOME/runs/<run_id>/ with manifest (hashes, metrics; not full source).
  6. Budgets — 16 files, 128 KiB combined input, 90s timeout, bounded stdio frames.

Windows

On Windows, the delegate uses a local Cursor CLI run when either:

  • MCP_PORTAL_CLI points at an executable (including test stubs), or
  • cursor-agent / agent is found on PATH and is a real file.

Otherwise it falls back to the wsl.exe bridge into Ubuntu/WSL (python3 -m mcp_portal.delegate --worker). Force either mode with MCP_PORTAL_BACKEND=local or MCP_PORTAL_BACKEND=wsl.

  • MCP config can use native uvx mcp-portal when the CLI is on PATH, or wsl.exe + uvx mcp-portal when it is not
  • Helpers in clients/windows/ (delegate.ps1, parse_read.ps1)
  • MCP_PORTAL_WORKER overrides the default WSL worker command
  • MCP_PORTAL_WSL_CD sets the WSL working directory (default ~)

Optional Claude Code routing hook

Install read gate + skill (generic, transactional):

bash
python3 -m mcp_portal.install_router prepare --client claude --python python3 \  --state-root ~/.cache/mcp-portal/router-tx --shell bash --command-shell bash# then apply with the printed transaction id

See docs/skills/cursor-bulk-reader/SKILL.md for agent-facing guidance. The router blocks or warns on large full-file reads (>350 lines or >128 KiB) and points agents at bulk_read.

Repo-level MCP registration helper:

bash
python3 -m mcp_portal.install planpython3 -m mcp_portal.install apply --target claude-mcp

Security

See SECURITY.md. Summary: you choose which files leave the machine; the CLI runs read-only with tools denied; quotes are verified server-side. Not a substitute for secret hygiene.

Related projects

Several Node-based bridges expose Cursor via MCP (different tradeoffs: SDK/Node stack, varying isolation and verification):

mcp-portal focuses on stdlib Python, hash-pinned manifests, quote verification, server-side writes for code_write, model policy, and WSL-first Windows support.

License

MIT — see LICENSE.

来源:README.md,提交 b07466a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分