ZeekeGitbook MCP服务器
GitBook文档报废代理账本平台MCP服务器
轻松地从GitBook文档网站抓取和提取内容。专门针对 锆石文件 但适用于任何基于GitBook的网站。
   
______________________________________________________________________
📋 目录
______________________________________________________________________
概述
ZeekeGitbook MCP Server为AgentLedger平台带来了强大的文档抓取功能。专为Git Book网站构建,它使AI代理能够:
- 📑 提取导航结构 -自动发现所有页面
- 📄 删除单页 -从任何页面获取干净的标记
- 📦 批量抓取页面 -高效处理多个URL
- 🗺️ 废弃整个网站 -自动发现并抓取所有文档
- 🔍 搜索文档 -在所有页面中查找内容
为什么选择ZeekeGitbook?
- 免费替代品 -与Firecrawl不同,不需要API信用
- GitBook优化 -专为GitBook结构设计
- 清除Markdown -针对AI/LLM处理进行了内容优化
- 智能提取 -自动删除导航、页脚、广告
- 生产就绪 -Zircuit文档上的战斗测试
______________________________________________________________________
特性
核心能力
✅ 5强大的工具
gitbook_get_navigation-提取网站导航/TOCgitbook_scrape_page-单页提取gitbook_scrape_multiple-批量抓取URLgitbook_scrape_all-全网站抓取gitbook_search-在文档中搜索
✅ 高级功能
- 自动导航发现
- 分层页面结构提取
- 同时抓取并限制速率
- 干净的markdown转换(HTML→ Markdown)
- 链接提取和跟踪
- 元数据提取(标题、描述)
- 错误处理和重试逻辑
✅ 生产就绪
- 100%测试覆盖率(6/6测试通过)
- TypeScript严格模式
- 对所有输入进行Zod验证
- 标准化错误处理
- 性能监控
- Zircuit文档上的真实世界测试
______________________________________________________________________
快速开始
安装
# Clone the repository
git clone https://github.com/oregpt/Agenticledger_MCP_ZeekeeGitbook.git
cd Agenticledger_MCP_ZeekeeGitbook
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run tests
npm test基本用法
import {
gitbookGetNavigation,
gitbookScrapePage
} from './dist/tools.js';
// Get navigation structure
const nav = await gitbookGetNavigation({
accessToken: 'none',
url: 'https://docs.zircuit.com/'
});
console.log(`Found ${nav.data.totalPages} pages`);
// Scrape a single page
const page = await gitbookScrapePage({
accessToken: 'none',
url: 'https://docs.zircuit.com/',
options: { includeMetadata: true }
});
console.log(page.data.markdown);______________________________________________________________________
身份验证模式
身份验证模式:无(公共文档)
工作原理:
- 公共GitBook网站不需要身份验证
- 使用
accessToken: "none"对于所有请求 - 平台将自动提供此值
- 对于私有的GitBook网站,平台将来可能会注入实际的代币
令牌格式:
{
accessToken: "none"
}如果不需要身份验证,为什么要使用“accessToken”?
根据AgentLedger平台标准,所有MCP服务器必须包括 accessToken 参数,即使不使用。这允许未来扩展到私人文档网站。
______________________________________________________________________
可用工具
1.gitbook_get_naviation
目的: 提取完整的导航结构(目录)
参数:
accessToken(string,必填):对公共文档使用“none”url(string,必填):GitBook网站的基本URLoptions(对象,可选):
- timeout:请求超时(毫秒)(默认值:30000) - userAgent:自定义用户代理(默认:“AgentLedger Bot/1.0”)
例子:
{
accessToken: "none",
url: "https://docs.zircuit.com/",
options: {
timeout: 30000
}
}答复:
{
"success": true,
"data": {
"baseUrl": "https://docs.zircuit.com/",
"navigation": [
{
"title": "Overview",
"href": "https://docs.zircuit.com/",
"type": "page"
},
{
"title": "Architecture",
"href": null,
"type": "group",
"children": [...]
}
],
"totalPages": 42,
"metadata": {
"responseTime": 450,
"timestamp": "2025-11-01T00:00:00.000Z"
}
}
}______________________________________________________________________
2.gitbook_scrape_page
目的: 删除单页并转换为干净的markdown
参数:
accessToken(string,必填):对公共文档使用“none”url(字符串,必填):要抓取的页面的完整URLoptions(对象,可选):
- includeMetadata:包含页面元数据(默认值:true) - includeLinks:提取所有链接(默认值:false) - timeout:请求超时(毫秒)(默认值:30000) - userAgent:自定义用户代理
例子:
{
accessToken: "none",
url: "https://docs.zircuit.com/build/start",
options: {
includeMetadata: true,
includeLinks: true
}
}答复:
{
"success": true,
"data": {
"url": "https://docs.zircuit.com/build/start",
"markdown": "# Quick Start\n\nGet started building on Zircuit...",
"metadata": {
"title": "Quick Start | Zircuit",
"description": "Learn how to build on Zircuit",
"url": "https://docs.zircuit.com/build/start"
},
"links": ["https://...", ...],
"linkCount": 15,
"responseMetadata": {
"responseTime": 213,
"characterCount": 1565,
"timestamp": "2025-11-01T00:00:00.000Z"
}
}
}______________________________________________________________________
3.gitbook_scrape_multiple
目的: 批量报废多页
参数:
accessToken(string,必填):对公共文档使用“none”urls(string\[\],必填):要抓取的URL数组(最多50个)options(对象,可选):
- includeMetadata:每页包含元数据(默认值:true) - includeLinks:每页提取链接(默认值:false) - concurrency:并发请求,1-5(默认值:3) - timeout:每页超时(毫秒)(默认值:30000) - userAgent:自定义用户代理
例子:
{
accessToken: "none",
urls: [
"https://docs.zircuit.com/",
"https://docs.zircuit.com/readme/sls",
"https://docs.zircuit.com/build/start"
],
options: {
concurrency: 2
}
}答复:
{
"success": true,
"data": {
"pages": [
{
"url": "https://docs.zircuit.com/",
"markdown": "...",
"metadata": {...}
},
...
],
"totalPages": 3,
"totalCharacters": 6582,
"metadata": {
"responseTime": 1365,
"requestedUrls": 3,
"successfulScrapes": 3,
"timestamp": "2025-11-01T00:00:00.000Z"
}
}
}______________________________________________________________________
4.gitbook_scrape_all
目的: 自动发现并抓取整个网站
参数:
accessToken(string,必填):对公共文档使用“none”url(string,必填):GitBook网站的基本URLoptions(对象,可选):
- maxPages:要抓取的最大页面数,1-500(默认值:100) - includeMetadata:包含元数据(默认值:true) - includeLinks:提取链接(默认值:false) - concurrency:并发请求,1-5(默认值:3) - timeout:每页超时(毫秒)(默认值:30000) - userAgent:自定义用户代理
例子:
{
accessToken: "none",
url: "https://docs.zircuit.com/",
options: {
maxPages: 10,
concurrency: 2
}
}答复:
{
"success": true,
"data": {
"baseUrl": "https://docs.zircuit.com/",
"pages": [
{
"url": "...",
"markdown": "...",
"metadata": {...}
},
...
],
"totalPages": 3,
"totalCharacters": 22368,
"navigation": [...],
"metadata": {
"responseTime": 1507,
"discoveredPages": 3,
"scrapedPages": 3,
"limitApplied": false,
"timestamp": "2025-11-01T00:00:00.000Z"
}
}
}______________________________________________________________________
5.gitbook_search
目的: 在文档中搜索内容
参数:
accessToken(string,必填):对公共文档使用“none”url(string,必填):GitBook网站的基本URLquery(字符串,必填):搜索查询options(对象,可选):
- maxResults:最大结果,1-50(默认值:10) - includeSnippets:包含文本片段(默认值:true) - caseSensitive:区分大小写的搜索(默认值:false) - timeout:超时(毫秒)(默认值:30000) - userAgent:自定义用户代理
例子:
{
accessToken: "none",
url: "https://docs.zircuit.com/",
query: "smart contract deployment",
options: {
maxResults: 5,
includeSnippets: true
}
}答复:
{
"success": true,
"data": {
"query": "smart contract deployment",
"results": [
{
"url": "https://docs.zircuit.com/build/start",
"title": "Quick Start",
"snippet": "...deploy smart contracts to Zircuit...",
"matchCount": 3
},
...
],
"totalResults": 5,
"searchedPages": 3,
"metadata": {
"responseTime": 2156,
"caseSensitive": false,
"timestamp": "2025-11-01T00:00:00.000Z"
}
}
}______________________________________________________________________
使用示例
示例1:废弃锆石文件
// Get all pages from Zircuit docs
const result = await gitbookScrapeAll({
accessToken: 'none',
url: 'https://docs.zircuit.com/',
options: {
maxPages: 50,
includeMetadata: true
}
});
console.log(`Scraped ${result.data.totalPages} pages`);
console.log(`Total content: ${result.data.totalCharacters} characters`);
// Save to files
result.data.pages.forEach((page, i) => {
const filename = `page-${i + 1}.md`;
fs.writeFileSync(filename, page.markdown);
console.log(`Saved: ${filename} - ${page.metadata.title}`);
});______________________________________________________________________
示例2:提取导航以进行分析
const nav = await gitbookGetNavigation({
accessToken: 'none',
url: 'https://docs.zircuit.com/'
});
function printNavigation(items, indent = 0) {
items.forEach(item => {
console.log(' '.repeat(indent) + `- ${item.title} (${item.type})`);
if (item.children) {
printNavigation(item.children, indent + 1);
}
});
}
printNavigation(nav.data.navigation);______________________________________________________________________
示例3:搜索文档
const search Result = await gitbookSearch({
accessToken: 'none',
url: 'https://docs.zircuit.com/',
query: 'Sequencer Level Security',
options: {
maxResults: 10,
includeSnippets: true
}
});
searchResult.data.results.forEach((result, i) => {
console.log(`\n${i + 1}. ${result.title} (${result.matchCount} matches)`);
console.log(` URL: ${result.url}`);
console.log(` Snippet: ${result.snippet}`);
});______________________________________________________________________
测试
运行测试
# Run Zircuit documentation tests
npm run test:zircuit
# Run all tests
npm test测试结果
============================================================
ZEEKEE GITBOOK MCP - ZIRCUIT DOCUMENTATION TESTS
============================================================
✅ Test: Get Navigation Structure (371ms)
Total pages discovered: 3
✅ Test: Scrape Single Page (213ms)
Content length: 1542 characters
✅ Test: Scrape Multiple Pages (1365ms)
Successful scrapes: 3
✅ Test: Scrape All Pages (1507ms)
Scraped pages: 3
✅ Test: Validation - Missing accessToken (1ms)
✅ Test: Error Handling - Invalid URL (13ms)
============================================================
TEST SUMMARY
============================================================
Total Tests: 6
✅ Passed: 6
❌ Failed: 0
🎉 All tests passed!测试覆盖率
- ✅ 从Zircuit文档中提取导航信息
- ✅ 使用元数据进行单页抓取
- ✅ 多页批量抓取
- ✅ 有限制的全站点抓取
- ✅ 架构验证(缺少参数)
- ✅ 错误处理(无效URL)
- ✅ 响应格式验证
- ✅ 性能跟踪
______________________________________________________________________
平台集成
对于AgentLedger平台
此MCP服务器如下 AgentLedger平台MCP服务器构建模式v1.0.0.
身份验证模式: 无(公开文件)
什么平台处理:
- 设置
accessToken: "none"对于公共文档 - 文档URL配置UI
- 刀具选择界面
- 结果显示
MCP服务器处理什么:
- 工具定义和验证
- Web抓取执行
- HTML到Markdown的转换
- 响应格式(
{ success, data?, error? }) - 错误处理和消息传递
令牌配置
// Platform provides this for all requests
{
accessToken: "none"
}集成说明
- 无需特殊设置 -适用于任何公共GitBook网站
- 速率限制 -请求之间的内置延迟(批之间1秒)
- 并发控制 -最多5个并发请求
- 超时处理 -默认每页超时30秒
- 错误恢复 -妥善处理失败的页面抓取
______________________________________________________________________
演出
平均响应时间:
- 获取导航:~370ms
- 单页刮擦:~200ms
- 多页(3):~1.4秒
- 全部删除(3页):约1.5秒
- 架构验证:\<1ms
- 错误处理:\<50ms
限制:
- 专为中小型文档网站(\<500页)设计
- 出于礼貌,并发请求限制在5个以内
- 可能难以处理JavaScript繁重的动态内容
- 使用标准GitBook结构获得最佳结果
______________________________________________________________________
已知限制
- GitBook结构依赖 -最适合标准GitBook网站
- 无JavaScript渲染 -使用静态HTML解析(无浏览器)
- 速率限制 -故意放慢速度以尊重服务器
- 最大页数 -每页限制为500页
scrape_all操作
______________________________________________________________________
建议
用于生产部署
- 使用合理的限制 -不要刮得比需要的多
- 缓存结果 -储存被刮擦的内容,以避免再次刮擦
- 监测性能 -跟踪响应时间以进行优化
- 处理错误 -某些页面可能会失败,请检查
success领域
最佳实践
- 从开始
gitbook_get_navigation查看页数 - 使用
maxPages大型网站的限制 - 设置适当
concurrency(大多数情况下为2-3) - 启用
includeMetadata为了更好的上下文 - 使用
gitbook_search用于目标内容提取
______________________________________________________________________
许可证
MIT许可证-请参阅 许可证 文件
______________________________________________________________________
链接
- GitHub存储库:
- 锆石文件: https://docs.zircuit.com/
- 代理分类账平台: https://agenticledger.com
______________________________________________________________________
支持
问题:
______________________________________________________________________
为AgentLedger AI代理平台构建
*免费、快速、有效的GitBook文档抓取* 🚀
