
MCP服务器和CLI工具,用于与互联网档案馆的Wayback Machine交互
概览
MCP服务器和CLI工具,用于与互联网档案馆的Wayback Machine交互。支持完整的CDX搜索、快照内容检索、截图列表、快照比较,以及针对更高SPN2速率限制的可选认证。 TypeScript ·Node.js 22+ ·ES 模块 ·PNPM ·Turbo ·Zod 可选凭据(匿名访问可行,但认证请求的速率限制更高): 在 archive.org/account/s3.php 获取资格证书。 端到端测试通过实时的Wayback Machine API,并需选择加入: PNPM 验证是发布前必须通过的门。PrepublishOnly 自动运行。 src/bin.ts 是入口点。它检测该入口是作为CLI调用还是作为MCP服务器加载,并据此路由。 每个工具模块导出一个模式(由 ListToolsRequestSchema 消耗)和一个执行函数(由 CallToolRequestSchema 调用)。新工具需要同时注册server.ts。
概述(AI 翻译)
MCP 服务器和 CLI 工具,用于与互联网档案馆的 Wayback Machine 交互。支持完整的 CDX 搜索、快照内容检索、截图列表、快照比较,以及针对更高 SPN2 速率限制的可选认证。
Stack: TypeScript ·Node.js 22+ ·ES 模块 ·PNPM ·Turbo ·Zod
开始
需要Node.js 22+ 和 pnpm。
可选凭据(匿名访问可行,但认证请求的速率限制更高):
在 archive.org/account/s3.php 获取资格证书。
构建、测试和去除绒毛
要运行单个测试文件:
端到端测试通过实时的Wayback Machine API,并需选择加入:
pnpm validate 是必须通过的门,才能释放。prepublishOnly 会自动运行。
建筑
src/bin.ts 是入口点。它检测该入口是作为CLI调用还是作为MCP服务器加载,并据此路由。
每个工具模块导出一个模式(由ListToolsRequestSchema消耗)和一个执行函数(由CallToolRequestSchema消耗)。新工具需要在server.ts中同时注册两个。
缓存TTL是有意为之——不要将其归一化:
| 资源 | 时间线 | 理由 |
|---|
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Wayback Machine Server
MCP server and CLI tool for interacting with the Internet Archive’s Wayback Machine. Supports full CDX search, snapshot content retrieval, screenshot listing, snapshot comparison, and optional authentication for higher SPN2 rate limits.
Stack: TypeScript · Node.js 22+ · ES Modules · pnpm · Turbo · Zod
Getting started
Requires Node.js 22+ and pnpm.
pnpm install
Optional credentials (anonymous access works, but authenticated requests get higher SPN2 rate limits):
export WAYBACK_ACCESS_KEY="your-access-key"
export WAYBACK_SECRET_KEY="your-secret-key"
Obtain credentials at archive.org/account/s3.php.
Build, test, and lint
pnpm validate # typecheck + lint + build + test + untested-files check (the full CI gate)
pnpm check # typecheck + lint + build only
pnpm build # compile TypeScript to dist/
pnpm test # run unit and integration tests
pnpm test:coverage # run tests with coverage (80% line/branch/function threshold)
pnpm lint # lint with ESLint
pnpm lint:fix # auto-fix lint issues
To run a single test file:
node --test tests/tools/save.unit.test.ts
End-to-end tests hit the live Wayback Machine API and are opt-in:
pnpm test:e2e # sets WAYBACK_LIVE_TESTS=1 internally via turbo
pnpm validate is the gate that must pass before a release. prepublishOnly runs it automatically.
Architecture
src/bin.ts is the entry point. It detects whether it is invoked as a CLI or loaded as an MCP server and routes accordingly.
src/
bin.ts — entry point; dispatches to CLI or MCP server
cli.ts — Commander-based CLI implementation
server.ts — MCP server wiring (ListTools + CallTool handlers)
contexts.ts — shared context (rate limiter, cache, credentials)
schemas.ts — Zod schemas for all tool inputs; single source of truth
tools/
安装
npx -y mcp-wayback-machine