Skip to content

Commit ec5a9c3

Browse files
committed
feat: Release version 0.3.0
This release enables remote notebook editing and updates transport handling. Key highlights for version 0.3.0 include: - **Added SFTP Support**: Enables access and management of notebooks on remote SSH servers, with various authentication methods and new CLI arguments. - **Enhanced Web Transport via FastMCP**: Updated FastMCP for robust stdio, Streamable HTTP (now recommended), and SSE transport, simplifying server logic. - **New Notebook Tools**: - `notebook_edit_cell_output`: Allows direct manipulation of cell outputs. - `notebook_bulk_add_cells`: For adding multiple cells in one operation. - `notebook_get_server_path_context`: Provides server path details for client-side path construction. - **Changes & Fixes**: - Simplified installation: `uvicorn` and `starlette` are now core dependencies. - Removed custom SSE transport implementation and `validate_imports` tool. - Improved Windows path handling and fixed web transport errors. - Updated `README.md` with new transport instructions and known issues #1, #3. Resolves #2 Resolves #4 Resolves #5 For a comprehensive list of changes, please see `CHANGELOG.md`.
1 parent ae57eb4 commit ec5a9c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+15961
-2276
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
### Jupyter Notebook Rules for Cursor (Using notebook_mcp):
2+
3+
1. **IMPORTANT - Markdown Formatting:**
4+
* When creating or editing markdown cells, use **actual newlines** for paragraph breaks, not literal `\n\n` strings.
5+
* CORRECT: `"## Title\n\nThis is a paragraph."`
6+
* INCORRECT: `"## Title\\n\\nThis is a paragraph."`
7+
* After editing cells, always use `notebook_read_cell` to verify proper formatting.
8+
9+
2. **Tool Usage:**
10+
* Always use `notebook_mcp` tools for `.ipynb` files, never `edit_file`.
11+
* Verify changes after making them with `notebook_read_cell` or `notebook_read` (be efficient with tool calls).
12+
13+
3. **Path Resolution for Notebooks:**
14+
* **Initial Step:** At the beginning of notebook operations, or if path ambiguity exists, call `notebook_get_server_path_context` (providing the current `project_directory`).
15+
* Use its output (`allowed_roots`, `server_path_style`, `project_directory_status`, `effective_notebook_base_path_for_project`, `path_construction_guidance`) to determine how to construct `notebook_path` arguments for all other notebook tools.
16+
* **Goal:** For unqualified notebook names (e.g., `my_notebook.ipynb`), the `notebook_path` sent to tools should correctly target the user's current project directory by leveraging the `effective_notebook_base_path_for_project` (e.g., `project_name/my_notebook.ipynb`).
17+
* If the `project_directory_status` is `outside_allowed_roots` or `resolution_error`, inform the user and proceed with caution, relying on their explicit path guidance or warning about potential issues.
18+
* For explicit user-provided paths (e.g., `../another_project/data.ipynb` or absolute paths), use them as given, but warn if they appear to be outside the server's `allowed_roots` based on the context tool's output.
19+
* The server ultimately resolves paths relative to its configured `allowed_root`(s). The context tool helps align client-side path construction with server-side expectations.
20+
21+
4. **Character Escaping:**
22+
* For LaTeX: Use single backslashes (e.g., `\alpha`, not `\\alpha`).
23+
* For newlines: Use actual newlines in the string, not escaped `\\n`.
24+
* For display math: Use `$$..$$` not `\\[..\]`.
25+
26+
5. **Investigation Before Editing:**
27+
* Use `notebook_get_outline` and `notebook_search` first to understand notebook structure.
28+
* Read existing cells with `notebook_read_cell` before modifying them.
29+
30+
6. **Available Tools by Category:**
31+
* **Path & Server Context**: `notebook_get_server_path_context`
32+
* **Navigation & Discovery**: `notebook_get_outline`, `notebook_search`, `notebook_get_info`, `notebook_get_cell_count`
33+
* **File Operations**: `notebook_create`, `notebook_delete`, `notebook_rename`, `notebook_read`, `notebook_export`
34+
* **Cell Operations**: `notebook_read_cell`, `notebook_add_cell`, `notebook_edit_cell`, `notebook_delete_cell`, `notebook_bulk_add_cells` (use bulk add when you need to add multiple cells at once)
35+
* **Cell Transformations**: `notebook_change_cell_type`, `notebook_move_cell`, `notebook_split_cell`, `notebook_merge_cells`, `notebook_duplicate_cell`
36+
* **Metadata & Output**: `notebook_read_metadata`, `notebook_edit_metadata`, `notebook_read_cell_metadata`, `notebook_edit_cell_metadata`, `notebook_read_cell_output`, `notebook_edit_cell_output`, `notebook_clear_cell_outputs`, `notebook_clear_all_outputs`
37+
* **Validation**: `notebook_validate`
38+
39+
7. **Cell Magics & Rich Output:**
40+
* Use `!command` for shell commands (not `%%bash`).
41+
* Matplotlib, Pandas, and HTML in markdown render correctly.
42+
* Avoid `%%writefile` and similar unsupported magics.

