Build StdioServerParameters for a server spec. - str → entry-point name; invoked as ``uv run `` from the repo root. - Path → invoked as ``python -m module.path`` when under the repo root (supports relative imports), or directly otherwise.
(server: Path | str)
| 255 | |
| 256 | |
| 257 | def _make_stdio_params(server: Path | str) -> "StdioServerParameters": |
| 258 | """Build StdioServerParameters for a server spec. |
| 259 | |
| 260 | - str → entry-point name; invoked as ``uv run <name>`` from the repo root. |
| 261 | - Path → invoked as ``python -m module.path`` when under the repo root |
| 262 | (supports relative imports), or directly otherwise. |
| 263 | """ |
| 264 | from mcp import StdioServerParameters |
| 265 | |
| 266 | if isinstance(server, str): |
| 267 | return StdioServerParameters( |
| 268 | command="uv", |
| 269 | args=["run", server], |
| 270 | cwd=str(_REPO_ROOT), |
| 271 | ) |
| 272 | try: |
| 273 | rel = server.relative_to(_REPO_ROOT) |
| 274 | module = str(rel.with_suffix("")).replace("/", ".").replace("\\", ".") |
| 275 | return StdioServerParameters( |
| 276 | command="python", |
| 277 | args=["-m", module], |
| 278 | cwd=str(_REPO_ROOT), |
| 279 | ) |
| 280 | except ValueError: |
| 281 | return StdioServerParameters(command="python", args=[str(server)]) |
| 282 | |
| 283 | |
| 284 | async def _list_tools(server_path: Path | str) -> list[dict]: |
no outgoing calls
no test coverage detected