gitbook-mcp
Provides tools for managing GitBook documentation, including spaces, pages, change requests, reviews, comments, Git Sync, organizations, and content import.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gitbook-mcpCreate a new change request for the onboarding guide"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gitbook-mcp
MCP Server for full GitBook API automation. Exposes 39 tools that allow AI agents (Claude Code, Cursor, etc.) to manage documentation, change requests, reviews, and Git Sync programmatically.
Quickstart
# 1. Clone
git clone <your-repo-url>
cd gitbook-mcp
# 2. Install and build
npm install
npm run build
# 3. Configure
cp .env.example .env
# Edit .env with your token (see "Configuration" below)
# 4. Run
npm startRelated MCP server: jt-mcp-server
Configuration
Environment variables
Variable | Required | Description |
| Yes | GitBook API token |
| No | Default organization ID |
| No | Default space ID |
| No | API base URL (default: |
Get your token
Create a new API Token
Copy the token to your
.env
.env example
GITBOOK_API_TOKEN=gb_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GITBOOK_DEFAULT_SPACE_ID=
GITBOOK_DEFAULT_ORG_ID=AI Agent Integration
Claude Code
Add to .mcp.json in your project root:
{
"mcpServers": {
"gitbook": {
"command": "node",
"args": ["/path/to/gitbook-mcp/dist/index.js"],
"env": {
"GITBOOK_API_TOKEN": "${GITBOOK_API_TOKEN}",
"GITBOOK_DEFAULT_ORG_ID": ""
}
}
}
}Claude Code resolves ${GITBOOK_API_TOKEN} from shell environment variables. Add to your ~/.bashrc or ~/.zshrc:
export GITBOOK_API_TOKEN="your-token-here"Cursor
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):
{
"mcpServers": {
"gitbook": {
"command": "node",
"args": ["/path/to/gitbook-mcp/dist/index.js"],
"env": {
"GITBOOK_API_TOKEN": "your-token-here",
"GITBOOK_DEFAULT_ORG_ID": ""
}
}
}
}In Cursor,
${VAR}interpolation is not supported. Place the token directly in the JSON.
Other MCP clients
Any client compatible with MCP via stdio transport will work. The server reads stdin/stdout following the MCP protocol.
Tools
Spaces (6)
Tool | Description |
| Get space details |
| Update title, visibility |
| Create new space in an org |
| Duplicate an existing space |
| List spaces in an org |
| Search content within a space |
Pages (8)
Tool | Description |
| Full page tree of a space |
| List pages (with pagination) |
| Read page by ID |
| Read page by URL path (e.g., |
| Outgoing links from a page |
| Pages linking to a page (backlinks) |
| List files (images, attachments) |
| File details and download URL |
Change Requests (6)
Tool | Description |
| Create new CR (similar to PR/draft) |
| List CRs of a space |
| CR details |
| Update CR title/status |
| Merge CR into main content |
| Sync CR with latest content |
Reviews (5)
Tool | Description |
| List reviews of a CR |
| Approve, request changes, or comment |
| List requested reviewers |
| Request review from specific users |
| Remove reviewer from a CR |
Comments (6)
Tool | Description |
| List comments (space or CR) |
| Post comment (supports markdown) |
| Edit existing comment |
| Delete comment |
| List replies to a comment |
| Reply to a comment |
Git Sync (3)
Tool | Description |
| Import content from a Git repo to a space |
| Export content from a space to a Git repo |
| Git Sync status and configuration |
Organizations (4)
Tool | Description |
| Organization details |
| List collections in an org |
| Collection details |
| Ask GitBook AI about the documentation |
Content Import (1)
Tool | Description |
| Import content from a URL into the org |
Architecture
src/
├── index.ts # Entrypoint — stdio transport
├── server.ts # McpServer creation
├── config.ts # Environment variable loading
├── client/
│ ├── gitbook-client.ts # HTTP client for GitBook API v1
│ └── types.ts # API response types
├── tools/
│ ├── index.ts # Registration of all 39 tools
│ ├── spaces.ts # 6 tools
│ ├── pages.ts # 8 tools
│ ├── change-requests.ts # 6 tools
│ ├── reviews.ts # 5 tools
│ ├── comments.ts # 6 tools
│ ├── git-sync.ts # 3 tools
│ ├── organizations.ts # 4 tools
│ └── content-import.ts # 1 tool
├── schemas/
│ └── index.ts # Reusable Zod schemas
└── utils/
├── errors.ts # API error handling
└── pagination.ts # Pagination helpersScripts
Command | Description |
| Compile TypeScript to |
| Start MCP server via stdio |
| Compile in watch mode (development) |
| Open MCP Inspector for debugging |
Requirements
Node.js >= 18.0.0
npm
Dependencies
Package | Version | Usage |
| ^1.12.0 | Official MCP SDK |
| ^3.24.0 | Schema validation |
| ^5.7.0 | (dev) Compilation |
Debug
MCP Inspector
npm run inspectOpens a web interface to test tools interactively.
Error logs
The server sends formatted errors back to the MCP client. GitBook API errors include:
HTTP status code
Failed endpoint
GitBook error message
Common issues
Problem | Solution |
| Set the environment variable or create the |
| Invalid or expired token — generate a new one |
| Token lacks permission for the resource |
| Incorrect space/page/org ID |
| Run |
Update
cd ~/gitbook-mcp
git pull
npm install
npm run buildLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lucasbenevinuto/gitbook-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server