-
Notifications
You must be signed in to change notification settings - Fork 5.9k
blog for mcp-jupyter server #3059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f5ad8a8
96ce773
20a1498
e51497a
e0329ce
b086571
f4983d9
4a2e7aa
3d3e774
aaaff2e
60b85be
5fe396a
1a37340
198e1b1
4fcf68f
6c82e69
51198df
36f4db8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,158 @@ | ||||||
| --- | ||||||
| title: "MCP Jupyter: AI-Powered Machine Learning and Data Science" | ||||||
| description: Enable AI agents to work directly with your Jupyter notebooks, leveraging persistent memory and stateful collaboration for enhanced ML and data science workflows | ||||||
| date: 2025-06-24 | ||||||
| authors: | ||||||
| - damien | ||||||
| - dean | ||||||
| - harrison | ||||||
| --- | ||||||
|
|
||||||
|  | ||||||
|
|
||||||
| Machine learning and data science workflows are inherently iterative. You load data, explore patterns, build models, and refine your approach based on results. But traditional AI assistants lose context between interactions, forcing you to reload data and re-establish context repeatedly—making data-heavy development slow and expensive. | ||||||
|
|
||||||
| The [**MCP Jupyter Server**](https://github.com/block/mcp-jupyter) solves this by enabling AI agents like Goose to work directly with your Jupyter notebooks, maintaining persistent memory and state across interactions while letting the AI interact with your data through code execution rather than raw data transfer. | ||||||
|
|
||||||
| <!--truncate--> | ||||||
|
|
||||||
| ## The Memory and Context Problem | ||||||
|
|
||||||
| Traditional AI coding assistants face a fundamental limitation: they lose context between code iterations. They also are not designed for adhoc work where the expectation is the code should run from start to finish. This creates several challenges for data-heavy ML workflows: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would find it very helpful to have this problem explained with an example. The same example could then be used to show how much better the AI agent works when the MCP Jupyter Server is enabled. Happy to collaborate, maybe making a little video about this!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the text with a little more context and included a link to a video. LMK what you think!
damienrj marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| - **Constant data reloading**: Each interaction requires re-loading or describing your dataset | ||||||
| - **Expensive iterations**: Large datasets are slow and costly to process repeatedly | ||||||
| - **Context size**: The raw data is also too large to be fit in context | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
| - **Not designed for adhoc work**: It is harder to have the model do some steps for you, and then let you take over and then later pass control back to the model | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| This has made it difficult to use AI to help with data science workflows, which led to the creation of the MCP Jupyter Server. | ||||||
|
|
||||||
| ## A Better Approach: Persistent State | ||||||
|
|
||||||
| The MCP Jupyter Server takes a different approach. Instead of losing context between interactions, it maintains persistent memory and lets the AI interact with your data through code execution. This creates a powerful paradigm: | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| - **Persistent memory**: Variables and state are maintained across all interactions | ||||||
| - **Efficient iterations**: No need to reload data or re-establish context | ||||||
| - **Code-based data interaction**: AI explores data through execution, not given the raw data | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
| - **True pair programming**: Seamless collaboration within the same notebook context | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## Transforming ML Workflows | ||||||
|
|
||||||
| ### Exploratory Data Analysis | ||||||
|
|
||||||
| Instead of describing your dataset, let the AI explore it directly: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to cut down on
Suggested change
|
||||||
|
|
||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "Help me understand this customer dataset" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Let me explore your data structure first" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI executes: df.info(), df.describe(), df.head()]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "I can see you have 50,000 customers with 12 features. The data includes demographics (age, income), behavioral metrics (purchase_frequency, avg_order_value), and some missing values in the 'phone_number' column. Would you like me to create visualizations for the key relationships, like age vs income or purchase patterns?" | ||||||
| > | ||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "Yes, show me the age and income distributions, and any correlations" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Perfect! I'll create histograms for age and income, plus a correlation heatmap" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI generates and displays visualizations]</span>* | ||||||
|
|
||||||
| The AI can see your actual column names, data types, and distributions—leading to much more relevant suggestions. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ### Interactive Model Development | ||||||
|
|
||||||
| The AI becomes a true collaborator in your modeling process: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "This model isn't performing well" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Let me check the current metrics and feature importance" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI executes your existing model evaluation code]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "I see the accuracy is 72% and the most important features are 'price' and 'location'. The model seems to be overfitting - would you like me to try regularization or reduce the feature set?" | ||||||
| > | ||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "Try regularization first" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "I'll add L2 regularization and test different alpha values" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI implements and tests changes iteratively]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Great! With alpha=0.1, accuracy improved to 78% and the validation curve looks much better. Should I tune it further or try ensemble methods?" | ||||||
|
|
||||||
| ### Real-time Debugging | ||||||
|
|
||||||
| When errors occur, the AI has full context: | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "I'm getting a KeyError in cell 5" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Let me check what columns are available in your dataframe" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI executes: df.columns, df.info()]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "I see the issue - you're trying to access 'customer_id' but the actual column name is 'CustomerID' with capital letters. Also, I notice you have 'purchase_date' as a string - should I convert that to datetime while I fix the KeyError?" | ||||||
| > | ||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "Yes, fix both issues" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Done! I've updated the column reference and converted purchase_date to datetime. The cell should run properly now." | ||||||
|
|
||||||
| ### Continuous Collaboration | ||||||
|
|
||||||
| Imagine a scenario where you are working on a new dataset: | ||||||
|
|
||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[Executes: df = pd.read_csv('sales_data.csv')]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "Let me check the data types and look for any anomalies" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "I'll analyze your sales data structure" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI executes: df.info(), df.describe(include='all')]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "I found a few issues: 'CustomerID' is stored as text but should be numeric, and there are 847 missing values in 'SalesAmount'. Would you like me to convert 'CustomerID' to numeric and fill the missing 'SalesAmount' values with the median?" | ||||||
| > | ||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "Yes, please do that and show me the updated info" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Done! CustomerID is now numeric and SalesAmount gaps are filled. Your dataset is clean and ready for modeling." | ||||||
|
|
||||||
| *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[Later in the session, after you've trained a model...]</span>* | ||||||
|
|
||||||
| > <span style={{color: '#2563eb', fontWeight: 'bold'}}>User:</span> "How is my model performing?" | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Let me generate the key metrics for your trained model" | ||||||
| > | ||||||
| > *<span style={{color: '#6b7280', fontStyle: 'italic'}}>[AI accesses the existing model variable and generates evaluation metrics]</span>* | ||||||
| > | ||||||
| > <span style={{color: '#059669', fontWeight: 'bold'}}>AI:</span> "Your Random Forest achieved 0.84 precision and 0.81 recall. The confusion matrix shows some false positives in the high-value sales category. Would you like me to adjust the decision threshold or try feature engineering?" | ||||||
|
|
||||||
| This fluid back-and-forth, where the AI understands and builds upon the existing notebook state, allows for seamless collaboration without the need for constant context re-establishment or data reloading. | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| ## Example notebook | ||||||
|
|
||||||
| Can see an example notebook that was handled by the MCP Jupyter Server. The server | ||||||
|
damienrj marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| **[📓 View the Complete Demo Notebook](https://github.com/block/mcp-jupyter/blob/main/demos/demo.ipynb)** | ||||||
|
|
||||||
| The demo walks through a typical data science workflow: | ||||||
| - **Install Missing Libraries**: Installing missing libraries for the notebook | ||||||
| - **Data Generation**: Creating synthetic data for analysis | ||||||
| - **Model Training**: Fitting a linear regression model with scikit-learn | ||||||
| - **Results Analysis**: Extracting model coefficients and performance metrics | ||||||
| - **Visualization**: Creating plots with seaborn | ||||||
|
|
||||||
| ## Getting Started | ||||||
|
|
||||||
| The MCP Jupyter Server integrates seamlessly with existing workflows and can also be used with the notebook viewer in VS Code based IDEs. | ||||||
|
|
||||||
| For detailed setup and configuration, check out the [complete documentation](https://block.github.io/mcp-jupyter/). | ||||||
|
|
||||||
|
|
||||||
| <head> | ||||||
| <meta property="og:title" content="MCP Jupyter Server: Bringing Notebook Intelligence to AI Agents" /> | ||||||
| <meta property="og:type" content="article" /> | ||||||
| <meta property="og:url" content="https://block.github.io/goose/blog/2025/06/24/mcp-jupyter-server" /> | ||||||
| <meta property="og:description" content="A powerful MCP server that enables AI agents to interact with Jupyter notebooks while preserving kernel state and variable context" /> | ||||||
| <meta property="og:image" content="https://block.github.io/goose/assets/images/data-goose-31db12eb84fe22345f4ed83d50d8d41f.png" /> | ||||||
| <meta name="twitter:card" content="summary_large_image" /> | ||||||
| <meta property="twitter:domain" content="block.github.io/goose" /> | ||||||
| <meta name="twitter:title" content="MCP Jupyter Server: Bringing Notebook Intelligence to AI Agents" /> | ||||||
| <meta name="twitter:description" content="A powerful MCP server that enables AI agents to interact with Jupyter notebooks while preserving kernel state and variable context" /> | ||||||
| <meta name="twitter:image" content="https://block.github.io/goose/assets/images/data-goose-31db12eb84fe22345f4ed83d50d8d41f.png" /> | ||||||
| </head> | ||||||
Uh oh!
There was an error while loading. Please reload this page.