Skip to content

Commit bf898aa

Browse files
authored
Merge pull request #9 from jtpio/entrypoint
Expose tools via the `jupyter_server_mcp` entrypoints
2 parents fcf1bd5 + 3d4cac5 commit bf898aa

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ for the frontend extension.
1212

1313
- **Command Discovery**: List all available JupyterLab commands with their metadata
1414
- **Command Execution**: Execute any JupyterLab command programmatically from Python
15+
- **MCP Integration**: Automatically exposes tools to AI assistants via [jupyter-server-mcp](https://github.com/jupyter-ai-contrib/jupyter-server-mcp)
1516

1617
## Requirements
1718

@@ -25,9 +26,40 @@ To install the extension, execute:
2526
pip install jupyterlab_commands_toolkit
2627
```
2728

29+
To install with `jupyter-server-mcp` integration support:
30+
31+
```bash
32+
pip install jupyterlab_commands_toolkit[mcp]
33+
```
34+
2835
## Usage
2936

30-
Use the toolkit to execute any JupyterLab command from Python:
37+
### With jupyter-server-mcp (Recommended)
38+
39+
This extension automatically registers its tools with [jupyter-server-mcp](https://github.com/jupyter-ai-contrib/jupyter-server-mcp) via Python entrypoints, making them available to AI assistants and other MCP clients.
40+
41+
1. Install both packages:
42+
43+
```bash
44+
pip install jupyterlab_commands_toolkit[mcp]
45+
```
46+
47+
2. Start Jupyter Lab (the MCP server starts automatically):
48+
49+
```bash
50+
jupyter lab
51+
```
52+
53+
3. Configure your MCP client (e.g., Claude Desktop) to connect to `http://localhost:3001/mcp`
54+
55+
The following tools will be automatically available:
56+
57+
- `list_all_commands` - List all available JupyterLab commands with their metadata
58+
- `execute_command` - Execute any JupyterLab command programmatically
59+
60+
### Direct Python Usage
61+
62+
Use the toolkit directly from Python to execute JupyterLab commands:
3163

3264
```python
3365
import asyncio

jupyterlab_commands_toolkit/tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
# Store for pending command results
99
pending_requests: Dict[str, Dict[str, Any]] = {}
1010

11+
# Tools list for jupyter-server-mcp entrypoint discovery
12+
TOOLS = [
13+
"jupyterlab_commands_toolkit.tools:list_all_commands",
14+
"jupyterlab_commands_toolkit.tools:execute_command",
15+
]
16+
1117

1218
def emit(data, wait_for_result=False):
1319
"""

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ dependencies = [
2828
]
2929
dynamic = ["version", "description", "authors", "urls", "keywords"]
3030

31+
[project.optional-dependencies]
32+
mcp = ["jupyter-server-mcp>=0.1.2"]
33+
34+
[project.entry-points."jupyter_server_mcp.tools"]
35+
jupyterlab_commands_toolkit = "jupyterlab_commands_toolkit.tools:TOOLS"
36+
3137
[tool.hatch.version]
3238
source = "nodejs"
3339

0 commit comments

Comments
 (0)