You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(release): Bump version to 0.2.4 and improved test coverage.
- Added `notebook_get_outline` for analyzing notebook structure and extracting cell outlines.
- Introduced `notebook_search` for case-insensitive searching within notebook cells.
- Enhanced test coverage with dedicated tests for error paths and edge cases, improving overall code coverage to 84%.
- Updated version and clarified Python minimum version of 3.10
Copy file name to clipboardExpand all lines: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
+
## [0.2.4] - 2025-04-26
9
+
10
+
### Added
11
+
12
+
- Added tools to get an outline and search a notebook, so specific cells can be targeted for read/edit.
13
+
- The `notebook_get_outline` method analyzes a Jupyter notebook's structure, extracting cell types, line counts, and outlines for code and markdown cells.
14
+
- The `notebook_search` method allows for case-insensitive searching within notebook cells, returning matches with context snippets.
15
+
- Added dedicated tests for error paths and edge cases in the NotebookTools module, focusing on improving code coverage.
16
+
- Added tests for handling issues with `diagnose_imports`, including subprocess errors and malformed JSON.
17
+
- Added validation tests for notebooks addressing invalid JSON and non-notebook files.
18
+
- Added tests for outline extraction with invalid code syntax.
19
+
- Added tests for empty search queries and behavior of large file truncation.
20
+
- Added edge case tests for export functionality and cell transformations.
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,10 @@ This MCP server uses the `nbformat` library to safely manipulate notebook struct
26
26
27
27
## Latest Version
28
28
29
-
**Current Version:**`0.2.3` - See the [CHANGELOG.md](CHANGELOG.md) for details on recent changes.
29
+
**Current Version:**`0.2.4` - See the [CHANGELOG.md](CHANGELOG.md) for details on recent changes. Two new tools were added that make it easier to work with large notebooks:
30
+
31
+
-`notebook_get_outline` analyzes a Jupyter notebook's structure, extracting cell types, line counts, and headings/functions/classes. It then returns an outline the agent can reference.
32
+
-`notebook_search` enables case-insensitive searching within notebook cells. The results show which cell the match was found, and include contextual snippets. This helps the agent know which cell to read/edit when asked to modify something.
30
33
31
34
## Features
32
35
@@ -56,14 +59,16 @@ Exposes the following MCP tools (registered under the `notebook_mcp` server):
56
59
*`notebook_validate`: Validates the notebook structure against the `nbformat` schema.
57
60
*`notebook_get_info`: Retrieves general information (cell count, metadata, kernel, language info).
58
61
*`notebook_export`: Exports the notebook to another format (e.g., python, html) using nbconvert. **Note:** See External Dependencies below for requirements needed for certain export formats like PDF.
62
+
*`notebook_get_outline`: Produces an outline showing cell numbers with major headings/functions and line counts to make it easier for the agent to navigate a large notebook.
63
+
*`notebook_search`: Searches cells for a keyword, showing which cell matches were found with contextual snippets. This helps the agent know which cell to read/edit when asked to modify something.
59
64
60
65
## Requirements
61
66
62
67
This project has both Python package dependencies and potentially external system dependencies for full functionality.
63
68
64
69
### Python Dependencies
65
70
66
-
***Python Version:** 3.9+
71
+
***Python Version:** 3.10+
67
72
***Core:**`mcp>=0.1.0`, `nbformat>=5.0`, `nbconvert>=6.0`, `ipython`, `jupyter_core`. These are installed automatically when you install `cursor-notebook-mcp`.
68
73
***Optional - SSE Transport:**`uvicorn>=0.20.0`, `starlette>=0.25.0`. Needed only if using the SSE transport mode. Install via `pip install cursor-notebook-mcp[sse]`.
69
74
***Optional - Development/Testing:**`pytest>=7.0`, `pytest-asyncio>=0.18`, `pytest-cov`, `coveralls`. Install via `pip install -e ".[dev]"` from source checkout.
@@ -230,19 +235,19 @@ When using `sse`, you must run the server process manually first (see "Running t
230
235
For smooth collaboration with the AI agent on Jupyter Notebooks, you might want to add rules like these to your Cursor configuration. Go to Cursor Settings > Rules and add them in either User Roles or Project Rules. This ensures that Cursor's AI features will consistently follow these best practices when working with Jupyter notebooks.
231
236
232
237
```markdown
233
-
### Jupyter Notebook Rules for Cursor (Using notebook_mcp):
238
+
### Jupyter Notebook Rules (Using notebook_mcp):
234
239
235
240
1. **Tool Usage:**
236
241
* Always use the tools provided by the `notebook_mcp` server for operations on Jupyter Notebook (`.ipynb`) files.
237
242
* Avoid using the standard `edit_file` tool on `.ipynb` files, as this can corrupt the notebook structure.
238
243
239
244
2. **Investigation Strategy:**
240
245
* A comprehensive suite of tools is available to inspect notebooks. If the user mentions an issue, a specific cell, or asks for a modification, first attempt to gather context independently.
241
-
* Use the available tools (`notebook_read`, `notebook_read_cell`, `notebook_get_info`, `notebook_read_metadata`, `notebook_read_cell_output`, `notebook_validate`) to examine the notebook structure, content, metadata, and outputs to locate the relevant context or identify the problem.
246
+
* Use the available tools (`notebook_get_outline`, `notebook_search`, `notebook_read`, `notebook_read_cell`, `notebook_get_info`, `notebook_read_metadata`, `notebook_read_cell_output`, `notebook_validate`) to examine the notebook structure, content, metadata, and outputs to locate the relevant context or identify the problem.
242
247
* Ask the user for clarification only if the necessary information cannot be determined after using the investigation tools.
243
248
244
249
3. **Available Tools:**
245
-
* Be aware of the different categories of tools: File operations (`create`, `delete`, `rename`), Notebook/Cell Reading (`read`, `read_cell`, `get_cell_count`, `get_info`), Cell Manipulation (`add_cell`, `edit_cell`, `delete_cell`, `move_cell`, `change_cell_type`, `duplicate_cell`, `split_cell`, `merge_cells`), Metadata (`read/edit_metadata`, `read/edit_cell_metadata`), Outputs (`read_cell_output`, `clear_cell_outputs`, `clear_all_outputs`), and Utility (`validate`, `export`, `diagnose_imports`).
250
+
* Be aware of the different categories of tools: Situation awareness (`notebook_get_outline`), Search (`notebook_search`), File operations (`create`, `delete`, `rename`), Notebook/Cell Reading (`read`, `read_cell`, `get_cell_count`, `get_info`), Cell Manipulation (`add_cell`, `edit_cell`, `delete_cell`, `move_cell`, `change_cell_type`, `duplicate_cell`, `split_cell`, `merge_cells`), Metadata (`read/edit_metadata`, `read/edit_cell_metadata`), Outputs (`read_cell_output`, `clear_cell_outputs`, `clear_all_outputs`), and Utility (`validate`, `export`, `diagnose_imports`).
246
251
247
252
4. **Math Notation:** For LaTeX in Markdown cells, use `$ ... $`for inline math and `$$ ... $$`for display math. Avoid `\( ... \)` and `\[ ... \]`.
0 commit comments