Document the HTTP shared-secret and trusted-hosts options of mcp_server(type = "http"), or add arguments for them

未关闭 适合新手
#139 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
73/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
活跃
技术栈
r
领域
documentation

调研方向

阅读 mcp_server 帮助页面、服务器 vignette、README 和 NEWS;issue 表示目前这些文档都没有记录这些选项。检查 test-server.R 中针对 mcptools.http_shared_secret 的现有测试,以确认其行为和 header 名称。记录受支持的选项,包括精确匹配带端口的 Host,并明确说明支持哪些设置。

由索引模型根据 Issue 内容生成。

描述

Hi, and thanks for mcptools.

putior is on CRAN; its development version (to be released as 0.2.0) adds putior_mcp_server(), which can serve putior's tools over HTTP with mcptools::mcp_server(type = "http"). putior sets one of two options before calling it:

  • With a token (putior requires one when the server listens on a non-loopback address), putior sets mcptools.http_shared_secret; handle_http_request() then requires the header Plumber-Shared-Secret.
  • Without a token (loopback only): putior adds the loopback names to mcptools.http_trusted_hosts, which handle_http_request() compares with the Host header as written, in addition to your Origin check.

Both options came with the Posit Connect engine (#106). The code that reads them is unchanged from 1.0.0 to 1.0.3 and on main (714803b), and test-server.R covers mcptools.http_shared_secret as an override of plumber2.sharedSecret. But none of ?mcp_server, the server vignette, the README or NEWS mentions them; ?mcp_server documents MCPTOOLS_PORT and MCPTOOLS_SOCKET_DIR, but not these.

If a later release read other settings, a putior server started with a token would answer requests that lack it, without an error. putior therefore sends mcptools' internal handle_http_request() test requests at start-up, and does not start unless the requests without the right secret or from an untrusted Host get 401/403 and a valid one does not. We would rather depend on a documented interface.

Would you consider one of these?

  1. Documenting mcptools.http_shared_secret and mcptools.http_trusted_hosts in ?mcp_server, with the header name and the exact Host match (port included). MCPTOOLS_HTTP_TRUSTED_HOSTS, mcptools.http_allowed_origins and MCPTOOLS_HTTP_ALLOWED_ORIGINS could go there too, if you want them supported.
  2. Or arguments such as mcp_server(..., shared_secret = NULL, trusted_hosts = NULL).
  3. If these options are likely to change, a NEWS entry when they do would already help.

Happy to send a PR for the documentation.

主要语言
R
星标
207
派生
24
平均合并
36 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

posit-dev/mcptools 的其他 Issue

查看 posit-dev/mcptools 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。