Skip to main content
Glama
lonniev

tollbooth-shortlinks

by lonniev

Tollbooth Shortlinks

License Version Python

Don't Pester Your Customer™ (DPYC™) — 为 Tollbooth 生态系统提供的临时、人性化的短 URL。

本项目中的隐喻借鉴自 The Phantom Tollbooth ,作者 Norton Juster,插图 Jules Feiffer(1961)。Milo、Tock、Tollbooth、Dictionopolis 和 Digitopolis 都是 Juster 先生非凡想象力的产物。我们只是构建了支付基础设施。


为什么存在

OAuth 授权 URL 又长又丑,对复制粘贴不友好:

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 服务器需要向用户提供一次性 URL 以进行 OAuth 流程时,这些都不应该出现在路径中。

Tollbooth Shortlinks 是一个社区工具,不涉及任何商业化。它将任何 URL 转换为一个易记的四词短语,如 brave-otter-finds-gold,将映射存储在 Neon Postgres 中,并在 24 小时后过期。配套的 Val Town HTTP 处理器执行 302 重定向,没有任何插页。

Related MCP server: url-shortener-mcp

工作原理

MCP Server                    Shortlinks MCP              Val Town
    |                              |                         |
    |-- create_shortlink(url) ---->|                         |
    |<-- brave-otter-finds-gold ---|                         |
    |                              |                         |
    |  (patron clicks short URL)   |                         |
    |                              |    GET /brave-otter-..  |
    |                              |<------------------------|
    |                              |    Neon lookup           |
    |                              |-- 302 redirect -------->|
    |                              |                         |
    |        (24h later)           |                         |
    |                              |  link expires silently   |

工具

Tool

Description

create_shortlink

存储 URL,返回一个易记的 slug(或提供你自己的)

resolve_shortlink

查找 slug 指向的位置,而不进行重定向

delete_shortlink

在过期之前删除短链接

shortlink_status

健康检查,显示活动链接数量和 TTL

所有工具都是免费的——无需积分、无需 npub、无需 Tollbooth 账本。

安装

pip install -e ".[dev]"

本地运行

export NEON_SHORTLINKS_URL="postgres://user:pass@ep-xyz.us-east-2.aws.neon.tech/shortlinks"
python -c "from server import mcp; mcp.run()"

部署到 Horizon

仓库根目录下的 .fastmcp.yaml 已准备好用于 fastmcp deploy。

DPYC 身份

Tollbooth Shortlinks 在 DPYC 社会契约中注册为倡导者。对等 MCP 服务器通过注册表查找发现其 URL:

from tollbooth import resolve_service_by_name

shortlinks_url = resolve_service_by_name("tollbooth-shortlinks")
redirect_base  = resolve_service_by_name("tollbooth-shortlinks-redirect")

相关仓库

Tollbooth DPYC™ 生态系统:

Repo

Role

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

tollbooth-shortlinks(本仓库)

社区工具——用于 OAuth 流程的临时短 URL

tollbooth-oauth2-collector

OAuth2 回调收集器——基于浏览器的令牌交换

tollbooth-pricing-studio

iOS 应用——运营商仪表盘和定价模型编辑器

许可证

Apache-2.0。详见 LICENSE。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables creation of short links, dynamic QR codes, UTM templates, and hosted vCards with click/scan analytics through natural language conversations.
    46 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables creation and management of short links with custom slugs, QR repointing, and cookieless analytics from any MCP client.
    9 npm
    MIT