CHANGELOG.md

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,42 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.0] - 2025-05-20
9+
10+
### Added
11+
- **SFTP Support for Remote Notebooks**: Added SFTP integration for accessing and managing notebooks on remote SSH servers (resolves [issue #2](https://github.com/jbeno/cursor-notebook-mcp/issues/2)).
12+
- New command-line arguments: `--sftp-root` (multiple allowed), `--sftp-password`, `--sftp-key`, `--sftp-port`, `--sftp-no-interactive`, `--sftp-no-agent`, `--sftp-no-password-prompt`, `--sftp-auth-mode`.
13+
- Supports various SSH authentication methods including password, public key (with passphrase), SSH agent, and interactive (2FA).
14+
- Transparently handles file operations on remote SFTP paths.
15+
- Automatic tilde (`~`) expansion for remote paths.
16+
- **Enhanced Web Transport with FastMCP (v2.3.4+):**
17+
- Integrated `FastMCP`'s `run()` method for robust handling of all transport modes (`stdio`, `streamable-http`, `sse`).
18+
- `--transport streamable-http`: Now uses `FastMCP`'s built-in Streamable HTTP, becoming the **recommended web transport**.
19+
- `--transport sse`: Now uses `FastMCP`'s built-in (but deprecated by FastMCP) two-endpoint SSE for legacy compatibility.
20+
- New tool: `notebook_edit_cell_output` to allow direct manipulation and setting of cell outputs.
21+
- New tool: `notebook_bulk_add_cells` for adding multiple cells to a notebook in a single operation.
22+
- New tool: `notebook_get_server_path_context` to provide detailed server path configuration for robust client path construction.
23+
- Added PowerShell script `run_tests.ps1` for test execution on Windows.
24+
- Added `examples/demo_tools_list.py` script, demonstrating client-side MCP handshake and `tools/list` request (part of resolving [issue #5](https://github.com/jbeno/cursor-notebook-mcp/issues/5)).
25+
26+
### Changed
27+
- **Refactored Server Logic**: Server now leverages `FastMCP`'s internal `run()` method for all transport modes, simplifying logic and improving reliability.
28+
- Improved path handling for Windows-style paths and URL-encoded components (related to [issue #4](https://github.com/jbeno/cursor-notebook-mcp/issues/4)).
29+
- Updated `README.md` with detailed instructions for all transport modes, `mcp.json` configurations, and refined transport recommendations. Added known issues for [issue #1](https://github.com/jbeno/cursor-notebook-mcp/issues/1) and [issue #3](https://github.com/jbeno/cursor-notebook-mcp/issues/3).
30+
- Updated `examples/demo_tools_list.py` script to demonstrate client-side MCP handshake and `tools/list` request.
31+
- Refined `cursor_rules.md` for clarity and to reflect new tool capabilities.
32+
- **Simplified Installation**: `uvicorn` and `starlette` are now core dependencies. Optional extras `[http]` and `[sse]` removed. All transports supported by default install.
33+
- Command-line `--transport` choices are now `stdio`, `streamable-http`, and `sse`.
34+
- Updated code coverage metrics: Overall 82%; `notebook_ops.py` 92%, `server.py` 93%, `tools.py` 82%, `sftp_manager.py` 74%.
35+
36+
### Removed
37+
- Custom SSE transport implementation (`cursor_notebook_mcp/sse_transport.py`), now handled by `FastMCP`.
38+
- Removed `validate_imports` tool, which, along with `tools/list` availability and updated documentation, resolves [issue #5](https://github.com/jbeno/cursor-notebook-mcp/issues/5).
39+
40+
### Fixed
41+
- HTTP 405 errors and client fallback issues for web transports by adopting `FastMCP`'s implementations.
42+
- Addressed issues with Windows path interpretation (resolves [issue #4](https://github.com/jbeno/cursor-notebook-mcp/issues/4)).
43+
844
## [0.2.4] - 2025-04-26
945

1046
### Added
@@ -13,7 +49,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1349
- The `notebook_get_outline` method analyzes a Jupyter notebook's structure, extracting cell types, line counts, and outlines for code and markdown cells.
1450
- The `notebook_search` method allows for case-insensitive searching within notebook cells, returning matches with context snippets.
1551
- 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.
1752
- Added validation tests for notebooks addressing invalid JSON and non-notebook files.
1853
- Added tests for outline extraction with invalid code syntax.
1954
- Added tests for empty search queries and behavior of large file truncation.
@@ -42,43 +77,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4277
- Removed invalid comments from JSON examples.
4378
- Explicitly documented external system requirements (Pandoc, LaTeX) for PDF export.
4479
- Updated project metadata (`classifiers`, `keywords`, `urls`) in `pyproject.toml`.
45-
- Configured `pytest` via `pyproject.toml` to set environment variables (`JUPYTER_PLATFORM_DIRS`).
46-
- Refactored `sse_transport.py` to separate app creation (`create_starlette_app`) for better testability.
47-
48-
### Fixed
49-
- Bug in `notebook_read` size estimation loop (`NameError: name 'i' is not defined`).
50-
- Multiple test failures related to incorrect mocking, error expectations, path handling, test setup, and imports (`StringIO`, `FastMCP`).
51-
- Invalid escape sequence in `pyproject.toml` coverage exclusion pattern.
52-
- Several issues in SSE transport (`sse_transport.py`) related to refactoring, including incorrect `SseServerTransport` initialization, missing `/messages` route handling, and incorrect parameters passed to the underlying `mcp.server.Server.run` method, causing connection failures.
53-
- GitHub Actions CI workflow failure (exit code 127) by switching dependency installation from `uv` to standard `pip` to ensure `pytest` is found.
54-
- Hanging test (`test_sse_route_connection` in `tests/test_sse_transport.py`) by refactoring to call the handler directly with a mock request instead of using `TestClient`.
55-
- CI test failure (`test_read_large_notebook_truncated`) by enabling Git LFS (`lfs: true`) in the `actions/checkout` step to correctly download large fixture files.
56-
57-
## [0.2.2] - 2025-04-19
58-
59-
### Fixed
60-
- Suppressed noisy `traitlets` validation errors (`Notebook JSON is invalid: Additional properties are not allowed ('id' was unexpected)`) by adding a specific logging filter in `server.py` instead of changing the global logger level. This prevents valid `ERROR` messages from `traitlets` from being hidden.
61-
62-
### Added
63-
- `CHANGELOG.md` file to track project changes.
64-
- "Suggested Cursor Rules" section to `README.md` explaining best practices for using the MCP server with Cursor's AI, formatted as a copy-pasteable markdown block.
65-
66-
## [0.2.1] - 2025-04-18
67-
68-
### Added
69-
- Initial release of the Jupyter Notebook MCP Server.
70-
- Core functionality for manipulating Jupyter Notebook (`.ipynb`) files via MCP tools.
71-
- Support for both `stdio` and `sse` transport modes.
72-
- Command-line arguments for configuration (allowed roots, logging, transport, etc.).
73-
- Security features: `--allow-root` enforcement, path validation, cell size limits.
74-
- MCP Tools Implemented:
75-
- File Operations: `notebook_create`, `notebook_delete`, `notebook_rename`
76-
- Notebook Read Operations: `notebook_read`, `notebook_get_cell_count`, `notebook_get_info`
77-
- Cell Read Operations: `notebook_read_cell`, `notebook_read_cell_output`
78-
- Cell Manipulation: `notebook_add_cell`, `notebook_edit_cell`, `notebook_delete_cell`, `notebook_move_cell`, `notebook_change_cell_type`, `notebook_duplicate_cell`, `notebook_split_cell`, `notebook_merge_cells`
79-
- Metadata Operations: `notebook_read_metadata`, `notebook_edit_metadata`, `notebook_read_cell_metadata`, `notebook_edit_cell_metadata`
80-
- Output Management: `notebook_clear_cell_outputs`, `notebook_clear_all_outputs`
81-
- Utility: `notebook_validate`, `notebook_export` (via `nbconvert`)
82-
- Basic `README.md` with installation, usage, and integration instructions.
83-
- `pyproject.toml` for packaging and dependency management.
84-
- Test suite using `pytest`.
80+
- Configured `pytest` via `pyproject.toml` to set environment variables (`JUPYTER_PLATFORM_DIRS`

0 commit comments

Comments
 (0)