Skip to content

title: API — the MCP server description: pardesline.mcp_server: build_server, main, skills_dir and the impl_* functions behind every MCP tool.


MCP server

pardesline.mcp_server

pardesline mcp: the package as a Model Context Protocol server.

Any MCP client - Claude Desktop and Claude Code, Cursor, Gemini CLI, Codex, a LangChain or OpenAI Agents tool loop - gets the 43 bundled datasets, any hf:// / s3:// / tcia:// source, private folders through pl.scan, the typed object model and the 73 catalog algorithms, on the user's machine, without a PardesLine account. Nothing leaves the machine except the downloads the user asks for.

Run it with pardesline mcp (stdio, the default every client speaks) or pardesline mcp --transport streamable-http --port 8765. Needs pip install "pardesline[mcp]".

Design rules for tools: - every result is plain JSON (paths as strings), small enough for a context window (lists are paged with limit / offset); - blocking work (downloads, algorithms) runs in a worker thread so the server keeps answering; - the package's own rules hold: nothing is guessed, a question is returned as data for the agent to relay to the human (scan_dataset -> confirm_dataset), gated sources explain what the human must do.

build_server

build_server(name: str = 'pardesline')

The FastMCP server with every tool, resource and prompt registered.

main

main(argv: list[str] | None = None) -> int

Run the MCP server (pardesline mcp).

stdio by default; --transport streamable-http --port N serves HTTP.

skills_dir

skills_dir() -> Path

Where the expert skills live: inside the installed package, or the repo's skills/ folder.

impl_list_datasets

impl_list_datasets(tag: str | None = None, scheme: str | None = None, medical_only: bool = False) -> dict

The bundled manifests as summaries.

Filtered by tag, source scheme or medical_only.

impl_describe_dataset

impl_describe_dataset(ref: str, count_samples: bool = False) -> dict

Roles, frames, units, labels, licence and citation of a dataset reference.

ref is a bundled name, an hf:// / tcia:// / s3:// URI, a manifest path or a folder. count_samples lists the source to count samples, which may take a while on large archives.

impl_list_samples

impl_list_samples(ref: str, limit: int = 50, offset: int = 0, filters: dict[str, str] | None = None) -> dict

Sample ids and fields of a dataset, paged with limit / offset.

filters restricts to samples whose fields match.

impl_load_sample

impl_load_sample(ref: str, sample: str | int, role: str, standard: bool = True) -> dict

Fetch one role of one sample and describe the resulting object.

Returns the path, kind, frame, units, labels, licence, provenance, the catalog methods that accept the file and, when standard is true, standard_path: a PLY / MetaImage rendition for raw arrays and DICOM folders.

impl_scan_dataset

impl_scan_dataset(ref: str) -> dict

Draft a manifest for a folder or a Hub repository and return its open questions.

impl_confirm_dataset

impl_confirm_dataset(ref: str, answers: dict[str, Any] | None = None, save_to: str | None = None) -> dict

Answer a draft's questions (license, units, labels...) and save the manifest.

impl_export_dataset

impl_export_dataset(ref: str, folder: str, take: int | None = None, overwrite: bool = False) -> dict

Write a dataset (or its first take samples) as standard files.

PLY / MetaImage with sidecars and a manifest for the folder.

impl_list_methods

impl_list_methods(extension: str | None = None, category: str | None = None) -> dict

The catalog methods, optionally those accepting a file extension or in a category.

impl_describe_method

impl_describe_method(method: str) -> dict

One method with every parameter.

Type, default, range, description, rationale and validation regime.

impl_run_method

impl_run_method(method: str, input_path: str, moving_path: str | None = None, params: dict[str, Any] | None = None, output_path: str | None = None, timeout: float = 600) -> dict

Run a catalog method on a file with validated parameters.

Returns the output path and the recorded provenance step.

impl_describe_object

impl_describe_object(path: str, layout: dict[str, Any] | None = None, kind: str | None = None) -> dict

Kind, frame, units, labels, sidecar and accepted methods of any file.

Raw arrays (.npy, .bin) need a layout.

impl_to_mesh

impl_to_mesh(path: str, label: int | None = None, isovalue: float | None = None, output_path: str | None = None) -> dict

A label map or volume to a surface.

label gives the exact boundary of one label, isovalue a level set.

impl_list_skills

impl_list_skills() -> dict

The expert skills shipped with the package: name, description and files.

impl_get_skill

impl_get_skill(name: str, file: str | None = None) -> dict

The text of a skill's SKILL.md or of one of its files.

Paths outside the skill folder are refused.