Skip to content

feat(mcp): add konfai-mcp, an agent-facing MCP server for KonfAI - #36

Merged
vboussot merged 7 commits into
mainfrom
konfai-mcp
Jul 14, 2026
Merged

feat(mcp): add konfai-mcp, an agent-facing MCP server for KonfAI#36
vboussot merged 7 commits into
mainfrom
konfai-mcp

Conversation

@vboussot

@vboussot vboussot commented Jul 10, 2026

Copy link
Copy Markdown
Member

Adds konfai-mcp, an independent FastMCP server that exposes the whole KonfAI loop to LLM agents, plus the app-repository capabilities it drives.

Stacked on #38 (declarative YAML model catalog) — review that first. This PR is the agent layer on top of it.

What an agent can do through it

  • Discover & inspect a dataset (groups, sampled stats, corrupt-input reasons, DICOM/OME-Zarr layouts).
  • Author configs and models: write session files, and pick a model from the shipped catalog, an installed class (MONAI/torchvision/smp, auto-wrapped), or a custom Python/YAML graph. inspect_object_signature explains any of them (hyperparameters, loss-attachable outputs, how to adapt); the modeling guidance prefers the proven catalog and states what the KonfAI contract buys over a black-box import.
  • Validate side-effect-free in a spawn subprocess (static review + instantiate / one-train-step), never in the server process.
  • Run tracked train/predict/evaluate jobs with process-group cancel and traceback-faithful logs, then compare runs and build leaderboards.
  • Use published apps: describe / infer / fine-tune / package.

Structure

  • konfai-mcp/ — the independent package (own pyproject, CI, tests).
  • konfai-apps gains task / finetunable / declared-default surfacing (relayed over the remote server) so an agent can route to, fine-tune, or run an app from its declared inputs.
  • A problem-led docs page and the konfai-experiments agent skill (canonical loop + generated tool reference).

Verification

The konfai-mcp suite (unit + integration incl. a segmentation end-to-end pipeline and a tool-index anti-drift check) is green; the app-capability contract is locked by tests.

@vboussot vboussot changed the title feat: add konfai-mcp — an agent-facing MCP server for KonfAI feat: add konfai-mcp, an agent-facing MCP server for KonfAI Jul 10, 2026
vboussot added 4 commits July 14, 2026 14:59
…ridge

Reorganise builtin models under konfai/models/{python,yaml} and ship a declarative YAML model
catalog resolved via 'classpath: default|<Name>.yml' and packaged in the wheel: UNet, NestedUNet,
ResNet (weight-exact vs the KonfAI classes), SegResNet/VNet/DynUNet/ResNet18/VGG16/PlainConvUNet
(weight-exact vs MONAI/torchvision/nnU-Net, real pretrained weights load through the new
konfai.utils.pretrained execution-order bridge), a parametric PlainConvUNet for any nnU-Net topology,
an SMP encoder-backed wrapper, the MIND descriptor, and the ClipNormalize block. The model-builder
registry grows curated primitives (norms, activations, transformer blocks); the classpath resolver is
re-rooted to konfai.models.python (short form unchanged). Also folds the mixed-accumulation
double-backward fix and the point-of-use SimpleITK guard that touch network.py/blocks.py.

BREAKING CHANGE: fully-qualified references 'konfai.models.<task>.<Module>:<Class>' become
'konfai.models.python.<task>.<Module>:<Class>' (no compatibility alias).
FocalLoss batch>1 broadcast, BEST-checkpoint optimisation direction, OneHot.inverse batched argmax,
Literal defaults, SLURM rendezvous host, ConvNeXt LayerScaler, DDP shard tail, load_state_dict shrink,
and a --resubmit warning instead of a silently dropped flag. SimpleITK is guarded at point-of-use so
the package imports without the itk extra. Comments unified in English and SPDX headers completed
(incl. the app CLI wrappers); the Slicer-facing core API surface is locked by contract tests.
A runnable synthetic-data registration example (train/predict/evaluate on the builtin VoxelMorph),
and the Segmentation and Synthesis examples now ship their model in both a declarative YAML and an
equivalent Python form (verified weight-identical), with READMEs explaining when each form applies.
Surface task/finetunable/optional-input defaults on app repositories (relayed over the remote
server), so an agent can route to a published app, fine-tune it, or run it from its declared
inputs; the get_parameters values/constraints contract is locked by tests.
@vboussot vboussot changed the title feat: add konfai-mcp, an agent-facing MCP server for KonfAI feat(mcp): add konfai-mcp, an agent-facing MCP server for KonfAI Jul 14, 2026
@vboussot
vboussot changed the base branch from main to network July 14, 2026 13:19
vboussot added 3 commits July 14, 2026 15:33
A FastMCP server exposing the full KonfAI loop to LLM agents: dataset discovery/inspection,
config authoring with static review and side-effect-free semantic validation in a spawn
subprocess, tracked train/predict/evaluate jobs with process-group cancel and traceback-faithful
logs, run comparison and leaderboards, published-app integration (describe/infer/fine-tune), and a
first-class model catalog (list/inspect a default|<Name>.yml or session model; guidance that
prefers the proven catalog and explains what the KonfAI contract buys). Independent package with its
own pyproject and CI.
Unit and integration tests for the MCP tools (dataset, config authoring/validation, jobs,
apps, catalog discovery) plus a segmentation end-to-end pipeline and a tool-index anti-drift check.
A problem-led MCP usage page, the konfai-experiments agent skill (canonical loop + generated
tool reference), and the AGENTS.md guidance for working on the MCP server.
Base automatically changed from network to main July 14, 2026 13:56
@vboussot
vboussot merged commit 1fbce78 into main Jul 14, 2026
33 checks passed
@vboussot
vboussot deleted the konfai-mcp branch July 14, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant