使用说明
@fcannizzaro/断链mcp
MCP服务器扫描目录中的文件,提取HTTP链接并验证它们——在markdown表中报告断开的链接。
特性
- 递归扫描目录以查找与指定扩展名匹配的文件
- 从五种格式中提取链接:
- Markdown链接 —
[text](https://...) - Markdown图片 —
 - HTML锚点 —
<a href="https://..."> - HTML图像 —
<img src="https://..."> - 纯URL —
https://...
- Markdown链接 —
- 通过HTTP HEAD验证每个唯一的URL(使用GET回退)
- 重复URL以避免冗余请求
- 批处理请求(10个并发)以避免服务器不堪重负
- 返回一个包含文件、行号、状态和问题的断开链接的markdown表
工具
check-links
递归扫描目录中的文件以查找损坏的HTTP链接。
| 参数 | 类型 | 说明 |
|---|---|---|
directory |
string |
要扫描的根目录 |
extensions |
string[] |
要包含的文件扩展名(例如。 [".md", ".html"]) |
示例输出
当发现断开的链接时:
| File | Line | URL | Status | Issue |
|------------|------|----------------------------------|--------|---------------|
| readme.md | 10 | https://httpbin.org/status/404 | 404 | 404 Not Found |
| docs/api.md| 25 | https://dead.example.com | - | DNS resolution failed |
Found **2** broken link(s) out of **15** total across **3** file(s).
当所有链接都有效时:
All **15** link(s) across **3** file(s) are valid.
用法(示例)
克劳德桌面版
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"broken-links": {
"command": "bunx",
"args": ["--bun", "@fcannizzaro/broken-links-mcp"]
}
}
}
OpenCode
添加到您的 opencode.json:
{
"mcp": {
"broken-links": {
"type": "local",
"command": ["bunx", "--bun", "@fcannizzaro/broken-links-mcp"]
}
}
}
服务器使用MCP协议(JSON-RPC)通过stdio进行通信。
许可证
麻省理工学院