关于 Pipe Docs (SPR) MCP Server
Pipe Docs (SPR) MCP Server 面向查阅 Pipe 语言文档和源码的开发者,提供语义搜索、带引用的回答和代码符号查询。输入材料未描述该服务器自身的功能细节。
主要功能
- 01Pipe 文档语义搜索
- 02基于文档生成引用回答
- 03查询代码符号
适用场景
- 01查找 Pipe 语言文档
- 02获取带来源引用的说明
- 03定位代码中的符号
MCP 相关
作为 MCP 服务向客户端提供 Pipe 文档与源码的检索能力;具体工具定义未在输入中说明。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Pipe — 原生支持 MCP、可用于生产环境的运行时
首个内置 MCP 的语言,同时支持服务端和客户端。249 个内置功能,单个约 8 MB 的二进制文件。零依赖。 已正式列入官方 MCP Registry(v1.1.1,活跃)。可通过 GitHub MCP Registry 一键安装,用于 Copilot 和 VS Code。
v1.3 新增内容
Pipe v1.3.0 在 v1.2.0 的多 Agent 和视觉功能基础上进一步升级:
- 多 Agent 集群 —
ai_swarm/ai_swarm_trace/swarm_agent:具名 Agent 通过保留的工具调用将对话交接给彼此,并传递完整的消息历史记录。ai_swarm_stream支持实时观察进度(工具调用、交接、推理、可在运行过程中介入的轮次检查回调),现在还会在安全的情况下并行执行一轮中的独立工具调用。 ai_vision— 通过兼容 OpenAI 的视觉模型,针对图像提问(支持 http(s) URL、本地文件或原始字节)。- OpenCode Zen AI 提供商 — 第 6 个提供商,其免费层模型无需 API 密钥即可使用。
- 内置自更新程序 —
pipe --update/--update-check会获取最新的 GitHub 版本、验证校验和并替换当前版本。 tool_call— 直接调用已注册的工具,无需 LLM。file_lock/file_unlock— 真正支持跨进程的建议式文件锁定。if/else链中的elif关键字。ai_tool:parallel_safe标志 — Pipe 定义的fn工具现在也可以批量并行运行,而不仅限于内置功能。pipe -build现在支持真正的多文件项目,并保留相对的子目录路径。- 强化的沙箱 — 第 7 至第 11 轮审计:修复了文件系统写入门控漏洞、
wiki_search出站访问漏洞、exec_whitelistshell 注入漏洞,以及硬链接逃逸漏洞。 - 249 个内置功能 — 41 个 AI + 13 个 MCP + 195 个标准功能,高于 v0.9.3 的 226 个
- 23 个模块 — MQTT、SQLite、pipe-http、pipe-web、pipe-orm、pipe-cli 等
快速安装
curl -fsSL https://pipe-lang.com/install.sh | bash # Linux & macOS
Windows(PowerShell):irm https://pipe-lang.com/install.ps1 | iex
安装程序会下载最新版本、验证其 SHA256 校验和,并将 pipe 安装到 ~/.local/bin(以 root 身份运行时则安装到 /usr/local/bin)。使用 PIPE_VERSION=v1.0.0 固定版本。请参阅完整安装文档。
已安装的副本会自动更新到最新的 GitHub 版本:运行 pipe --update(或运行 pipe --update-check 仅检查更新,运行 pipe --version 查看当前版本)。更新程序会验证版本校验和,并就地替换二进制文件。
隐私与 DSGVO
Pipe 的设计符合 DSGVO / GDPR 要求:
- 零遥测与分析 — 二进制文件绝不会向外发送请求,不会有任何数据离开你的计算机
- 可自托管的单个二进制文件 — 完全在你的基础设施上运行
- 无云服务 — 不会有供应商的服务处理你的数据
- 开源(MIT) — 完全可审计
- 本地 AI — 使用 Ollama 时,没有任何字节会离开你的网络;仅在你配置云服务提供商时才会使用云服务
问题
在生产环境中运行 AI 比想象中更困难:
- 安全性 — 拥有文件访问、网络访问和
exec权限的大模型会带来风险。你需要在语言层面实现细粒度沙箱,而不是事后补上中间件。 - 性能 — 顺序调用 API 会让 1 秒的流水线变成 10 秒的瓶颈。并行处理不应该需要编写
asyncio.gather()样板代码。 - 供应商锁定 — 从 OpenAI 切换到 DeepSeek 意味着要重写 Python SDK 代码。更换提供商应该只需改一行。
- 工具集成 — 将大模型连接到外部工具(GitHub、数据库、文件系统)会陷入 SDK 和 API 封装的迷宫。MCP 应该是语言原语,而不是库。
Pipe 在语言层面解决了这个问题。
什么是 Pipe?
Pipe 是一种语义流水线运行时(SPR)——一种原生支持流水线的语言,其中 summarize、translate 和 classify 与 +、sort 和 len 处于同一语法层级。数据通过可组合的转换从上到下流动。单个二进制文件,零依赖。
Python + LangChain(约 80 行):
import openai
client = openai.OpenAI()
def summarize(text):
r = client.chat.completions.create(model="gpt-4o", messages=[{"role":"user","content":text}])
return r.choices[0].message.content
def translate(text, lang):
r = client.chat.completions.create(model="gpt-4o",
messages=[{"role":"system","content":f"Translate to {lang}"},{"role":"user","content":text}])
return r.choices[0].message.content
text = open("news.txt").read()
print(translate(summarize(text), "de"))
Pipe(5 行):
read_file "news.txt"
> summarize -- LLM call
> translate "de" -- LLM call
> print
模型上下文协议
Pipe 内置 MCP,既可以作为服务端,也可以作为客户端。无需 SDK、无需 npm 包、无需 Python。纯 Go 标准库。
MCP 服务端 — 暴露你的工具
fn get_weather city
match city
| "Berlin" -> "22°C, sunny"
| "London" -> "15°C, rainy"
| _ -> city ++ ": no data"
ai_tool "get_weather" "Get weather for a city" {city: "City name"} get_weather
mcp_server "Weather Agent" "1.0.0"
mcp_serve_stdio
在 Claude Desktop 中配置(claude_desktop_config.json):
{ "mcpServers": { "pipe": { "command": "/tmp/pipe", "args": ["agent.pipe"] } } }
MCP 客户端 — 使用外部工具
ai_provider "deepseek"
ai_set_key "deepseek" (env "DEEPSEEK_API_KEY")
-- Connect to GitHub + Filesystem MCP servers
mcp_use_stdio "npx" "-y" "@modelcontextprotocol/server-github" {GITHUB_TOKEN: (env "GITHUB_TOKEN")}
mcp_use_stdio "npx" "-y" "@modelcontextprotocol/server-filesystem" "/tmp"
-- AI discovers and uses all tools automatically
result: ai_with_tools "You are a DevOps assistant." "Search pipe's open issues and list files in /tmp." 10
print result
任何 stdio MCP 服务都能立即使用:Filesystem、GitHub、Git、Postgres、SQLite、Slack、Brave Search、Memory、Sequential Thinking——任何可通过 npm/uvx 获取的工具。
使用场景
日志分析 → 事件报告
is_critical: fn line
contains line "critical"
read_file "/var/log/app/errors.log"
> split "\n"
> filter is_critical
> summarize
> translate "de"
> save "incident_report.txt"
RAG 流水线
ai_provider "deepseek"
docs: read_lines "knowledge_base.txt"
vectors: embed_batch docs
question: "How does the bytecode VM work?"
q_vec: embed question
top: nearest q_vec vectors 3
context: ""
for idx in top
context: context ++ (at docs idx) ++ "\n---\n"
ask ("Context:\n" ++ context ++ "\nQuestion: " ++ question)
> print
支持工具调用的 AI Agent
fn get_weather city
match city
| "Berlin" -> "22°C, sunny"
| "London" -> "15°C, rainy"
| _ -> city ++ ": no data"
ai_tool "get_weather" "Get current weather for a city" {city: "Name of the city"} get_weather
ai_with_tools "You are a weather assistant." "What's the weather in Berlin and London?"
> print
并发 — 1.5 秒完成 3 次大模型调用,而非 4 秒
ai_provider "deepseek"
a: "Explain monads" >> ask
b: "What is CP/M?" >> ask
c: "Explain RFC 791" >> ask
print a ++ b ++ c -- Future auto-resolution
Discord CI/CD 通知
import "discord.pipe" as d
ai_provider "deepseek"
-- AI code review per commit, sent as Discord embed
review: ai_chat "Review this code change" diff 800
d.d_webhook_embed (env "DISCORD_WEBHOOK") {
title: "CI: Push to master",
color: 3447003,
fields: [
{name: "Changed Files", value: stat},
{name: "AI Review", value: review}
]
}
对比:Pipe 与 Python + LangChain
| Python + LangChain | Pipe | |
|---|---|---|
| RAG 流水线 | 约 80 行代码 | 约 8 行代码 |
| 沙箱化大模型访问 | 自定义中间件 | 一个 sandbox_profile 配置块 |
| 切换 AI 提供商 | 重写 SDK 调用 | ai_provider "deepseek" |
| 部署到服务端 | Docker + venv + pip | scp pipe binary |
| 并行大模型调用 | asyncio.gather() 样板代码 | >> 运算符,ai_batch |
| MCP 服务端 + 客户端 | 依赖库 | 13 个内置工具,零依赖,100 多个服务 |
| 二进制文件大小 | 约 500 MB(含依赖) | 约 8 MB |
特性
- 原生支持 MCP — 为 MCP 服务 + 客户端提供 13 个内置工具。纯 Go 标准库。可连接任何 stdio MCP 服务
- AI 流水线交付速度提升 10 倍 — 41 个 AI + 13 个 MCP 内置工具:无需导入、无需 SDK、无需 API 封装
- 一行代码锁定 AI Agent — 声明式沙箱配置:使用一个代码块限制
exec、write_file、http_get - 数秒内完成部署 — 一个静态链接的约 8 MB 二进制文件。无需 venv、pip 或 Docker。支持 Linux、macOS、Windows、Raspberry Pi,也可通过 WebAssembly 在浏览器中运行
- 1.5 秒内完成 3 次大模型调用,而非 4 秒 —
>>可在后台启动任何流水线阶段。Future 会自动解析。ai_batch可借助内置限流机制并发处理数百条文本 - 不受供应商锁定 — OpenAI、Anthropic(Claude)、DeepSeek、Ollama。只需一行即可切换。同一份代码可在所有平台运行
- 并发原语 — 通道(
send/recv)、互斥锁(lock/unlock)、计数信号量(acquire/release) - 原生流水线语法 —
>表示顺序执行,>>表示并行执行。数据自上而下流动,易读、易组合、易调试 - 内置社交平台支持 — Discord Webhook 和 Telegram 机器人可作为 Pipe 模块使用。AI 代码审查、通知、聊天——发送无需 API 费用
- 字节码虚拟机 — 编译为字节码,在带自动缓存的栈式虚拟机上运行。根据工作负载,实测性能为树遍历器的 0.6 倍至 55 倍(递归密集型代码最高约 55 倍)
- 模块生态系统 — 23 个精选模块,注册表支持固定版本(
@1.0.0)。使用pipe -get安装,按名称导入 - 内置测试 — 使用带有
assert_eq、assert_error的test代码块。运行pipe -test即可。零配置 - GitHub Action — 直接在 CI/CD 中运行 Pipe,无需安装
- VSCode 扩展 — 语法高亮、IntelliSense、由 LSP 驱动的诊断和补全
- 自解压二进制文件 — 将流水线打包为独立可执行文件(
pipe -build)
快速开始
git clone https://github.com/MachuraHarry/pipe && cd pipe && make build
export DEEPSEEK_API_KEY="sk-..."
./bin/pipe -vm -q -c 'ai_provider "deepseek"; ask "What makes Pipe different?" > print'
在浏览器中试用
无需安装——Pipe 可通过 WebAssembly 完全在浏览器中运行:
-- Paste this into the playground and hit Run
levels: ["error","warn","info"]
read_file "server.log"
> classify levels
> summarize
> print
GitHub Action
直接在 CI/CD 中运行 Pipe,无需安装:
- uses: MachuraHarry/pipe/.github/actions/pipe-action@master
with:
script: |
print "Hello from CI/CD!"
log: exec "git log --oneline -20"
print (get log "output")
VSCode 扩展
为 .pipe 文件提供语法高亮和完整的 IntelliSense,由语言服务器协议客户端(vscode/)和 pipe-lsp 服务端(cmd/pipe-lsp)驱动:
- 补全、悬停文档、签名帮助、转到定义、引用、重命名
- 诊断(解析错误、未定义/未使用的变量)和语义高亮
- 格式化文档、括号自动补全、自动缩进和代码折叠
make vsix # builds the server and packages vscode/pipe-syntax-1.0.0.vsix
或者在开发模式下,从 vscode/ 文件夹按 F5 运行扩展。请参阅 VSCode 扩展文档。
模块生态系统
Pipe 拥有一个精选模块库,包含 23 个可复用模块,并支持固定版本:
| 基础设施 | 数据与命令行 | AI 与 Agent | 开发工具 | 社交 |
|---|---|---|---|---|
pipe-http | sqlite | rag-pipe | pipe-test | telegram-bot |
pipe-cli | jpipe | log-analyzer | pipe-validate | mqtt |
pipe-orm | pipe-tpl | sentiment | ||
pipe-web | pipe-date | code-review | ||
translate-batch | ||||
changelog-gen | ||||
email-classifier | ||||
incident-report | ||||
parallel-runner | ||||
date-formatter | ||||
docs-pipe |
pipe -search # Browse modules
pipe -search sql # Filter by keyword
pipe -get sqlite # Install latest
pipe -get [email protected] # Install specific version
import "sqlite" -- database engine
import "pipe-http" -- HTTP client
import "mqtt" -- MQTT 5.0 client
import "discord.pipe" as d -- Discord webhooks + bot
idx: index_create h "knowledge"
index_add idx "Pipe is an AI-native language."
index_search idx "language" 3 > each print
执行模式
| 模式 | 命令 | 速度 |
|---|---|---|
| Tree-Walker | ./bin/pipe script.pipe | 基准 |
| Bytecode VM | ./bin/pipe -vm -q script.pipe | 0.6x-55x(递归密集型场景下最高约 55x) |
54 个 AI + MCP 内置函数(41 个 AI + 13 个 MCP)
理解
summarize、translate、classify、extract、ask、generate、generate_json
速度与控制
ai_stream、ai_batch、ai_parallel、ai_rate_limit、ai_chat、ai_chat_json
搜索与检索
web_search、wiki_search、embed、embed_batch、cosine_sim、dot_product、nearest
Agent 与工具
agent、agent_ask、agent_clear、ai_tool、ai_with_tools、tool_call、swarm_agent、ai_swarm、ai_swarm_trace、ai_swarm_stream、ai_vision
配置与成本
ai_provider、ai_model、ai_host、ai_set_key、ai_timeout、ai_cache、ai_cost、ai_tokens、ai_cache_hits、ai_cache_misses
MCP — Model Context Protocol
mcp_server、mcp_serve_stdio、mcp_serve_sse、mcp_tools、mcp_resource、mcp_resource_template、mcp_prompt、mcp_resources、mcp_read_resource、mcp_prompts、mcp_prompt_get、mcp_use_stdio、mcp_use_sse
自我修复
try_ai、try_ai_log
高级功能
自我修复代码(try_ai)
ai_provider "deepseek"
result: try_ai
"42" * 3 -- E002 Type Error -> AI wraps with to_num -> 126
catch e
0 -- only reached if AI fix fails
print result -- 126
并行管道(>>)
a: "Frage A"
>> ask
b: "Frage B"
>> ask
c: "Frage C"
>> ask
print a ++ b ++ c -- Future auto-resolution
Match 中的守卫子句
fn classify severity
match severity
| s if s > 9 -> "critical"
| s if s > 5 -> "warning"
| _ -> "info"
并发:通道
ch: chan 3
go { send ch "hello" }
go { send ch "world" }
print (recv ch) ++ " " ++ (recv ch)
沙箱配置
sandbox_profile "safe" {fs: "read-only", network: false, exec: false, ai: true}
sandbox_profile "agent" {fs: "temp-only", network: true, exec: false, ai: true}
set_sandbox "safe"
read_file "/etc/config" -- reading allowed
write_file "/etc/config" -- E_SANDBOX blocked
架构
Source (.pipe) -> Lexer -> Parser -> AST -> [ Tree-Walker | Compiler + VM ]
|
Builtins (249 total: 41 AI + 13 MCP + 195 standard)
|
MCP Server <-> MCP Clients (stdio + HTTP)
- 67 种令牌类型、43 种 AST 节点类型、43 条操作码
- 约 37,000 行 Go 代码、752 个测试、101 个示例程序
- 零依赖——纯 Go 标准库
文档
项目结构
pipe/
├── cmd/
│ ├── pipe/main.go # Entry point
│ └── pipe-lsp/ # Language Server Protocol server (IntelliSense)
├── pkg/
│ ├── ai/ # AI provider integrations
│ ├── analysis/ # IntelliSense library (builtins, diagnostics, completion...)
│ ├── ast/ # AST node definitions
│ ├── build/ # Self-extracting binary builder
│ ├── cache/ # Bytecode cache
│ ├── compiler/ # Compiler to bytecode
│ ├── eval/ # Tree-walk interpreter
│ ├── formatter/ # Code formatter
│ ├── gen/ # Code generation helpers
│ ├── lexer/ # Lexer and tokens
│ ├── mcp/ # MCP server + client (zero-dependency)
│ ├── object/ # Runtime objects
│ ├── parser/ # Parser
│ ├── stdlib/ # Standard library helpers
│ └── vm/ # Bytecode VM
├── examples/ # 87 example programs
├── test/integration/ # Integration tests
├── vscode/ # VSCode extension (syntax highlighting + LSP client)
├── docs/ # Documentation (DE + EN)
├── website/ # Project website
├── modules/ # Language modules (mqtt, discord, x, etc.)
├── Makefile
├── go.mod
└── LICENSE
贡献
请参阅 CONTRIBUTING.md。
许可证
MIT — 请参阅 LICENSE。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。