jupythunder
If you are the rightful owner of jupythunder and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Jupythunder is a middleware that connects the LLM chat interface (Claude) with Jupyter Notebook, enabling natural language interaction with Jupyter.
Jupythunder
Jupythunder is a middleware that connects the LLM chat interface (Claude) with Jupyter Notebook. This project allows users to interact with Jupyter Notebook in a way that's closer to natural language.
Key Features
- Natural Language Code Conversion: LLM converts code written by users in a natural language style into correct Python code
- Jupyter Remote Connection: Supports remote connections via user-provided Jupyter Notebook URL (with token)
- Code Execution: Executes converted code in Jupyter Notebook and returns results
- Code Questions: Query information about defined functions, variables, etc. via the
/question
command - State Management: Manages connection state and session information
- Notebook File Management: Supports creating, opening, cell management and saving .ipynb files
- Natural Language Data Analysis: Data analysis and visualization workflow through natural language requests
- Cell Query and Execution: View specific cell contents, execute specific cells, execute all cells sequentially
Installation
Prerequisites
- Python 3.10 or higher
- Jupyter Notebook
- Claude for Desktop (or another MCP client)
Installation Steps
-
Clone the repository:
git clone https://github.com/username/jupythunder.git cd jupythunder
-
Install dependencies:
pip install -r requirements.txt
Usage
1. Run Jupyter Notebook Server
Run the Jupyter Notebook server in a separate terminal:
jupyter notebook
Check the logs for the URL and token (e.g., http://localhost:8888/?token=abcdef1234567890
).
2. Run MCP Server
python jupythunder_server.py
3. Configure Claude for Desktop
Add the MCP server to the claude_desktop_config.json
file of Claude for Desktop:
{
"mcpServers": {
"jupythunder": {
"command": "/absolute/path/python",
"args": ["/absolute/path/jupythunder_server.py"]
}
}
}
Important: You must use the absolute path of Python and the script file.
4. Restart Claude for Desktop
Restart Claude for Desktop after changing the configuration.
5. Usage Examples
-
Connect to Jupyter:
Connect to Jupyter Notebook. URL is http://localhost:8888/tree?token=abcdef1234567890
-
Create New Notebook:
/notebook:data_analysis_notebook
-
Open Existing Notebook:
/open:data_analysis_notebook
-
Natural Language Data Analysis Request:
Generate random data
-
Data Analysis and Visualization:
Show statistical analysis results for the generated data Visualize the correlation between age and income on a graph
-
Writing and Executing Code:
def calculate_savings(income, expense): return income - expense df['savings'] = calculate_savings(df['income'], df['expenses']) df.head()
-
Function Information Lookup:
/question: What functions are currently defined?
-
Notebook Content Lookup:
What is the current notebook content?
-
Specific Cell Lookup and Execution:
Show the content of the first cell Execute the second cell
-
Execute All Cells:
Execute all cells in the notebook sequentially
Detailed Feature Description
Notebook Management Features
- Create New Notebook: Create a new notebook with the
/notebook:notebook_name
command - Open Existing Notebook: Open an existing notebook with the
/open:notebook_name
command - View Notebook Content: Check the cell composition of the current notebook
Cell Management Features
- View Cell Content: Check the code or markdown content of specific cells
- Execute Specific Cell: Selectively execute desired cells
- Execute All Cells: Execute all cells in the notebook sequentially
- Add Markdown Cell: Natural language explanations are automatically added as markdown cells
- Add Code Cell: Converted Python code is added as code cells
- Save Execution Results: Code execution results are automatically saved in the notebook
Natural Language Data Analysis Features
- Data Generation: Generate test data with natural language requests like "Generate random data"
- Statistical Analysis: Perform data analysis with requests like "Show summary statistics for the data"
- Data Visualization: Visualize with natural language requests like "Draw a graph of the age distribution"
- Correlation Analysis: Analyze relationships with requests like "Analyze the correlation between variables"
Command List
Command | Description | Example |
---|---|---|
/notebook:name | Create new notebook | /notebook:data_analysis |
/open:name | Open existing notebook | /open:test |
/question:content | Code-related question | /question:function list |
/help | Display help | /help |
Troubleshooting
could not connect to MCP server jupythunder: spawn pythonENOENT
This error occurs when the Python executable file cannot be found. Resolve it with these methods:
-
Use Python Absolute Path:
{ "mcpServers": { "jupythunder": { "command": "/absolute/path/python", "args": ["/absolute/path/jupythunder_server.py"] } } }
You can find the Python absolute path with these commands:
which python # macOS/Linux where python # Windows
-
Use python3 Command:
{ "mcpServers": { "jupythunder": { "command": "python3", "args": ["/absolute/path/jupythunder_server.py"] } } }
Jupyter Connection Failure
- Check if the Jupyter server is running
- Verify that the provided URL and token are correct
- Check firewall settings
Notebook Creation or Opening Failure
- Check if you have write permissions to the Jupyter server
- Make sure the notebook name does not contain special characters
- Check if a notebook with the same name already exists
Cell Execution Issues
- Check for syntax errors in the code
- Verify that necessary variables or functions are defined in previous cells
- Restart the server if execution results are not displayed in the notebook
Project Structure
jupythunder/
โโโ jupythunder_server.py # Main server implementation
โโโ jupythunder_client.py # Jupyter API client
โโโ tools.py # MCP tool implement
โโโ utils.py # Utility functions
โโโ requirements.txt # Project dependencies
Key Components
- FastMCP Server: MCP protocol handling
- JupyterClient Class: Jupyter API interaction and notebook management
- Tools: Tools for connection, execution, query, and notebook management
- Command Handling: Special command parsing
- State Management: Lifespan context management
- Natural Language Processing: Converting natural language requests to Python code
- Cell Management: Functions for viewing cell content, execution, and saving results
Future Improvements
- LLM Integration: Enhance natural language conversion capabilities using actual LLMs
- Data Visualization Extensions: Support for various visualization types
- Notebook Templates: Provide purpose-specific templates for data analysis, machine learning, etc.
- File Upload: Support for data file upload and automatic analysis
- Collaboration Features: Multi-user support and sharing features
- Interactive Widgets: Enhanced support for Jupyter widgets
- GPU Acceleration: GPU acceleration support for deep learning tasks
Dependencies
- mcp[cli] >= 1.5.0: MCP protocol implementation
- requests >= 2.31.0: HTTP request handling
- websocket-client >= 1.6.0: WebSocket communication
- python-dotenv >= 1.0.0: Environment variable management
- urllib3 >= 2.0.0: HTTP client
License
MIT License
Jupythunder (ํ๊ตญ์ด)
Jupythunder๋ LLM ์ฑํ ์ธํฐํ์ด์ค(Claude)์ Jupyter Notebook์ ์ฐ๊ฒฐํด์ฃผ๋ ๋ฏธ๋ค์จ์ด์ ๋๋ค. ์ด ํ๋ก์ ํธ๋ฅผ ํตํด ์ฌ์ฉ์๋ ์์ฐ์ด์ ๊ฐ๊น์ด ๋ฐฉ์์ผ๋ก Jupyter Notebook๊ณผ ์ํธ์์ฉํ ์ ์์ต๋๋ค.
์ฃผ์ ๊ธฐ๋ฅ
- ์์ฐ์ด ์ฝ๋ ๋ณํ: ์ฌ์ฉ์๊ฐ ์์ฐ์ด์ ๊ฐ๊น์ด ๋ฐฉ์์ผ๋ก ์์ฑํ ์ฝ๋๋ฅผ LLM์ด ์ฌ๋ฐ๋ฅธ Python ์ฝ๋๋ก ๋ณํ
- Jupyter ์๊ฒฉ ์ฐ๊ฒฐ: ์ฌ์ฉ์๊ฐ ์ ๊ณตํ Jupyter Notebook URL(ํ ํฐ ํฌํจ)์ ํตํด ์๊ฒฉ ์ฐ๊ฒฐ ์ง์
- ์ฝ๋ ์คํ: ๋ณํ๋ ์ฝ๋๋ฅผ Jupyter Notebook์์ ์คํํ๊ณ ๊ฒฐ๊ณผ ๋ฐํ
- ์ฝ๋ ์ง๋ฌธ:
/question
๋ช ๋ น์ด๋ฅผ ํตํด ์ ์๋ ํจ์, ๋ณ์ ๋ฑ์ ์ ๋ณด ์กฐํ - ์ํ ๊ด๋ฆฌ: ์ฐ๊ฒฐ ์ํ ๋ฐ ์ธ์ ์ ๋ณด ๊ด๋ฆฌ
- ๋ ธํธ๋ถ ํ์ผ ๊ด๋ฆฌ: .ipynb ํ์ผ ์์ฑ, ์ด๊ธฐ, ์ ๊ด๋ฆฌ ๋ฐ ์ ์ฅ ๊ธฐ๋ฅ ์ง์
- ์์ฐ์ด ๋ฐ์ดํฐ ๋ถ์: ์์ฐ์ด ์์ฒญ์ ํตํ ๋ฐ์ดํฐ ๋ถ์ ๋ฐ ์๊ฐํ ์ํฌํ๋ก์ฐ
- ์ ์กฐํ ๋ฐ ์คํ: ํน์ ์ ๋ด์ฉ ์กฐํ, ํน์ ์ ์คํ, ๋ชจ๋ ์ ์์ฐจ ์คํ ์ง์
์ค์น ๋ฐฉ๋ฒ
์ฌ์ ์๊ตฌ์ฌํญ
- Python 3.10 ์ด์
- Jupyter Notebook
- Claude for Desktop (๋๋ ๋ค๋ฅธ MCP ํด๋ผ์ด์ธํธ)
์ค์น ๋จ๊ณ
-
์ ์ฅ์ ๋ณต์ :
git clone https://github.com/username/jupythunder.git cd jupythunder
-
์์กด์ฑ ์ค์น:
pip install -r requirements.txt
์ฌ์ฉ ๋ฐฉ๋ฒ
1. Jupyter Notebook ์๋ฒ ์คํ
๋ณ๋์ ํฐ๋ฏธ๋์์ Jupyter Notebook ์๋ฒ๋ฅผ ์คํํฉ๋๋ค:
jupyter notebook
๋ก๊ทธ์์ URL๊ณผ ํ ํฐ์ ํ์ธํ์ธ์ (์: http://localhost:8888/?token=abcdef1234567890
).
2. MCP ์๋ฒ ์คํ
python jupythunder_server.py
3. Claude for Desktop ์ค์
Claude for Desktop์ claude_desktop_config.json
ํ์ผ์ MCP ์๋ฒ๋ฅผ ์ถ๊ฐํฉ๋๋ค:
{
"mcpServers": {
"jupythunder": {
"command": "/์ ๋/๊ฒฝ๋ก/python",
"args": ["/์ ๋/๊ฒฝ๋ก/jupythunder_server.py"]
}
}
}
์ค์: Python๊ณผ ์คํฌ๋ฆฝํธ ํ์ผ์ ์ ๋ ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
4. Claude for Desktop ์ฌ์์
์ค์ ๋ณ๊ฒฝ ํ Claude for Desktop์ ์ฌ์์ํฉ๋๋ค.
5. ์ฌ์ฉ ์์
-
Jupyter์ ์ฐ๊ฒฐ:
Jupyter Notebook์ ์ฐ๊ฒฐํด์ค. URL์ http://localhost:8888/tree?token=abcdef1234567890
-
์ ๋ ธํธ๋ถ ์์ฑ:
/notebook:๋ฐ์ดํฐ๋ถ์_๋ ธํธ๋ถ
-
๊ธฐ์กด ๋ ธํธ๋ถ ์ด๊ธฐ:
/open:๋ฐ์ดํฐ๋ถ์_๋ ธํธ๋ถ
-
์์ฐ์ด๋ก ๋ฐ์ดํฐ ๋ถ์ ์์ฒญ:
๋๋ค ๋ฐ์ดํฐ๋ฅผ ์์ฑํด์ค
-
๋ฐ์ดํฐ ๋ถ์ ๋ฐ ์๊ฐํ:
์์ฑ๋ ๋ฐ์ดํฐ์ ๋ํ ํต๊ณ ๋ถ์ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ค ๋์ด์ ์์ ์ ์๊ด๊ด๊ณ๋ฅผ ๊ทธ๋ํ๋ก ์๊ฐํํด์ค
-
์ฝ๋ ์์ฑ ๋ฐ ์คํ:
def calculate_savings(income, expense): return income - expense df['์ ์ถ์ก'] = calculate_savings(df['์์ '], df['์ง์ถ']) df.head()
-
ํจ์ ์ ๋ณด ์กฐํ:
/question: ์ง๊ธ ์ ์๋ ํจ์๊ฐ ๋ญ๊ฐ ์์ง?
-
๋ ธํธ๋ถ ๋ด์ฉ ์กฐํ:
ํ์ฌ ๋ ธํธ๋ถ์ ๋ด์ฉ์ด ์ด๋ป๊ฒ ๋์ด ์์ด?
-
ํน์ ์ ์กฐํ ๋ฐ ์คํ:
์ฒซ๋ฒ์งธ ์ ์ ๋ด์ฉ์ ๋ณด์ฌ์ค ๋๋ฒ์งธ ์ ์ ์คํํด์ค
-
๋ชจ๋ ์ ์คํ:
๋ ธํธ๋ถ์ ๋ชจ๋ ์ ์ ์์ฐจ์ ์ผ๋ก ์คํํด์ค
์ฃผ์ ๊ธฐ๋ฅ ์์ธ ์ค๋ช
๋ ธํธ๋ถ ๊ด๋ฆฌ ๊ธฐ๋ฅ
- ์ ๋
ธํธ๋ถ ์์ฑ:
/notebook:๋ ธํธ๋ถ์ด๋ฆ
๋ช ๋ น์ด๋ก ์ ๋ ธํธ๋ถ์ ์์ฑํฉ๋๋ค. - ๊ธฐ์กด ๋
ธํธ๋ถ ์ด๊ธฐ:
/open:๋ ธํธ๋ถ์ด๋ฆ
๋ช ๋ น์ด๋ก ๊ธฐ์กด ๋ ธํธ๋ถ์ ์ฝ๋๋ค. - ๋ ธํธ๋ถ ๋ด์ฉ ์กฐํ: ํ์ฌ ์์ ์ค์ธ ๋ ธํธ๋ถ์ ์ ๊ตฌ์ฑ์ ํ์ธํ ์ ์์ต๋๋ค.
์ ๊ด๋ฆฌ ๊ธฐ๋ฅ
- ์ ๋ด์ฉ ์กฐํ: ํน์ ์ ์ ์ฝ๋๋ ๋งํฌ๋ค์ด ๋ด์ฉ์ ํ์ธํ ์ ์์ต๋๋ค.
- ํน์ ์ ์คํ: ์ํ๋ ์ ๋ง ์ ํ์ ์ผ๋ก ์คํํ ์ ์์ต๋๋ค.
- ๋ชจ๋ ์ ์คํ: ๋ ธํธ๋ถ์ ๋ชจ๋ ์ ์ ์์ฐจ์ ์ผ๋ก ์คํํ ์ ์์ต๋๋ค.
- ๋งํฌ๋ค์ด ์ ์ถ๊ฐ: ์์ฐ์ด ์ค๋ช ์ด ๋งํฌ๋ค์ด ์ ๋ก ์๋ ์ถ๊ฐ๋ฉ๋๋ค.
- ์ฝ๋ ์ ์ถ๊ฐ: ๋ณํ๋ Python ์ฝ๋๊ฐ ์ฝ๋ ์ ๋ก ์ถ๊ฐ๋ฉ๋๋ค.
- ์คํ ๊ฒฐ๊ณผ ์ ์ฅ: ์ฝ๋ ์คํ ๊ฒฐ๊ณผ๊ฐ ๋ ธํธ๋ถ์ ์๋์ผ๋ก ์ ์ฅ๋ฉ๋๋ค.
์์ฐ์ด ๋ฐ์ดํฐ ๋ถ์ ๊ธฐ๋ฅ
- ๋ฐ์ดํฐ ์์ฑ: "๋๋ค ๋ฐ์ดํฐ ์์ฑ" ๊ฐ์ ์์ฐ์ด ์์ฒญ์ผ๋ก ํ ์คํธ ๋ฐ์ดํฐ๋ฅผ ์์ฑํฉ๋๋ค.
- ํต๊ณ ๋ถ์: "๋ฐ์ดํฐ ์์ฝ ํต๊ณ ๋ณด์ฌ์ค" ๋ฑ์ ์์ฒญ์ผ๋ก ๋ฐ์ดํฐ ๋ถ์์ ์ํํฉ๋๋ค.
- ๋ฐ์ดํฐ ์๊ฐํ: "๋์ด ๋ถํฌ๋ฅผ ๊ทธ๋ํ๋ก ๊ทธ๋ ค์ค"์ฒ๋ผ ์์ฐ์ด ์์ฒญ์ผ๋ก ์๊ฐํํฉ๋๋ค.
- ์๊ด๊ด๊ณ ๋ถ์: "๋ณ์ ๊ฐ ์๊ด๊ด๊ณ ๋ถ์ํด์ค"์ ๊ฐ์ ์์ฒญ์ผ๋ก ๊ด๊ณ๋ฅผ ๋ถ์ํฉ๋๋ค.
๋ช ๋ น์ด ๋ชฉ๋ก
๋ช ๋ น์ด | ์ค๋ช | ์์ |
---|---|---|
/notebook:์ด๋ฆ | ์ ๋ ธํธ๋ถ ์์ฑ | /notebook:๋ฐ์ดํฐ๋ถ์ |
/open:์ด๋ฆ | ๊ธฐ์กด ๋ ธํธ๋ถ ์ด๊ธฐ | /open:test |
/question:๋ด์ฉ | ์ฝ๋ ๊ด๋ จ ์ง๋ฌธ | /question:ํจ์ ๋ชฉ๋ก |
/help | ๋์๋ง ํ์ | /help |
๋ฌธ์ ํด๊ฒฐ
could not connect to MCP server jupythunder: spawn pythonENOENT
์ด ์ค๋ฅ๋ Python ์คํ ํ์ผ์ ์ฐพ์ง ๋ชปํ ๋ ๋ฐ์ํฉ๋๋ค. ๋ค์ ๋ฐฉ๋ฒ์ผ๋ก ํด๊ฒฐํ์ธ์:
-
Python ์ ๋ ๊ฒฝ๋ก ์ฌ์ฉ:
{ "mcpServers": { "jupythunder": { "command": "/์ ๋/๊ฒฝ๋ก/python", "args": ["/์ ๋/๊ฒฝ๋ก/jupythunder_server.py"] } } }
Python ์ ๋ ๊ฒฝ๋ก๋ ๋ค์ ๋ช ๋ น์ด๋ก ํ์ธํ ์ ์์ต๋๋ค:
which python # macOS/Linux where python # Windows
-
python3 ๋ช ๋ น์ด ์ฌ์ฉ:
{ "mcpServers": { "jupythunder": { "command": "python3", "args": ["/์ ๋/๊ฒฝ๋ก/jupythunder_server.py"] } } }
Jupyter ์ฐ๊ฒฐ ์คํจ
- Jupyter ์๋ฒ๊ฐ ์คํ ์ค์ธ์ง ํ์ธ
- ์ ๊ณตํ URL๊ณผ ํ ํฐ์ด ์ฌ๋ฐ๋ฅธ์ง ํ์ธ
- ๋ฐฉํ๋ฒฝ ์ค์ ํ์ธ
๋ ธํธ๋ถ ์์ฑ ๋๋ ์ด๊ธฐ ์คํจ
- Jupyter ์๋ฒ์ ์ฐ๊ธฐ ๊ถํ์ด ์๋์ง ํ์ธ
- ๋ ธํธ๋ถ ์ด๋ฆ์ ํน์ ๋ฌธ์๊ฐ ํฌํจ๋์ด ์์ง ์์์ง ํ์ธ
- ์ด๋ฏธ ๊ฐ์ ์ด๋ฆ์ ๋ ธํธ๋ถ์ด ์๋์ง ํ์ธ
์ ์คํ ๊ด๋ จ ๋ฌธ์
- ์ฝ๋์ ๊ตฌ๋ฌธ ์ค๋ฅ๊ฐ ์๋์ง ํ์ธ
- ์ด์ ์ ์์ ํ์ํ ๋ณ์๋ ํจ์๊ฐ ์ ์๋์๋์ง ํ์ธ
- ์คํ ๊ฒฐ๊ณผ๊ฐ ๋ ธํธ๋ถ์ ํ์๋์ง ์์ผ๋ฉด ์๋ฒ๋ฅผ ์ฌ์์ํด๋ณด์ธ์
ํ๋ก์ ํธ ๊ตฌ์กฐ
jupythunder/
โโโ jupythunder_server.py # ๋ฉ์ธ ์๋ฒ ๊ตฌํ
โโโ jupythunder_client.py # Jupyter API ํด๋ผ์ด์ธํธ
โโโ tools.py # MCP ๋๊ตฌ ๊ตฌํ
โโโ utils.py # ์ ํธ๋ฆฌํฐ ํจ์
โโโ requirements.txt # ํ๋ก์ ํธ ์์กด์ฑ
์ฃผ์ ๊ตฌ์ฑ ์์
- FastMCP ์๋ฒ: MCP ํ๋กํ ์ฝ ์ฒ๋ฆฌ
- JupyterClient ํด๋์ค: Jupyter API ์ํธ์์ฉ ๋ฐ ๋ ธํธ๋ถ ๊ด๋ฆฌ
- ๋๊ตฌ: ์ฐ๊ฒฐ, ์คํ, ์กฐํ, ๋ ธํธ๋ถ ๊ด๋ฆฌ๋ฅผ ์ํ ๋๊ตฌ
- ๋ช ๋ น์ด ์ฒ๋ฆฌ: ํน๋ณ ๋ช ๋ น์ด ๊ตฌ๋ฌธ ๋ถ์
- ์ํ ๊ด๋ฆฌ: ๋ผ์ดํ์คํฌ ์ปจํ ์คํธ ๊ด๋ฆฌ
- ์์ฐ์ด ์ฒ๋ฆฌ: ์์ฐ์ด ์์ฒญ์ Python ์ฝ๋๋ก ๋ณํ
- ์ ๊ด๋ฆฌ: ์ ๋ด์ฉ ์กฐํ, ์คํ, ๊ฒฐ๊ณผ ์ ์ฅ ๊ธฐ๋ฅ
ํฅํ ๊ฐ์ ์ฌํญ
- LLM ํตํฉ: ์ค์ LLM์ ์ด์ฉํ ์์ฐ์ด ๋ณํ ๊ธฐ๋ฅ ๊ฐํ
- ๋ฐ์ดํฐ ์๊ฐํ ํ์ฅ: ๋ค์ํ ์๊ฐํ ์ ํ ์ง์
- ๋ ธํธ๋ถ ํ ํ๋ฆฟ: ๋ฐ์ดํฐ ๋ถ์, ๋จธ์ ๋ฌ๋ ๋ฑ ๋ชฉ์ ๋ณ ํ ํ๋ฆฟ ์ ๊ณต
- ํ์ผ ์ ๋ก๋: ๋ฐ์ดํฐ ํ์ผ ์ ๋ก๋ ๋ฐ ์๋ ๋ถ์ ๊ธฐ๋ฅ
- ํ์ ๊ธฐ๋ฅ: ๋ค์ค ์ฌ์ฉ์ ์ง์ ๋ฐ ๊ณต์ ๊ธฐ๋ฅ
- ์ธํฐ๋ํฐ๋ธ ์์ ฏ: Jupyter ์์ ฏ ์ง์ ๊ฐํ
- GPU ๊ฐ์: ๋ฅ๋ฌ๋ ์์ ์ ์ํ GPU ๊ฐ์ ์ง์
์์กด์ฑ
- mcp[cli] >= 1.5.0: MCP ํ๋กํ ์ฝ ๊ตฌํ
- requests >= 2.31.0: HTTP ์์ฒญ ์ฒ๋ฆฌ
- websocket-client >= 1.6.0: WebSocket ํต์
- python-dotenv >= 1.0.0: ํ๊ฒฝ ๋ณ์ ๊ด๋ฆฌ
- urllib3 >= 2.0.0: HTTP ํด๋ผ์ด์ธํธ
๋ผ์ด์ผ์ค
MIT ๋ผ์ด์ผ์ค