agentleFS
datalayerdatalayer/jupyter-mcp-server/.github/copilot-instructions.md

jupyter-mcp-server

Copilot instructions1.3k starsChanged 3 months agoBSD-3-ClauseView on GitHub

Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. Jupyter MCP Server is a Python-based Model Context Protocol (MCP) server implementation that enables real-time interaction with Jupyter Notebooks. The project uses a modern Python build system with hatch, and includes comprehensive testing, linting, and documentation. NETWORK TIMEOUT WARNING: pip install commands may fail with SSL certificate errors or read timeouts when connecting to PyPI.…

  • Installs packages

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 1 mentionMar 2026: 1 mentionApr 2026: 3 mentionsMay 2026: 0 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 2 mentionsOct 2026: 2 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the datalayer/jupyter-mcp-server repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about datalayer/jupyter-mcp-server

The biggest 5 of 26 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 26

Talked about on GitHub and Bluesky (26 times).

On GitHub · 16

11 more on GitHub

On Bluesky · 10

5 more on Bluesky
  • In this repositoryOne other file it gives its agents.

The file

We split this copilot-instructions.md into the rules it gives an agent

12 rules. About 0 are common, 7 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Docker build which handles dependencies internally

    line 39
  2. Distinctive:

    Document the network limitation in any testing notes

    line 40
  3. Distinctive:

    VALIDATION REQUIREMENT: When testing is not possible due to network issues, verify at minimum:

    line 74
  4. Very specific:

    Add tool definition in jupyter_mcp_server/server.py

    line 219
  5. Very specific:

    Update models in jupyter_mcp_server/models.py if needed

    line 220
  6. Very specific:

    Add tests in tests/test_mcp.py

    line 221
  7. Very specific:

    Update documentation in docs/

    line 222
  8. Very specific:

    Dev deps: Use [test,lint,typing] optional dependencies

    line 227
  9. Distinctive:

    Document network failures: when they occur: "pip install fails due to network limitations"

    line 272
  10. Distinctive:

    Use syntax validation: instead of full testing when pip installs fail

    line 273
  11. Distinctive:

    Never cancel long-running commands: - document expected timing instead

    line 276
  12. Distinctive:

    Always set timeouts to at least double these estimates to account for network variability.

    line 289

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md
<!-- ~ Copyright (c) 2024- Datalayer, Inc. ~ ~ BSD 3-Clause License -->

Jupyter MCP Server

Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.

Jupyter MCP Server is a Python-based Model Context Protocol (MCP) server implementation that enables real-time interaction with Jupyter Notebooks. The project uses a modern Python build system with hatch, and includes comprehensive testing, linting, and documentation.

Working Effectively

Environment Setup

  • Python Requirements: Python 3.10 or higher (tested with 3.9-3.13)
  • Network Considerations: PyPI installs may fail due to SSL certificate issues or timeout limitations. This is a known environment constraint.

Build and Install (CRITICAL: Network Limitations)

# Standard installation (may fail with network issues)
pip install ".[test,lint,typing]"

# Alternative if pip install fails:
# 1. Install dependencies individually with longer timeouts
pip install --timeout=300 pytest
pip install --timeout=300 ruff
pip install --timeout=300 mypy

# 2. Or use Docker approach (preferred for consistency)
docker build -t jupyter-mcp-server .

NETWORK TIMEOUT WARNING: pip install commands may fail with SSL certificate errors or read timeouts when connecting to PyPI. If installs fail:

  • Try increasing timeout: pip install --timeout=300
  • Use Docker build which handles dependencies internally
  • Document the network limitation in any testing notes

Core Development Commands

# Development installation (when network allows)
make dev
# Equivalent to: pip install ".[test,lint,typing]"

# Basic installation
make install
# Equivalent to: pip install .

# Build the package
make build
# Equivalent to: pip install build && python -m build .

Testing (CRITICAL: Use Long Timeouts)

# Run tests using hatch (when available)
make test
# Equivalent to: hatch test

# Run tests directly with pytest (when network allows install)
pytest .

# NEVER CANCEL: Test suite timing expectations
# - Full test suite: Allow 15-20 minutes minimum
# - Network-dependent tests may take longer
# - Set timeout to 30+ minutes for safety

VALIDATION REQUIREMENT: When testing is not possible due to network issues, verify at minimum:

# Syntax validation (always works)
python -m py_compile jupyter_mcp_server/server.py
find . -name "*.py" -exec python -m py_compile {} \;

# Import validation
PYTHONPATH=. python -c "import jupyter_mcp_server; print('Import successful')"

Linting and Code Quality (CRITICAL: Use Long Timeouts)

# Full linting pipeline (when network allows)
bash ./.github/workflows/lint.sh

# Individual linting commands:
pip install -e ".[lint,typing]"
mypy --install-types --non-interactive .  # May take 10+ minutes, NEVER CANCEL
ruff check .                              # Quick, usually <1 minute
mdformat --check *.md                     # Quick, usually <1 minute
pipx run 'validate-pyproject[all]' pyproject.toml  # 2-3 minutes

# TIMING WARNING: mypy type checking can take 10+ minutes on first run
# Set timeout to 20+ minutes for mypy operations

Running the Application

Local Development Mode

# Start with streamable HTTP transport
make start
# Equivalent to:
jupyter-mcp-server start \
  --transport streamable-http \
  --document-url http://localhost:8888 \
  --document-id notebook.ipynb \
  --document-token MY_TOKEN \
  --code-sandbox-url http://localhost:8888 \
  --start-new-code-sandbox true \
  --code-sandbox-token MY_TOKEN \
  --port 4040

