DS

dnovitski/surfshield

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 0 forks 质量 51 趋势 14

为 AI 代理(MCP 服务器和 CLI 提供安全、策略控制的网页访问)

概览

一个通过HTTP获取、获取、发布、发布、补丁和删除等安全策略访问网站的Rust工具,可作为(适用于Claude代码、Claude桌面及其他MCP客户端)或作为。 这会安装最新版本(Apple Silicon)预构建的二进制文件,因此不需要 Rust 工具链或访问 crates.io。示例配置在 $(brew --prefix)/share/surfshield/surfshield.example.toml 中。要更新,运行 brew upgrade surfshield。 结果包括一个带有元数据(状态、最终URL、重定向、响应头、截断)的JSON块,以及除save_to外的第二个包含正文的块。在标记降(markdown)模式下,正文被>>标记包裹;在原始模式下,正文不变。 , , , : HTTP POST, PUT, PATCH 和 DELETE。这些工具会在远程站点上改变状态(表单、API 调用、删除)。它们是独立的工具,所以你可以在 MCP 客户端中选择每个方法是否请求确认。 最多只有正文、json和表单。

概述(AI 翻译)

一个通过HTTP访问网站的Rust工具:GET/HEAD/POST/PUT/PATCH/DELETE 在安全策略下,可作为MCP服务器使用(针对Claude代码,Claude桌面版) 以及其他MCP客户端)或作为CLI。

安装

自制内容:

这会安装最新版本的预构建二进制文件 (苹果硅片),因此不需要 Rust 工具链或访问 crates.io。示例配置如下 $(brew --prefix)/share/surfshield/surfshield.example.toml。要更新,请运行brew upgrade surfshield。

或者引用来源:

作为MCP服务器的使用

用你自己的配置:

工具

fetch_url: HTTP GET。

参数 描述
url http(s) URL
format markdown(默认):HTML → Markdown,JSON精美印刷。raw:正文完全 收到的(如果非有效 UTF-8,则为base64)
headers 额外的请求头,例如 {"Accept": "application/json"}
max_chars 最大身体字符数(以max_output_chars上限)
[save_to 将该路径的正文相对于download_dir保存。仅返回元数据(路径、字节、SHA-256)
[overwrite 替换save_to中的现有文件

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

surfshield: controlled web access for AI agents

A Rust tool that accesses websites over HTTP GET/HEAD/POST/PUT/PATCH/DELETE under a security policy, usable as an MCP server (for Claude Code, Claude Desktop and other MCP clients) or as a CLI.

Install

With Homebrew:

brew install dnovitski/tap/surfshield

This installs the prebuilt binary from the latest release (Apple Silicon), so no Rust toolchain or access to crates.io is needed. An example config is then in $(brew --prefix)/share/surfshield/surfshield.example.toml. To update, run brew upgrade surfshield.

Or from source:

cargo install --path .

Use as an MCP server

claude mcp add surfshield -- surfshield serve

With your own config:

claude mcp add surfshield -- surfshield serve --config /path/to/surfshield.toml

Tools

fetch_url: HTTP GET.

Parameter Description
url http(s) URL
format markdown (default): HTML → Markdown, JSON pretty-printed. raw: the body exactly as received (base64 if it is not valid UTF-8)
headers Extra request headers, e.g. {"Accept": "application/json"}
max_chars Max. number of body characters (capped by max_output_chars)
save_to Save the exact body to this path, relative to download_dir. Only metadata is returned (path, bytes, SHA-256)
overwrite Replace an existing file at save_to

The result consists of a JSON block with metadata (status, final URL, redirects, response headers, truncation) and, except with save_to, a second block with the body. In markdown mode the body is wrapped in >> markers; in raw mode it is unchanged.

post_url, put_url, patch_url, delete_url: HTTP POST, PUT, PATCH and DELETE. These tools change state on the remote site (forms, API calls, deletions). They are separate tools, so you can choose per method in your MCP client whether to ask for confirmation.

Parameter Description
url http(s) URL
body Raw body, sent exactly (default Content-Type: text/plain; charset=utf-8)
json JSON body, sent with Content-Type: application/json
form Form fields, URL-encoded with Content-Type: application/x-www-form-urlencoded
headers, format, max_chars, save_to, overwrite As with fetch_url

At most one of body, json and form. Without a body, POST, PUT and PATCH send an empty body (Content-Length: 0) and DELETE sends none. A Content-Type in headers overrides the default. The result has the same shape as with fetch_url.

head_url: HTTP HEAD; returns status, final URL and response headers.

Use as a CLI

surfshield get https://example.com
surfshield get --raw https://example.com > page.html
surfshield get -o page.html https://example.com
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →