Jupyter Collaboration MCP Server
Enables AI agents to interact with collaborative Jupyter notebooks and documents in real-time, supporting notebook operations, document editing, user awareness tracking, and session management through Jupyter's RTC capabilities.
README
Jupyter Collaboration MCP Server
A JupyterLab extension that provides MCP (Model Context Protocol) server endpoints to expose Jupyter Collaboration's real-time collaboration (RTC) functionalities to AI agents.
Overview
This project enables AI agents to interact with collaborative Jupyter notebooks and documents in real-time. It leverages the existing Jupyter Collaboration system's robust RTC capabilities using YDoc (CRDT) technology and exposes them through MCP endpoints.
Features
- Notebook Collaboration: Real-time collaboration on Jupyter notebooks with AI agents
- Document Collaboration: Shared document editing with version control and forking
- User Awareness: Track user presence, cursor positions, and activity
- Real-time Communication: Streamable HTTP for bidirectional communication
- Authentication & Authorization: Integrated with Jupyter's security infrastructure
- Resumable Streams: Clients can reconnect and resume from where they left off
Installation
Prerequisites
- Python 3.10 or higher
- Jupyter Server 2.0.0 or higher
- Jupyter Collaboration 2.0.0 or higher
From Conda (when published)
conda install -c conda-forge jupyter-collaboration-mcp
From PyPI (when published)
pip install jupyter-collaboration-mcp
From Source
git clone https://github.com/jupyter/jupyter-collaboration-mcp.git
cd jupyter-collaboration-mcp
pip install -e .
Configuration
The MCP server is automatically loaded as a Jupyter server extension when installed. No manual configuration is required.
Authentication
The MCP server uses simple token-based authentication. When running as a Jupyter server extension, it automatically uses the token provided via the --IdentityProvider.token command line option.
Using Jupyter Lab Tokens
When starting Jupyter Lab, you can provide a token for authentication:
jupyter lab --IdentityProvider.token=your-secret-token
This token can then be used to authenticate with the MCP server.
MCP Client Configuration
For MCP clients, you'll need to configure the server URL and authentication token. The exact configuration depends on your MCP client, but it typically looks like this:
Example MCP Client Configuration
{
"mcpServers": {
"jupyter-collaboration": {
"url": "http://localhost:8888/mcp",
"type": "streamable-http",
"headers": {
"Authorization": "Identity.token your-secret-token"
},
"disabled": false
}
}
}
Configuration Parameters
url: The URL of the MCP server endpointtype: The transport type, must be "streamable-http" for this serverheaders: HTTP headers to include in requests, typically including the Authorization header with the tokendisabled: Set totrueto disable this server configurationalwaysAllow: Optional list of tools that should always be allowed (if supported by your client)
Finding Your Server URL
- When running as a Jupyter server extension, the MCP endpoint is typically at
http://localhost:8888/mcp(or whatever port your Jupyter server is running on)
Provided MCP Tools
The server exposes the following MCP tools:
Notebook Operations
list_notebooks: List available notebooksget_notebook: Get notebook contentcreate_notebook_session: Create or retrieve a collaboration sessionupdate_notebook_cell: Update a notebook cellinsert_notebook_cell: Insert a new celldelete_notebook_cell: Delete a cellexecute_notebook_cell: Execute a cell
Document Operations
list_documents: List available documentsget_document: Get document contentcreate_document_session: Create or retrieve a collaboration sessionupdate_document: Update document contentinsert_text: Insert text at a positiondelete_text: Delete text from a positionget_document_history: Get document version historyrestore_document_version: Restore a document to a previous versionfork_document: Create a fork of a documentmerge_document_fork: Merge a fork back into the original
Awareness Operations
get_online_users: Get list of online usersget_user_presence: Get user presence informationset_user_presence: Set current user's presence statusget_user_cursors: Get cursor positions in a documentupdate_cursor_position: Update current user's cursor positionget_user_activity: Get recent user activitiesbroadcast_user_activity: Broadcast user activityget_active_sessions: Get active collaboration sessionsjoin_session: Join a collaboration sessionleave_session: Leave a collaboration session
Development Setup
Prerequisites
- Python 3.10 or higher
- Git
- Node.js (for JupyterLab extension development, if needed)
Clone the Repository
git clone https://github.com/jupyter/jupyter-collaboration-mcp.git
cd jupyter-collaboration-mcp
Create a Virtual Environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install Dependencies
pip install -e ".[dev]"
This will install the package in development mode along with all development dependencies.
Code Formatting
The project uses Black for code formatting and isort for import sorting. You can format code manually:
black jupyter_collaboration_mcp tests
isort jupyter_collaboration_mcp tests
Auto-formatting on Commit
To set up automatic code formatting on each commit, run the setup script:
./scripts/setup-git-hooks.sh
This will set up a Git hook that automatically formats your Python files with black and isort before each commit.
Type Checking
The project uses mypy for type checking:
mypy jupyter_collaboration_mcp
Troubleshooting
Common Issues
- Authentication Errors: Make sure you're using the correct token in your Authorization header
- Connection Refused: Verify that your Jupyter server is running and the MCP extension is loaded
- CORS Errors: If running in a browser environment, make sure the server's CORS configuration allows your client's origin
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Jupyter Collaboration for the underlying RTC functionality
- Model Context Protocol (MCP) for the AI agent communication standard
- Jupyter Server for the server infrastructure
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。