File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ OpenSemanticLab data model.
4141
4242## CLI and MCP tools
4343
44- Installing ` osw ` also installs an ` osw ` command line client, and the separate
44+ Installing ` osw ` also installs an ` osw ` command line client, and the
4545` osw[mcp] ` extra adds an MCP server that exposes a live instance to agent
4646clients such as Claude Code:
4747
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ no install of its own.
2929
3030</details >
3131
32- ` osw[mcp] ` is not part of ` osw[all] ` , see [ Design notes] ( #design-notes ) . The
33- other extras are listed in the
32+ ` osw[mcp] ` is also part of ` osw[all] ` . The other extras are listed in the
3433[ Get Started guide] ( get-started.md#optional-extras ) .
3534
3635Both adapters need an instance and credentials. The quickest start is a
@@ -314,12 +313,9 @@ Why the two adapters are shaped the way they are:
314313- **stdio only.** SSE is deprecated upstream, and HTTP would need a
315314 per-connection auth model this server does not have : it holds one set of wiki
316315 credentials, which every client would share.
317- - **`osw[mcp]` outside `osw[all]`.** It needs `anyio>=4.9`, which conflicts with
318- the pin the `osw[workflow]` extra requires for prefect 2.x, so the two cannot
319- share an environment
320- ([#139](https://github.com/OpenSemanticLab/osw-python/issues/139)).
321- Installing the server standalone, for example via `uvx`, avoids the question
322- entirely.
316+ - **`mcp` is an extra, not a base dependency.** The SDK pulls in a server stack
317+ (starlette, uvicorn, sse-starlette) that nothing in the Python API or the CLI
318+ needs, so only users who actually run the server pay for it.
323319
324320# # Notes for developers
325321
Original file line number Diff line number Diff line change 3030| ` osw[S3] ` | Interact with S3 stores per S3FileController |
3131| ` osw[dataimport] ` | Additional tools to import data |
3232| ` osw[UI] ` | To use a helper UI to work with entity slots |
33+ | ` osw[mcp] ` | [ MCP server] ( cli-and-mcp.md#mcp-server ) for agent clients |
3334| ` osw[all] ` | All of the above |
34- | ` osw[mcp] ` | [ MCP server] ( cli-and-mcp.md#mcp-server ) for agent clients, not part of ` osw[all] ` |
3535
3636Install multiple extras with ` pip install osw[opt1,opt2] ` .
3737
Original file line number Diff line number Diff line change 1212import sys
1313from typing import Any , Optional
1414
15- # ty cannot resolve these: the mcp extra is uninstallable alongside the dev
16- # group (anyio conflict, issue #139), so it is absent from the env ty runs in.
17- # The rest of this module is type-checked; drop the ignores once #139 is fixed.
18- from mcp .server import MCPServer # ty: ignore[unresolved-import]
19- from mcp .types import ToolAnnotations # ty: ignore[unresolved-import]
15+ from mcp .server import MCPServer
16+ from mcp .types import ToolAnnotations
2017
2118import osw
2219import osw .service .ops
Original file line number Diff line number Diff line change @@ -226,8 +226,7 @@ def _load_env_file() -> None:
226226 name = next ((n for n in ENV_FILE if os .getenv (n ) == path ), ENV_FILE [0 ])
227227 raise RuntimeError (
228228 f"{ name } is set (to '{ path } ') but python-dotenv is not installed. "
229- "Install the osw[mcp] extra, or the `test` dependency group, to "
230- "use an env file."
229+ "Install the osw[mcp] extra to use an env file."
231230 )
232231 if path :
233232 dotenv .load_dotenv (path )
Original file line number Diff line number Diff line change 1111
1212import pytest
1313
14- pytest .importorskip ("mcp" , reason = "requires the osw[mcp] extra" )
15- pytest .importorskip ("dotenv" , reason = "requires the osw[mcp] extra" )
16-
1714import osw .service .ops # noqa: F401 (registers the operations)
1815from osw .service import config
1916from osw .service .context import Context , Policy
Original file line number Diff line number Diff line change 88
99from __future__ import annotations
1010
11- import pytest
12-
13- pytest .importorskip ("mcp" , reason = "requires the osw[mcp] extra" )
14-
1511from mcp .types import ToolAnnotations
1612
1713from osw .mcp .server import _annotations , _meta , tool_kwargs
Original file line number Diff line number Diff line change 1414import pytest
1515import yaml
1616
17- pytest .importorskip ("mcp" , reason = "requires the osw[mcp] extra" )
18- pytest .importorskip ("dotenv" , reason = "requires the osw[mcp] extra" )
19-
2017from osw .mcp import server
2118from osw .service import config
2219from osw .service .registry import iter_operations
Original file line number Diff line number Diff line change 11"""Guard tests: no filesystem path may ever reach the MCP surface.
22
3- Runs in the plain dev env (no mcp extra needed): importing ``osw.cli.ops``
4- (to register the CLI-only, path-taking operations, so the negative check
5- below cannot pass vacuously) and ``osw.service.ops`` touches neither the
6- ``mcp`` SDK nor the network. Only ``test_mcp_server_never_imports_cli``
7- needs the ``mcp`` extra (it imports ``osw.mcp.server`` itself), and
8- self-skips without it.
3+ Offline: importing ``osw.cli.ops`` (to register the CLI-only, path-taking
4+ operations, so the negative check below cannot pass vacuously) and
5+ ``osw.service.ops`` touches the network nowhere.
96"""
107
118from __future__ import annotations
1512import sys
1613from unittest .mock import MagicMock
1714
18- import pytest
19-
2015# Registers every operation, including the CLI-only path-taking ones, so
2116# osw.service.registry.REGISTRY is fully populated for the checks below.
2217import osw .cli .ops
@@ -72,7 +67,6 @@ def test_bound_operations_do_not_expose_ctx():
7267
7368
7469def test_mcp_server_never_imports_cli ():
75- pytest .importorskip ("mcp" , reason = "requires the osw[mcp] extra" )
7670 result = subprocess .run (
7771 [
7872 sys .executable ,
You can’t perform that action at this time.
0 commit comments