This server allows compatible AI assistants (like Cursor or Claude Desktop) to interact with Jupyter Notebook files (.ipynb) on your local machine.
📋 Prerequisites
Before you begin, ensure you have the following installed:
- Python: Version 3.10 or higher.
uv
: The fast Python package installer and virtual environment manager from Astral. If you don't have it, install it:Copyfastmcp
CLI (Optional, for Claude Desktopfastmcp install
): If you plan to use thefastmcp install
method for Claude Desktop, you need thefastmcp
command available.Copy
🔧 Setup
- Clone the Repository:Copy
- Choose Setup Method:
- Option A: Automated Setup (Recommended)
Run the appropriate script for your OS from the project's root directory (where you just
cd
-ed into).- macOS / Linux:Copy
- Windows (PowerShell):Copy
These scripts will create the
.venv
, install dependencies, and output the exact paths needed for your MCP client configuration. - macOS / Linux:
- Option B: Manual Setup
Follow these steps if you prefer manual control or encounter issues with the scripts.
- Create & Activate Virtual Environment:(You should seeCopy
(.venv)
or similar at the start of your shell prompt) - Install Dependencies:Copy
- Create & Activate Virtual Environment:
- Option A: Automated Setup (Recommended)
Run the appropriate script for your OS from the project's root directory (where you just
▶️ Running the Server
Make sure your virtual environment (.venv
) is activated if you used manual setup.
Method 1: Direct Execution (Recommended for Cursor, General Use)
This method uses uv run
to execute the server script directly using your current Python environment (which should now have the dependencies installed).
- Run the Server:The server will start and print status messages, including the (uninitialized) workspace directory.Copy
- Client Configuration (
mcp.json
): Configure your MCP client (e.g., Cursor) to connect. Create or edit the client's MCP configuration file (e.g.,.cursor/mcp.json
in your workspace).Template (Recommended):Copy❓ Why the full path to Python? GUI applications like Cursor might not inherit the same
PATH
environment as your terminal. Specifying the exact path to the Python interpreter inside your.venv
ensures the server runs with the correct environment and dependencies. ⚠️ IMPORTANT: Replace the placeholder paths with the actual absolute paths on your system.
Method 2: Claude Desktop Integration (fastmcp install
)
This method uses the fastmcp
tool to create a dedicated, isolated environment for the server and register it with Claude Desktop. You generally don't need to activate the .venv
manually for this method, as fastmcp install
handles environment creation.
- Install the Server for Claude:Copy
fastmcp install
usesuv
behind the scenes to create the environment and install dependencies fromrequirements.txt
.- The server will now appear in the Claude Desktop developer settings and can be enabled there. You generally don't need to manually edit
claude_desktop_config.json
when usingfastmcp install
.
📘 Usage
Key Concept: Workspace Initialization
Regardless of how you run the server, the first action you must take from your AI assistant is to initialize the workspace. This tells the server where your project files and notebooks are located.
⚠️ You must provide the full absolute path to the directory containing your notebooks. Relative paths or paths like
.
are not accepted. The server will confirm the path and list any existing notebooks found.
Core Operations
Once the workspace is initialized, you can use the available tools:
🛠️ Available Tools
Tool | Description |
---|---|
initialize_workspace | REQUIRED FIRST STEP. Sets the absolute path for the workspace. |
list_notebooks | Lists all .ipynb files found within the workspace directory. |
create_notebook | Creates a new, empty Jupyter notebook if it doesn't exist. |
read_notebook | Reads the entire structure and content of a notebook. |
read_cell | Reads the content and metadata of a specific cell by index. |
edit_cell | Modifies the source content of an existing cell by index. |
add_cell | Adds a new code or markdown cell at a specific index or the end. |
read_notebook_outputs | Reads all outputs from all code cells in a notebook. |
read_cell_output | Reads the output(s) of a specific code cell by index. |
🧪 Development & Debugging
If you need to debug the server itself:
- Run Directly: Use
uv run python server.py
and observe the terminal output for errors or print statements. - FastMCP Dev Mode: For interactive testing with the MCP Inspector:Copy
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
Python notebook mcp