champollion-sulcal-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@champollion-sulcal-mcp run the cortical tiles stage for subject S001"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
champollion-sulcal-mcp
A FastMCP server wrapping the Champollion sulcal embedding pipeline — exposes each pipeline stage as an MCP tool so an agent can run, monitor, and debug the pipeline without shelling out manually.
Overview
This is a stdio MCP server (not a web service). It doesn't run the pipeline in-process — each start_* tool launches one of the pipeline's CLI scripts as a subprocess and tracks it as a background job (status + log file on disk), which callers poll until it reaches a terminal state.
It's consumed by the technician agent in the sibling champollion_agents repo, and also ships its own Claude Code subagent definition and skills so it can be driven directly from Claude Code.
Related MCP server: consulting-mcp-server
How it works
A caller (an MCP client, or the Technician agent via
claude-code-sdk) invokes a tool such asstart_cortical_tiles.The tool validates its arguments (paths must be absolute), resolves the pipeline's script location via
preflight.detect(), and builds anargvmatching that script's real CLI.runner.launch()spawns the script as a subprocess with an environment built by_build_env()(selectively passesHF_TOKEN, injectsBRAINVISA_SHARE, prepends BrainVISA/pixi bins toPATH), and returns immediately with ajob_id.The subprocess's combined stdout/stderr is streamed line-by-line into a log file; progress lines matching
fold N/Mupdate the job's progress.The caller polls
get_job_status(output_dir, job_id)(and can tailget_job_log) until the job issucceeded,failed, orcancelled.
Pipeline stages
Stage | Tool | Purpose |
1 |
| Generate sulcal graphs from T1 MRI using Morphologist |
2 |
| Extract 28 standardized sulcal region crops |
3 |
| Generate Champollion dataset YAML configuration |
4 |
| Compute 56-fold sulcal embeddings (28 regions × 2 hemispheres) |
5 |
| Collect per-region embedding CSVs into a single output directory |
6 |
| Render sulcal graph meshes, cortical tile masks, and UMAP plots |
— |
| Run stages 1–6 sequentially as one umbrella job (stages skippable) |
— |
| Scan-centric mode: one worker per scan runs stages 2–4 in parallel; combine runs once after all workers drain |
— |
| Train a self-supervised |
Project layout
src/champollion_sulcal_mcp/
├── server.py # FastMCP instance, tool registration, entry point (main())
├── preflight.py # locates the champollion_pipeline repo + its scripts/submodules
├── job_store.py # JobState/JobProgress models, JSON job file persistence
├── runner.py # subprocess launch, log streaming, progress parsing, cancel
└── tools/
├── stages.py # one start_<stage> tool per pipeline stage + maintenance tools
├── pipeline.py # start_pipeline composite/umbrella job orchestration
├── jobs.py # get_job_status, list_jobs, cancel_job, get_job_log
└── utils.py # get_pipeline_info, preflight_check
agents/
└── champollion-pipeline.md # Claude Code subagent definition for this MCP server
skills/
├── run-pipeline/ # SKILL.md guiding stage-centric vs streaming execution
├── monitor/ # SKILL.md for the job-polling loop
└── debug/ # SKILL.md + known error patterns for failure diagnosis
docs/
└── agents_architecture.md # early design doc for the champollion_agents repo (historical, superseded — see note below)
tests/ # pytest suite with fake_pipeline_dir / recording_runner fixturesMCP tools reference
Registered in server.py:
Stage launchers — start_morphologist, start_cortical_tiles, start_config, start_training, start_embeddings, start_combine, start_snapshots
Composite pipeline — start_pipeline
Streaming — start_streaming
Maintenance — purge_subject (remove a subject's cortical_tiles derivatives), prune_failed_subjects (remove outputs for subjects that failed QC)
Job lifecycle — get_job_status, list_jobs, cancel_job, get_job_log
Utilities — get_pipeline_info (server/stage metadata), preflight_check (verify the pipeline is correctly configured and accessible)
Requirements
Python 3.11 or 3.12
The sibling
champollion_pipelinerepository (not included here) — must contain the stage scripts undersrc/(generate_morphologist_graphs.py,run_cortical_tiles.py,generate_champollion_config.py,generate_embeddings.py,put_together_embeddings.py,generate_snapshots.py,train_champollion.py,run_streaming.py) and theexternal/champollion_V1andexternal/cortical_tilessubmodules.
Installation
pixi installConfiguration
Variable | Purpose | Default |
| Absolute path to the | Falls back to |
| HuggingFace token | Passed through only to the |
| BrainVISA install location / share dir | Auto-injected from the pipeline's pixi environment if not already set in the environment |
Running
This is a stdio server meant to be launched by an MCP client (e.g. the Technician agent's ClaudeCodeOptions.mcp_servers config in champollion_agents), not run interactively on its own:
pixi run run # python -m champollion_sulcal_mcp.server
# or, once installed:
champollion-sulcal-mcpClaude Code integration
Beyond the raw MCP tools, this repo ships assets for using the pipeline directly from Claude Code:
agents/champollion-pipeline.md— a subagent scoped to exactly the MCP tools it needs, with an operational playbook: always preflight first, never guess paths, default output layout, per-stage required parameters, a known-error-pattern table, and the exact CLI invocation each tool wraps.skills/run-pipeline— guides choosing stage-centric vs. streaming execution and gathering the right parameters.skills/monitor— a poll-every-30-seconds monitoring loop with per-job-type progress reporting.skills/debug— systematic failure diagnosis: read the full log, match against known error patterns, report root cause and fix.
Job tracking
Each job is persisted as <output_dir>/.mcp_jobs/<job_id>.json (atomic write) with its combined stdout/stderr log at <output_dir>/.mcp_jobs/<job_id>.log. Status lifecycle: pending → running → one of succeeded / failed / cancelled. start_pipeline additionally writes an "umbrella" job whose progress tracks current_stage / stages_done / stages_total and the currently active child job_id.
Testing
pixi run test # full suite
pixi run test-unit # unit-marked tests only
pixi run test-fast # stop on first failure
pixi run test-cov # with coverage reporttests/conftest.py provides fake_pipeline_dir (a temp dir with stub stage scripts and submodule folders) and recording_runner (stubs runner.launch to record calls instead of spawning real subprocesses), so most tool behavior can be tested without a real champollion_pipeline checkout.
Linting
pixi run lint # ruff check
pixi run lint-fix # ruff check --fix
pixi run format # ruff formatNote on docs/agents_architecture.md
That document is an early architecture proposal for the champollion_agents repo (ACP/acp-sdk, OpenAI-compatible LLM backend, in-process ChromaDB indexing). It predates and does not reflect the current implementation of either repo — champollion_agents now runs its agents through claude-code-sdk rather than a custom ACP/LangGraph stack, and this repo has no LLM or ACP code at all. Kept for historical context only.
Available Tools
17 toolscancel_jobC
Cancel a running job by sending SIGTERM to its process.
Inputs: job_id (required), output_dir (required). Returns: object
get_job_logB
Retrieve the last N lines of a job's log output.
Inputs: job_id (required), output_dir (required), tail_lines. Returns: object
get_job_statusB
Get the current status and progress of a running or completed job.
Inputs: job_id (required), output_dir (required). Returns: object
get_pipeline_infoA
Get metadata about the Champollion pipeline and available MCP tools.
Inputs: no named parameters. Returns: object
list_jobsB
List all jobs for a given output directory, optionally filtered by status.
Inputs: output_dir (required), limit, status. Returns: result
preflight_checkA
Check whether the Champollion pipeline is correctly configured and accessible.
Inputs: no named parameters. Returns: object
prune_failed_subjectsA
Remove cortical_tiles outputs for all subjects that failed QC.
Reads a QC TSV/CSV file with 'participant_id' and 'qc' columns and deletes all files belonging to subjects with qc==0 or absent from the QC file. Equivalent to having run cortical_tiles with --sk_qc_path from the start.
Use dry_run=True to preview what would be deleted without modifying anything.
Inputs: qc (required), output (required), dry_run. Returns: object
purge_subjectA
Remove all cortical_tiles derivatives for a single subject.
Deletes per-subject NIfTI files (crops, labels, extremities, distbottom), per-subject subdirectories (skeletons/, foldlabels/, transforms/, distmaps/), and filters the subject's row from aggregated .npy arrays and their subject CSVs.
Use dry_run=True to preview what would be deleted without modifying anything.
Inputs: subject (required), derivatives (required), dry_run. Returns: object
start_combineB
Launch Stage 5: collect all per-region embedding CSVs into a single output directory.
Inputs: output_path (required), embeddings_subpath (required), path_models. Returns: object
start_configC
Launch Stage 3: generate Champollion dataset YAML configuration files.
Inputs: dataset (required), crop_path (required), output, external_crops, +2 more. Returns: object
start_cortical_tilesC
Launch Stage 2: extract 28 sulcal region crops with cortical_tiles.
Inputs: input_dir (required), output_dir (required), path_to_graph (required), path_sk_with_hull (required), +4 more. Returns: object
start_embeddingsC
Launch Stage 4: compute sulcal embeddings across all 56 model folds (28 regions × 2 hemispheres).
Inputs: short_name (required), models_path (required), datasets_root (required), dataset_localization (required), +7 more. Returns: object
start_morphologistC
Launch Stage 1: generate sulcal graphs with Morphologist from raw T1 MRI data.
Inputs: input_dir (required), output_dir (required), parallel, enable_sulcal_recognition. Returns: object
start_pipelineB
Launch the full Champollion pipeline (all 6 stages sequentially). Returns a pipeline job_id immediately.
Inputs: dataset (required), crop_path (required), input_dir (required), output_dir (required), +14 more. Returns: object
start_snapshotsC
Launch Stage 6: render sulcal graph meshes, cortical tile masks, and UMAP scatter plots.
Inputs: output_dir (required), subject, umap_only, tiles_only, +7 more. Returns: object
start_streamingA
Launch scan-centric streaming pipeline: one worker per scan runs stages 2-4 in parallel.
Each worker owns one ScanId and processes cortical_tiles → config → embeddings sequentially for its scan, using file-presence barriers between stages. Stage 5 (combine) runs once after all workers drain.
Requires embeddings_only mode (training aggregates all subjects and cannot be parallelised per-scan).
Inputs: dataset (required), input_dir (required), output_dir (required), path_to_graph (required), +12 more. Returns: object
start_trainingB
Launch encoder training: train a champollion_V1 self-supervised encoder for one sulcal region.
Dataset configs must exist before calling this tool — run start_config first (or supply config_dir if configs live outside the champollion_V1 submodule).
Inputs: region (required), dataset (required), cpu, swf, +5 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Each tool targets a distinct operation: launching pipeline stages (start_*), subject management (purge_subject, prune_failed_subjects), job control (get_job_status, list_jobs, cancel_job, get_job_log), and pipeline info (get_pipeline_info, preflight_check). Minimal overlap; even similar tasks like subject removal are differentiated by scope.
Most tools follow a consistent pattern: launch verbs (start_*) for pipeline stages, get_* for retrieval, and descriptive verbs for actions. Deviations include 'purge_subject' vs. 'prune_failed_subjects' (different delete verbs) and 'preflight_check' (no prefix), but overall naming is clear and predictable.
17 tools is appropriate for a multi-stage neuroimaging pipeline with job management and utility functions. Each tool earns its place, covering all stages and supporting operations without being excessive or sparse.
The tool set covers the full pipeline lifecycle: stage launches, job monitoring, subject cleanup, and configuration checks. All essential operations are present with no obvious gaps for the stated purpose.
Related MCP Connectors
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Stateless agentic tools over MCP: concept extraction, long-context, knowledge graph, planning.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes a set of CLI tools (test generation, documentation generation, linting, test running, code search) to AI assistants via MCP, allowing them to perform these tasks through natural language.3-
- AlicenseNot gradedqualityDmaintenanceExposes RAG and document intelligence pipelines as 8 composable tools for MCP-compatible clients, enabling querying, indexing, classifying, extracting, and assessing documents.1MIT
- AlicenseAqualityDmaintenanceExposes 12 robotics/simulation tools from robosimtools.com as MCP tools, enabling AI agents to perform conversions (quaternion, URDF, MJCF), validation, and CAD imports locally.121MIT
- AlicenseNot gradedqualityBmaintenanceWraps Oh My Pi built-in tools (read, write, edit, bash, grep, etc.) as MCP tools, enabling file operations, shell commands, web search, and agent coordination.9 npmApache 2.0