@tempad-dev/mcp 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/README.zh-Hans.md +8 -2
- package/dist/cli.mjs +1 -1
- package/dist/hub.mjs +536 -203
- package/dist/hub.mjs.map +1 -1
- package/dist/{shared-CRF_okNG.mjs → shared-BAyjEPbx.mjs} +3 -3
- package/dist/{shared-CRF_okNG.mjs.map → shared-BAyjEPbx.mjs.map} +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,9 +28,9 @@ Supported tools/resources:
|
|
|
28
28
|
Notes:
|
|
29
29
|
|
|
30
30
|
- Tool responses use a shared `64 KiB` inline budget measured on the `CallToolResult` body. When a selection is too large for the `get_code` budget, TemPad Dev may return a shell response instead of failing. The shell keeps the current node wrapper and lists omitted direct child ids in an inline code comment so agents can request them one by one. The accompanying warning stays lightweight and only points agents to that comment.
|
|
31
|
-
- Assets are ephemeral and tool-linked; image/SVG bytes are downloaded via HTTP `asset.url` from tool results.
|
|
31
|
+
- Assets are ephemeral and tool-linked; image/SVG bytes are downloaded via the capability-bearing HTTP `asset.url` from tool results. Treat the full URL as a temporary secret and do not persist it in logs.
|
|
32
32
|
- Asset resources are not exposed via MCP `resources/list`/`resources/read`.
|
|
33
|
-
- The HTTP fallback URL uses `/assets/{hash}` and may include an image extension (for example `/assets/{hash}.png`). Both forms are accepted.
|
|
33
|
+
- The HTTP fallback URL uses `/{capability}/assets/{hash}` and may include an image extension (for example `/{capability}/assets/{hash}.png`). Both filename forms are accepted.
|
|
34
34
|
|
|
35
35
|
## Configuration
|
|
36
36
|
|
|
@@ -39,11 +39,17 @@ Optional environment variables:
|
|
|
39
39
|
- `TEMPAD_MCP_TOOL_TIMEOUT`: Tool call timeout in milliseconds (default `15000`).
|
|
40
40
|
- `TEMPAD_MCP_AUTO_ACTIVATE_GRACE`: Delay before auto-activating the sole connected extension (default `1500`).
|
|
41
41
|
- `TEMPAD_MCP_MAX_ASSET_BYTES`: Maximum upload size for captured assets/screenshots in bytes (default `8388608`).
|
|
42
|
+
- `TEMPAD_MCP_MAX_ASSET_STORE_BYTES`: Maximum aggregate size of the local asset store in bytes (default `268435456`).
|
|
43
|
+
- `TEMPAD_MCP_MAX_CONCURRENT_ASSET_UPLOADS`: Maximum simultaneous asset uploads (default `4`).
|
|
44
|
+
- `TEMPAD_MCP_MAX_EXTENSION_CONNECTIONS`: Maximum simultaneous browser extension connections to one Hub (default `16`).
|
|
45
|
+
- `TEMPAD_MCP_ALLOWED_EXTENSION_ORIGINS`: Comma-separated exact `chrome-extension://...` origins allowed to connect. Invalid configured values fail startup rather than weakening the policy. When omitted, any syntactically valid Chrome extension origin is accepted for backward compatibility.
|
|
42
46
|
- `TEMPAD_MCP_ASSET_TTL_MS`: Asset cleanup TTL in milliseconds based on last access; set `0` to disable (default `2592000000`).
|
|
43
47
|
- `TEMPAD_MCP_RUNTIME_DIR`: Override runtime directory (defaults to system temp under `tempad-dev/run`).
|
|
44
48
|
- `TEMPAD_MCP_LOG_DIR`: Override log directory (defaults to system temp under `tempad-dev/log`).
|
|
45
49
|
- `TEMPAD_MCP_ASSET_DIR`: Override asset storage directory (defaults to system temp under `tempad-dev/assets`).
|
|
46
50
|
|
|
51
|
+
The hub accepts WebSocket handshakes only from Chrome extension origins on its root path. For a locked-down installation, configure `TEMPAD_MCP_ALLOWED_EXTENSION_ORIGINS` with the TemPad Dev extension origin shown by the browser. This origin check and the per-process asset capability reduce cross-origin loopback abuse, but do not authenticate another process running as the same OS user; see the [local MCP threat model](../../docs/security/local-mcp-threat-model.md).
|
|
52
|
+
|
|
47
53
|
## Requirements
|
|
48
54
|
|
|
49
55
|
- Node.js 18.20.0+
|
package/README.zh-Hans.md
CHANGED
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
说明:
|
|
27
27
|
|
|
28
28
|
- 工具响应共用 `64 KiB` 的 inline budget,按 `CallToolResult` 整体响应体积计算。若选区过大而超出 `get_code` 的预算,TemPad Dev 可能返回 shell response 而不是直接失败。shell 会保留当前节点的包裹结构,并在内联代码注释中列出被省略的直接子节点 id,方便 agent 逐个继续拉取;配套 warning 只保留最小化的提示信息,用来指向这条注释。
|
|
29
|
-
- 资源是临时且与工具调用关联的;图片/SVG
|
|
29
|
+
- 资源是临时且与工具调用关联的;图片/SVG 请直接使用工具结果中带 capability 的 HTTP `asset.url` 下载。完整 URL 应视作临时密钥,不要持久化到日志中。
|
|
30
30
|
- MCP 不再暴露 `resources/list` / `resources/read` 用于 asset 内容读取。
|
|
31
|
-
- HTTP 回退 URL 使用 `/assets/{hash}`,也可能带图片扩展名(例如 `/assets/{hash}.png
|
|
31
|
+
- HTTP 回退 URL 使用 `/{capability}/assets/{hash}`,也可能带图片扩展名(例如 `/{capability}/assets/{hash}.png`),两种文件名形式都支持。
|
|
32
32
|
|
|
33
33
|
## 配置
|
|
34
34
|
|
|
@@ -37,11 +37,17 @@
|
|
|
37
37
|
- `TEMPAD_MCP_TOOL_TIMEOUT`:工具调用超时时间(毫秒,默认 `15000`)。
|
|
38
38
|
- `TEMPAD_MCP_AUTO_ACTIVATE_GRACE`:仅一个扩展连接时自动激活前的延迟(默认 `1500`)。
|
|
39
39
|
- `TEMPAD_MCP_MAX_ASSET_BYTES`:截图/资源捕获的最大上传体积(字节,默认 `8388608`)。
|
|
40
|
+
- `TEMPAD_MCP_MAX_ASSET_STORE_BYTES`:本地资源存储总量上限(字节,默认 `268435456`)。
|
|
41
|
+
- `TEMPAD_MCP_MAX_CONCURRENT_ASSET_UPLOADS`:资源并发上传上限(默认 `4`)。
|
|
42
|
+
- `TEMPAD_MCP_MAX_EXTENSION_CONNECTIONS`:单个 Hub 同时允许的浏览器扩展连接上限(默认 `16`)。
|
|
43
|
+
- `TEMPAD_MCP_ALLOWED_EXTENSION_ORIGINS`:允许连接的精确 `chrome-extension://...` Origin,以逗号分隔。配置值无效时启动会直接失败,而不会弱化策略;未配置时为了向后兼容会接受所有格式合法的 Chrome 扩展 Origin。
|
|
40
44
|
- `TEMPAD_MCP_ASSET_TTL_MS`:资源基于最近访问时间的清理 TTL(毫秒);设置为 `0` 表示禁用(默认 `2592000000`)。
|
|
41
45
|
- `TEMPAD_MCP_RUNTIME_DIR`:运行时目录覆盖(默认在系统临时目录下的 `tempad-dev/run`)。
|
|
42
46
|
- `TEMPAD_MCP_LOG_DIR`:日志目录覆盖(默认在系统临时目录下的 `tempad-dev/log`)。
|
|
43
47
|
- `TEMPAD_MCP_ASSET_DIR`:资源存储目录覆盖(默认在系统临时目录下的 `tempad-dev/assets`)。
|
|
44
48
|
|
|
49
|
+
Hub 仅接受来自 Chrome 扩展 Origin、且目标为根路径的 WebSocket 握手。如需收紧安装环境,请将浏览器中显示的 TemPad Dev 扩展 Origin 写入 `TEMPAD_MCP_ALLOWED_EXTENSION_ORIGINS`。Origin 校验与每次进程启动生成的 asset capability 可以降低跨 Origin 的 loopback 滥用,但不能认证以同一操作系统用户运行的其他进程;详见[本地 MCP 威胁模型](../../docs/security/local-mcp-threat-model.md)。
|
|
50
|
+
|
|
45
51
|
## 要求
|
|
46
52
|
|
|
47
53
|
- Node.js 18.20.0+
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as LOCK_PATH, c as SOCK_PATH, d as log, l as ensureDir, o as PACKAGE_VERSION, s as RUNTIME_DIR } from "./shared-
|
|
2
|
+
import { a as LOCK_PATH, c as SOCK_PATH, d as log, l as ensureDir, o as PACKAGE_VERSION, s as RUNTIME_DIR } from "./shared-BAyjEPbx.mjs";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import { connect } from "node:net";
|
|
5
5
|
import { join } from "node:path";
|