pagespace-mcp
v2.0.3
Published
Model Context Protocol (MCP) server for PageSpace with complete workspace management, powerful search, task handling, sheet editing, and AI agent capabilities. Provides external access to all core PageSpace functionality.
Maintainers
Readme
PageSpace MCP Server
A Model Context Protocol (MCP) server that enables Claude Code and Claude Desktop to directly read, edit, create, manage, and organize your PageSpace documents with full CRUD operations and line-level precision.
Quick Start
- Set up MCP tokens in your PageSpace instance
- Configure Claude Desktop/Code with your tokens (no installation needed!)
- Start editing your PageSpace documents with Claude!
Features
- 22 Powerful Tools: Complete workspace management with drive, page, search, and AI agent operations
- Full CRUD Operations: Create, read, update, and delete pages of all types
- Page Management: Move, reorder, trash, and restore pages with hierarchy support
- Line-based editing: Replace specific lines with precision
- Sheet editing: Edit spreadsheet cells with formulas support
- Task management: Create and update tasks on TASK_LIST pages
- Multi-page types: Support for FOLDER, DOCUMENT, CHANNEL, AI_CHAT, CANVAS, SHEET, TASK_LIST
- Advanced Search: Regex and glob pattern search across drives and pages
- AI Agent Integration: Create, configure, and communicate with AI agents
- Trash system: Safe soft-delete with restore capabilities for pages and drives
- HTML-aware: Automatic Prettier formatting for documents
- Secure: User-specific authentication tokens
- Real-time sync: Changes appear immediately in the web editor
Available Tools
📁 Core Drive & Page Operations (10 tools)
list_drives- List all available workspaces/drives with access permissionslist_pages- Explore page tree structure within a specific driveread_page- Read any document content with line numbers and metadatacreate_page- Create new pages (FOLDER, DOCUMENT, CHANNEL, AI_CHAT, CANVAS, SHEET, TASK_LIST)rename_page- Rename existing pages with validationrename_drive- Rename existing drives (owner only)move_page- Move or reorder pages within drive hierarchylist_trash- List all trashed pages in a drivetrash- Move pages or drives to trash (with safety confirmation for drives)restore- Restore pages or drives from trash
✏️ Content Editing (3 tools)
replace_lines- Replace specific line(s) with new content (1-based indexing)edit_sheet_cells- Edit cells in SHEET pages (supports values and formulas)update_task- Create or update tasks on TASK_LIST pages
🚀 Drive Management (1 tool)
create_drive- Create new workspaces/drives
🔍 Search & Discovery (3 tools)
regex_search- Search page content using regular expressionsglob_search- Find pages using glob patterns for titles/pathsmulti_drive_search- Search across multiple drives simultaneously
🤖 AI Agent System (5 tools)
create_agent- Create new AI agents with custom system prompts and toolsupdate_agent_config- Update agent configuration, prompts, and enabled toolslist_agents- List all AI agents in a specific drivemulti_drive_list_agents- List AI agents across all accessible drivesask_agent- Consult AI agents for specialized assistance (supports tool usage)
Setup Instructions
1. Generate an MCP Token
- Start your PageSpace application
- Navigate to Dashboard > Settings > MCP Connection (or
/dashboard/settings/mcp) - Click Create New Token to generate a new MCP token
- Give your token a descriptive name (e.g., "Claude Desktop", "Development")
- Copy and save the token immediately - it's only shown once for security
2. Configure Claude Desktop
Add this to your Claude Desktop MCP configuration file:
For PageSpace Beta (most common):
{
"mcpServers": {
"pagespace": {
"command": "npx",
"args": [
"-y",
"pagespace-mcp@latest"
],
"env": {
"PAGESPACE_API_URL": "https://beta.pagespace.ai",
"PAGESPACE_AUTH_TOKEN": "<YOUR_PAGESPACE_MCP_TOKEN_HERE>"
}
}
}
}For self-hosted PageSpace:
{
"mcpServers": {
"pagespace": {
"command": "npx",
"args": [
"-y",
"pagespace-mcp@latest"
],
"env": {
"PAGESPACE_API_URL": "https://your-pagespace-domain.com",
"PAGESPACE_AUTH_TOKEN": "<YOUR_PAGESPACE_MCP_TOKEN_HERE>"
}
}
}
}3. Test the Connection
Restart Claude Desktop and try:
"Show me my drives"
Claude should list your available drives, then you can:
"Show me the page tree in [drive-name]"
"Read the [document-name] document"
Claude will guide you through the workflow: drives → page tree → documents → editing!
Usage Examples
Getting Started
"Show me my drives" "Show me the page tree in my-drive" (use driveSlug and driveId from list_drives) "Read the document [page-id]" (use pageId from list_pages)
Line Replacement
"Replace line 15 in [page-id] with a new heading:
<h2>New Section</h2>" (use pageId from list_pages) "Replace lines 8-10 in [page-id] with a code block showing the API example"
Sheet Editing
"Set cell A1 to 100 and B1 to a formula =A1*2 in sheet [page-id]" "Update the budget spreadsheet with new values in cells A1:C5"
Task Management
"Create a new task 'Review PR' on my task list [page-id]" "Update task [task-id] status to completed"
Page Management
"Create a new folder called 'Meeting Notes' in drive [drive-id]" "Create a document called 'Project Plan' under parent [parent-id] with some initial content" "Create a new spreadsheet called 'Budget' in drive [drive-id]" "Rename page [page-id] to 'Q4 Project Plan'" "Move page [page-id] to be under parent [parent-id] at position 2"
Trash and Restore
"Move page [page-id] to trash" "Show me what's in the trash for drive [drive-id]" "Restore page [page-id] from trash"
Search Operations
"Search for all pages containing 'TODO' using regex in drive [drive-id]" "Find all pages matching '*.md' pattern" "Search across all my drives for 'API documentation'"
AI Agent Operations
"Create an AI agent called 'Code Reviewer' with tools for reading and analyzing pages" "List all AI agents across my workspaces" "Ask the 'Documentation Writer' agent to help improve this page"
Workflow
The typical workflow is: drives → page tree → documents → editing/management.
For content editing: list_drives → list_pages → read_page (with pageId) → replace_lines (with same pageId) For sheet editing: list_drives → list_pages → read_page (SHEET type) → edit_sheet_cells (with pageId and cells) For task management: list_drives → list_pages → update_task (with pageId of TASK_LIST)
Note: The system uses IDs for operations. When you use list_pages, you'll see both the path (for easy reading) and the ID (for operations).
Claude will guide you through each step!
Security Notes
- Each MCP token is scoped to your specific user account
- Tokens can be revoked at any time from the web interface
- The server only accesses your documents, not other users'
- All changes go through the same validation as the web editor
Development
To run the MCP server in development mode:
pnpm run devThis enables file watching for automatic restarts during development.
Troubleshooting
Authentication Errors
- Verify your MCP token is correct and hasn't been revoked
- Check that
PAGESPACE_AUTH_TOKENis set in your MCP configuration
Connection Issues
- Ensure your PageSpace app is running on the specified URL
- Check that the API URL in the MCP config matches your app's URL
Line Number Issues
- Line numbers are 1-based (first line is line 1)
- After operations, Prettier may reformat and change line numbers
- Always read the document first to see current line numbers
API Reference
The MCP server communicates with these PageSpace endpoints:
/api/mcp/drives- Drive discovery and listing/api/mcp/documents- Document operations (GET for reading, POST for write operations)/api/mcp/detect-paths- Path validation and normalization/api/auth/mcp-tokens- MCP token management (GET to list, POST to create)/api/auth/mcp-tokens/[tokenId]- Revoke MCP token (DELETE)
Requirements
- Node.js: >= 18.0.0
- PageSpace: Any version with MCP support
- Claude Desktop or Claude Code with MCP enabled
Contributing
- Fork the repository
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request
Support
- 💬 Discord: Join our Discord for support questions
- 📖 Documentation: PageSpace Docs
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the PageSpace Team