JupyterLab Setup (Required for Testing)

# Start JupyterLab server for MCP integration
make jupyterlab
# Equivalent to:
jupyter lab \
  --port 8888 \
  --ip 0.0.0.0 \
  --ServerApp.root_dir ./dev/content \
  --IdentityProvider.token MY_TOKEN

Docker Deployment

# Build Docker image (NEVER CANCEL: Build takes 10-15 minutes)
make build-docker  # Takes 10-15 minutes, set timeout to 20+ minutes

# Run with Docker
make start-docker
# Or manually:
docker run -i --rm \
  -e DOCUMENT_URL=http://localhost:8888 \
  -e DOCUMENT_ID=notebook.ipynb \
  -e DOCUMENT_TOKEN=MY_TOKEN \
  -e CODE_SANDBOX_URL=http://localhost:8888 \
  -e START_NEW_CODE_SANDBOX=true \
  -e CODE_SANDBOX_TOKEN=MY_TOKEN \
  --network=host \
  datalayer/jupyter-mcp-server:latest

Manual Validation Scenarios

When full testing is not possible due to network constraints, always verify:

  1. Syntax and Import Validation:

    # Validate all Python files compile
    find . -name "*.py" -exec python -m py_compile {} \;
    
    # Test local imports work
    PYTHONPATH=. python -c "import jupyter_mcp_server; print('SUCCESS')"
  2. Configuration Validation:

    # Verify pyproject.toml is valid
    python -c "import tomllib; tomllib.load(open('pyproject.toml', 'rb'))"
    
    # Test module structure
    python -c "import jupyter_mcp_server.server, jupyter_mcp_server.models"
  3. Documentation Build (when Node.js available):

    cd docs/
    npm install  # May have network issues
    npm run build  # 3-5 minutes, set timeout to 10+ minutes

Project Structure and Navigation

Key Directories

  • jupyter_mcp_server/: Main Python package
    • server.py: Core MCP server implementation with MCPServer integration
    • models.py: Pydantic data models for document and code sandbox handling
    • utils.py: Utility functions for output extraction and processing
    • tests/: Unit tests (internal package tests)
  • tests/: Integration tests using pytest-asyncio
  • docs/: Docusaurus-based documentation site (Node.js/React)
  • dev/content/: Development Jupyter notebook files for testing
  • .github/workflows/: CI/CD pipeline definitions

Important Files

  • pyproject.toml: Build configuration, dependencies, and tool settings
  • Makefile: Development workflow automation
  • Dockerfile: Container build definition
  • .github/workflows/lint.sh: Linting pipeline script
  • pytest.ini: Test configuration

Frequently Modified Areas

  • Server Logic: jupyter_mcp_server/server.py - Main MCP server implementation
  • Data Models: jupyter_mcp_server/models.py - When adding new MCP tools or changing data structures
  • Tests: tests/test_mcp.py - Integration tests for MCP functionality
  • Documentation: docs/src/ - When updating API documentation or user guides

Common Tasks and Gotchas

Adding New MCP Tools

  1. Add tool definition in jupyter_mcp_server/server.py
  2. Update models in jupyter_mcp_server/models.py if needed
  3. Add tests in tests/test_mcp.py
  4. Update documentation in docs/

Dependency Management

  • Core deps: Defined in pyproject.toml dependencies section
  • Dev deps: Use [test,lint,typing] optional dependencies

CI/CD Pipeline Expectations

  • Build Matrix: Tests run on Ubuntu, macOS, Windows with Python 3.9, 3.13
  • Critical Timing: Full CI pipeline takes 20-30 minutes
  • Required Checks: pytest, ruff, mypy, mdformat, pyproject validation

Environment Variables for Testing

# Required for MCP server operation
export DOCUMENT_URL="http://localhost:8888"
export DOCUMENT_TOKEN="MY_TOKEN"
export DOCUMENT_ID="notebook.ipynb"
export CODE_SANDBOX_URL="http://localhost:8888"
export CODE_SANDBOX_TOKEN="MY_TOKEN"

Network Limitations and Workarounds

CRITICAL CONSTRAINT: This development environment has limited PyPI connectivity with SSL certificate issues and timeout problems.

Known Working Commands

# These always work (no network required):
python -m py_compile <file>          # Syntax validation
PYTHONPATH=. python -c "import ..."  # Import testing
python -c "import tomllib; ..."      # Config validation
git operations                       # Version control
docker build (when base images cached)

Commands That May Fail

pip install <anything>               # Network timeouts/SSL issues
npm install                          # Network limitations
mypy --install-types                 # Downloads type stubs
hatch test                           # May need PyPI for dependencies

Required Workarounds

  1. Document network failures when they occur: "pip install fails due to network limitations"
  2. Use syntax validation instead of full testing when pip installs fail
  3. Prefer Docker approach for consistent builds when possible
  4. Set generous timeouts (60+ minutes) for any network operations
  5. Never cancel long-running commands - document expected timing instead

Timing Expectations

NEVER CANCEL these operations - they are expected to take significant time:

  • pip install ".[test,lint,typing]": 5-10 minutes (when network works)
  • mypy --install-types --non-interactive: 10-15 minutes first run
  • Docker build: 10-15 minutes
  • Full test suite: 15-20 minutes
  • Documentation build: 3-5 minutes
  • CI pipeline: 20-30 minutes total

Always set timeouts to at least double these estimates to account for network variability.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.