
一个使用 linkinator 提供链接检查能力的模型上下文协议(MCP)服务器。这使得像 Claude 这样的AI助手可以扫描网页和本地文件中的断链。
最简单的方法是使用 install-mcp 工具,它会自动为 Claude Desktop、Claude Code、Cursor、Cline 和其他MCP客户端配置 linkinator-mcp:
npx install-mcp linkinator-mcp --client claude
这会自动处理所有配置。安装后重启你的 Claude 客户端。
如果你更喜欢手动配置服务器,可以直接编辑MCP客户端的配置文件。
编辑 ~/.config/claude-code/config.json:
{
"mcpServers": {
"linkinator": {
"command": "npx",
"args": ["linkinator-mcp"]
}
}
}
编辑 %APPDATA%\claude-code\config.json:
{
"mcpServers": {
"linkinator": {
"command": "npx",
"args": ["linkinator-mcp"]
}
}
}
如果你希望先用 npm install -g linkinator-mcp 全局安装该包,可以简化配置:
{
8"mcpServers": {
"linkinator": {
"command": "linkinator-mcp"
}
}
}
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"linkinator": {
"command": "npx",
"args": ["linkinator-mcp"]
}
}
}
编辑 %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"linkinator": {
"command": "npx",
"args": ["linkinator-mcp"]
}
}
}
更新配置后,重启你的 Claude 客户端以使更改生效。
配置完成后,你可以让 Claude 检查任何网页或本地文件中的链接。以下是一些示例提示:
检查 https://example.com 上的所有链接
递归扫描 https://example.com 并检查同一域内的所有链接
检查 /path/to/my/documentation/index.html 中的链接
使用以下选项检查 https://example.com:
- 在所有页面上递归
- 检查CSS中的URL
- 验证锚片段
- 跳过指向google.com和facebook.com的链接
- 设置10秒超时
scan_page 工具支持 linkinator 的所有CLI选项:
工具返回一个格式化的报告,显示:
Linkinator 扫描结果:https://example.com
概要:
状态:✓ 通过 / ✗ 失败
总链接数:150
正常:145
断链:5
跳过:0
断链:
状态 404:
- https://example.com/missing-page
发现于:https://example.com/index.html
- https://example.com/old-blog-post
发现于:https://example.com/blog.html
状态 500:
- https://api.example.com/endpoint
发现于:https://example.com/docs.html
config.json 中的路径是否为绝对路径,而非相对路径ls /path/to/linkinator-mcp/build/index.js如果在 macOS/Linux 上遇到权限错误:
chmod +x /path/to/linkinator-mcp/build/index.js
如果在扫描本地文件时遇到端口错误,请指定一个端口:
使用端口 9000 检查 /path/to/files
欢迎贡献!请参阅 CONTRIBUTING.md 了解如何开始。
MIT
Justin Beckwith justin.beckwith@gmail.com
使用 Model Context Protocol SDK 构建。