关于 tollbooth-shortlinks
这是 Tollbooth MCP 服务的社区短链接工具,可将 URL 转成易记短链接,包括 OAuth 流程链接。映射存储在 Neon Postgres 中,24 小时后过期;配套的 Val Town 处理程序会直接重定向,不插入中间页。
主要功能
- 01创建易记的短链接
- 02查询短链接目标但不重定向
- 03过期前删除链接
- 04报告有效链接数量与 TTL
- 05免费工具,链接有效期为 24 小时
适用场景
- 01分享较长的 OAuth 授权 URL
- 02查询短链接指向的地址
- 03在链接过期前将其删除
- 04检查链接服务状态与有效链接
MCP 相关
通过免费的 MCP 工具提供 `create_shortlink`、`resolve_shortlink`、`delete_shortlink` 和 `shortlink_status`。配套的 Val Town 处理程序解析短链接并执行重定向。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://tollbooth-shortlinks.fastmcp.app/mcpclaude mcp add --transport http lonniev-tollbooth-shortlinks https://tollbooth-shortlinks.fastmcp.app/mcp{"mcpServers":{"lonniev-tollbooth-shortlinks":{"type":"http","url":"https://tollbooth-shortlinks.fastmcp.app/mcp"}}}在 Cursor 中打开{"servers":{"lonniev-tollbooth-shortlinks":{"type":"http","url":"https://tollbooth-shortlinks.fastmcp.app/mcp"}}}在 VS Code 中打开{"mcpServers":{"lonniev-tollbooth-shortlinks":{"type":"http","url":"https://tollbooth-shortlinks.fastmcp.app/mcp"}}}{"mcpServers":{"lonniev-tollbooth-shortlinks":{"serverUrl":"https://tollbooth-shortlinks.fastmcp.app/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
4| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url | string | 是 | 要重定向到的目标 URL。 |
| slug | any | 否 | 可选的自定义 slug。如果省略,则会生成一个易记的短语 (例如 ``brave-otter-finds-gold``)。 |
详细介绍
Tollbooth 短链接
别烦扰客户™(DPYC™)——为 Tollbooth 生态系统提供的临时、人性化短网址。
本项目的隐喻出自 The Phantom Tollbooth ,我们对此满怀敬意。该书由 Norton Juster 创作,Jules Feiffer 绘制插图(1961)。Milo、Tock、收费亭、Dictionopolis 和 Digitopolis 都是 Juster 先生非凡想象力的结晶。我们只是搭建了支付基础设施。
为什么要做这个项目
OAuth 授权网址又长又丑,还不便于复制粘贴:
https://api.schwab.com/v1/oauth/authorize?client_id=abc123&redirect_uri=https%3A%2F%2F
fastmcp.cloud%2Foauth%2Fcallback%3Fserver_id%3D...&scope=...&response_type=code&state=...
传统的链接缩短服务如今都变得自作主张。它们会插入中间页面、追踪点击、要求注册账号、将功能设为付费,或按自己的规则悄悄让链接失效。当 MCP 服务需要提供一次性网址,让用户完成 OAuth 流程时,这些都不该成为其中的一环。
Tollbooth Shortlinks 是一款社区工具,不以盈利为目的。它能将任意网址转换成易记的四词短语,例如 brave-otter-finds-gold,将映射关系存储在 Neon Postgres 中,并在 24 小时后过期。配套的 Val Town HTTP 处理程序会直接执行 302 重定向,不插入任何中间页面。
工作原理
MCP Server / Patron Shortlinks MCP Neon Val Town
| | | |
|-- create_shortlink(url) ---->|-- INSERT ------>| |
|<-- short_url ----------------| | |
| | | |
|-- GET /brave-otter-finds-gold ----------------------------> |
| | |<-- lookup ---|
|<-- 302 redirect ----------------------------------------------|
| | | |
| (24h later) | expired rows are deleted |
工具
| 工具 | 描述 |
|---|---|
create_shortlink | 存储网址,并返回易记的短语(也可自行指定) |
resolve_shortlink | 查询短语指向的位置,但不执行重定向 |
delete_shortlink | 在短链接过期前将其删除 |
shortlink_status | 健康检查,显示有效链接数和 TTL |
所有工具均免费——无需 credits、npub,也无需 Tollbooth 账本。
安装
pip install -e ".[dev]"
本地运行
export NEON_SHORTLINKS_URL="<your Neon connection string>"
# optional: the redirect host put in front of each slug (default https://tollbooth.val.run)
export SHORTLINK_REDIRECT_BASE="https://tollbooth.val.run"
python -c "from server import mcp; mcp.run()"
val/redirect.js 中的 Val Town 处理程序读取相同的 NEON_SHORTLINKS_URL。
部署到 Horizon
仓库根目录下的 fastmcp.json 已可用于 fastmcp deploy。
DPYC 身份
Tollbooth Shortlinks 已在 DPYC Social Contract 中注册为倡导者。
其他 MCP 服务可通过向 Oracle 查询来发现它的网址;create_shortlink
会返回完整的 short_url,因此其他服务无需知道重定向主机:
from tollbooth.oracle_client import default_oracle_client
svc = await default_oracle_client().resolve_service(name="tollbooth-shortlinks")
shortlinks_url = (svc or {}).get("url", "")
基于 tollbooth-dpyc 构建的运营工具可免费使用此功能:tollbooth.shortlinks.create_shortlink(url)
会尽力完成查询和调用。
相关仓库
Tollbooth DPYC™ 生态系统:
| 仓库 | 作用 |
|---|---|
| tollbooth-dpyc | 车轮——运营方侧的信用账本、BTCPay 客户端、工具门控、约束引擎 |
| tollbooth-authority | 机构——费用收取、Schnorr 签名、购买认证 |
| dpyc-oracle | 预言机——社会契约治理、成员资格、禁用选举 |
| dpyc-community | 注册表——治理数据、运营方目录、社区规则 |
| tollbooth-sample | 参考运营方——完整接入 Tollbooth 的天气 API |
| cypher-mcp | 变现的图谱问答——基于 Neo4j/AuraDB 的命名 Cypher 查询 |
| schwab-mcp | Charles Schwab 券商 MCP——报价、持仓、订单和交易历史(只读) |
| excalibur-mcp | eXcalibur——将格式化内容发布到 X(Twitter) |
| thebrain-mcp | Personal Brain MCP——思维图谱、知识管理 |
| taxsort-mcp | 税务分类与归类 MCP |
| optionality-mcp | 期权分析 MCP |
| goodearth-mcp | Good Earth——按区域划分的农场气候分析 |
| beesknees-mcp | The Bee's Knees——变现的多人蜂王竞速游戏 |
| roastify-mcp | Roastify 咖啡目录与包装设计图 |
| ChartRemotely-mcp | ChartRemotely——通过配对的 Agent 操控桌面图表 |
| tollbooth-web | 面向运营方前端的共享浏览器 SDK |
| tollbooth-shortlinks(本仓库) | 社区工具——用于 OAuth 流程的临时短链接 |
| tollbooth-oauth2-collector | OAuth2 回调收集器——基于浏览器的令牌交换 |
| tollbooth-pricing-studio | iOS 应用——运营方仪表板与定价模型编辑器 |
许可证
Apache-2.0。详情请参阅 LICENSE。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。