@akram1110/notebook-mcp 1.0.3 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -15
- package/lib/launcher.js +18 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,27 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Notebook MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
AI-Native Intelligence Layer for Jupyter Notebooks using the Model Context Protocol (MCP)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Notebook MCP enables AI assistants (Cursor, Windsurf, Claude Desktop, etc.) to properly understand, analyze, and interact with `.ipynb` notebooks.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
* Builds dependency graphs across notebook cells
|
|
14
|
+
* Detects stale and unexecuted cells
|
|
15
|
+
* Generates rerun plans automatically
|
|
16
|
+
* Provides focused context slices for LLM reasoning
|
|
17
|
+
* Converts notebooks into deterministic Python scripts
|
|
18
|
+
* Integrates with live Jupyter kernels
|
|
19
|
+
* Allows runtime execution and variable inspection
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 📦 Installation
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
npm install -g @akram1110/notebook-mcp
|
|
9
27
|
```
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
This CLI automatically installs the Python backend via PyPI.
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## ⚙️ Requirements
|
|
34
|
+
|
|
35
|
+
* Python 3.10+
|
|
36
|
+
* pip
|
|
37
|
+
* Node.js 18+
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 🚀 Usage
|
|
42
|
+
|
|
43
|
+
Run MCP server:
|
|
44
|
+
|
|
45
|
+
```
|
|
14
46
|
notebook-mcp
|
|
15
47
|
```
|
|
16
48
|
|
|
17
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🧠 MCP Tools Provided
|
|
52
|
+
|
|
53
|
+
### Notebook Analysis
|
|
54
|
+
|
|
55
|
+
* notebook_analyze
|
|
56
|
+
* notebook_context
|
|
57
|
+
* notebook_export_script
|
|
58
|
+
* notebook_state
|
|
59
|
+
* notebook_rerun_plan
|
|
60
|
+
|
|
61
|
+
### Jupyter Runtime
|
|
62
|
+
|
|
63
|
+
* jupyter_list_sessions
|
|
64
|
+
* jupyter_get_kernel
|
|
65
|
+
* jupyter_execute
|
|
66
|
+
* jupyter_inspect
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🔌 Cursor MCP Configuration
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"notebook": {
|
|
76
|
+
"command": "notebook-mcp"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 🌍 Python Backend
|
|
85
|
+
|
|
86
|
+
Python package is available at:
|
|
87
|
+
|
|
88
|
+
[https://pypi.org/project/notebook-mcp/](https://pypi.org/project/notebook-mcp/)
|
|
18
89
|
|
|
19
|
-
|
|
20
|
-
- `NOTEBOOK_MCP_PIP_SPEC`: pip spec to install (default: `notebook-mcp`)
|
|
21
|
-
- `NOTEBOOK_MCP_PIP_ARGS`: extra args passed to `pip install` (space-separated)
|
|
90
|
+
---
|
|
22
91
|
|
|
23
|
-
|
|
92
|
+
## 💬 Feedback
|
|
24
93
|
|
|
25
|
-
|
|
26
|
-
- `MCP_HOST`, `MCP_PORT`
|
|
27
|
-
- `JUPYTER_BASE_URL`, `JUPYTER_TOKEN`
|
|
94
|
+
Issues and contributions welcome on GitHub.
|
package/lib/launcher.js
CHANGED
|
@@ -2,6 +2,14 @@ const { spawnSync, spawn } = require("node:child_process");
|
|
|
2
2
|
const process = require("node:process");
|
|
3
3
|
const which = require("which");
|
|
4
4
|
|
|
5
|
+
function ok(msg) {
|
|
6
|
+
process.stdout.write(`✔ ${msg}\n`);
|
|
7
|
+
// Force flush for immediate visibility
|
|
8
|
+
if (process.stdout && typeof process.stdout.flush === 'function') {
|
|
9
|
+
process.stdout.flush();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
function findPython() {
|
|
6
14
|
const explicit = process.env.NOTEBOOK_MCP_PYTHON;
|
|
7
15
|
if (explicit) return explicit;
|
|
@@ -34,7 +42,7 @@ function canImportNotebookMcp(python) {
|
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
function ensureInstalled(python) {
|
|
37
|
-
if (canImportNotebookMcp(python)) return;
|
|
45
|
+
if (canImportNotebookMcp(python)) return false;
|
|
38
46
|
|
|
39
47
|
const spec = process.env.NOTEBOOK_MCP_PIP_SPEC || "notebook-mcp";
|
|
40
48
|
const extraArgs = (process.env.NOTEBOOK_MCP_PIP_ARGS || "").split(" ").filter(Boolean);
|
|
@@ -48,6 +56,8 @@ function ensureInstalled(python) {
|
|
|
48
56
|
"Check that your Python environment is the one you expect (NOTEBOOK_MCP_PYTHON)."
|
|
49
57
|
);
|
|
50
58
|
}
|
|
59
|
+
|
|
60
|
+
return true;
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
async function launch(argv) {
|
|
@@ -59,7 +69,11 @@ async function launch(argv) {
|
|
|
59
69
|
);
|
|
60
70
|
}
|
|
61
71
|
|
|
62
|
-
|
|
72
|
+
ok(`Python detected (${python})`);
|
|
73
|
+
|
|
74
|
+
const installed = ensureInstalled(python);
|
|
75
|
+
if (installed) ok("Backend installed (notebook-mcp)");
|
|
76
|
+
else ok("Backend already installed (notebook-mcp)");
|
|
63
77
|
|
|
64
78
|
// Run as module so this works even if Scripts/ is not on PATH.
|
|
65
79
|
const child = spawn(python, ["-m", "notebook_mcp.server", ...argv], {
|
|
@@ -67,6 +81,8 @@ async function launch(argv) {
|
|
|
67
81
|
env: process.env,
|
|
68
82
|
});
|
|
69
83
|
|
|
84
|
+
ok("MCP server running");
|
|
85
|
+
|
|
70
86
|
return new Promise((resolve, reject) => {
|
|
71
87
|
child.on("error", reject);
|
|
72
88
|
child.on("exit", (code, signal) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akram1110/notebook-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "NPM wrapper that launches the notebook-mcp Python MCP server",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/launcher.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
],
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "git+https://github.com/akram-side-projects/notebook-mcp.git"
|
|
30
30
|
},
|
|
31
31
|
"bugs": {
|
|
32
|
-
"url": "https://github.com/
|
|
32
|
+
"url": "https://github.com/akram-side-projects/notebook-mcp/issues"
|
|
33
33
|
},
|
|
34
|
-
"homepage": "https://github.com/
|
|
34
|
+
"homepage": "https://github.com/akram-side-projects/notebook-mcp#readme",
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|