champollion-sulcal-mcp
OfficialLets the pipeline download pretrained models from Hugging Face: an HF_TOKEN is selectively forwarded into the embeddings stage's subprocess environment (and stripped from every other stage) so start_embeddings can authenticate against the Hugging Face hub.
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-mcpRun the full Champollion pipeline for subject sub-01"
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.
Any MCP client can drive it. The repository also ships its own Claude Code subagent definition and skills, so it can be driven directly from Claude Code.
Related MCP server: dat-ai-mcp
How it works
A caller (an MCP client) invokes a tool such as
start_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) |
— |
| 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 capture, 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 pipeline runs and their parameters
├── monitor/ # SKILL.md for the job-polling loop
└── debug/ # SKILL.md + known error patterns for failure diagnosis
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
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
A checkout of the
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) and theexternal/champollion_V1andexternal/cortical_tilessubmodules.
Installation
pixi installConfiguration
Variable | Purpose | Default |
| Absolute path to the | Required |
| 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 or coding agent (see Coding agents integration for ready-to-paste configurations), not run interactively on its own:
pixi run run # python -m champollion_sulcal_mcp.server
# or, once installed:
champollion-sulcal-mcpCoding agents integration
Any coding agent or MCP client that can launch a local stdio server can use this server. Every configuration
below starts it with pixi run --manifest-path /path/to/champollion_sulcal_mcp/pixi.toml run, so it works from
any working directory. Replace the /path/to/... placeholders with absolute paths.
CHAMPOLLION_PIPELINE_DIRis required: the absolute path of yourchampollion_pipelinecheckout.HF_TOKENis optional: set it only to download models from Hugging Face. Prefer an environment reference over writing the token in a configuration file, and never commit a token.The first start can take a few seconds while pixi resolves the environment, so the snippets raise the client's start-up timeout.
Claude Code
Register it with the CLI (user scope shown; --scope project writes a shared .mcp.json instead):
claude mcp add --transport stdio --scope user \
--env CHAMPOLLION_PIPELINE_DIR=/path/to/champollion_pipeline \
champollion-sulcal \
-- pixi run --manifest-path /path/to/champollion_sulcal_mcp/pixi.toml runor add it to .mcp.json at the root of your project:
{
"mcpServers": {
"champollion-sulcal": {
"command": "pixi",
"args": ["run", "--manifest-path", "/path/to/champollion_sulcal_mcp/pixi.toml", "run"],
"env": {
"CHAMPOLLION_PIPELINE_DIR": "/path/to/champollion_pipeline",
"HF_TOKEN": "${HF_TOKEN:-}"
}
}
}
}This repository also ships Claude Code assets:
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 between the full pipeline and individual stages, 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.
They are Markdown files: other coding agents can read them as plain instructions, for example by pointing their own agent or rules file at them.
OpenCode
In opencode.json (project) or ~/.config/opencode/opencode.json (global):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"champollion-sulcal": {
"type": "local",
"command": ["pixi", "run", "--manifest-path", "/path/to/champollion_sulcal_mcp/pixi.toml", "run"],
"enabled": true,
"timeout": 30000,
"environment": {
"CHAMPOLLION_PIPELINE_DIR": "/path/to/champollion_pipeline",
"HF_TOKEN": "{env:HF_TOKEN}"
}
}
}
}Mistral Vibe
In ./.vibe/config.toml (project) or ~/.vibe/config.toml (global). Vibe does not expand environment
variables in this file; add "HF_TOKEN" = "<your token>" to env only in a private, uncommitted config.
[[mcp_servers]]
name = "champollion-sulcal"
transport = "stdio"
command = "pixi"
args = ["run", "--manifest-path", "/path/to/champollion_sulcal_mcp/pixi.toml", "run"]
startup_timeout_sec = 60
env = { "CHAMPOLLION_PIPELINE_DIR" = "/path/to/champollion_pipeline" }Codex
In ~/.codex/config.toml (global) or .codex/config.toml (trusted project); env_vars forwards HF_TOKEN
from your shell without storing it in the file:
[mcp_servers.champollion-sulcal]
command = "pixi"
args = ["run", "--manifest-path", "/path/to/champollion_sulcal_mcp/pixi.toml", "run"]
startup_timeout_sec = 60
env_vars = ["HF_TOKEN"]
[mcp_servers.champollion-sulcal.env]
CHAMPOLLION_PIPELINE_DIR = "/path/to/champollion_pipeline"or from the command line:
codex mcp add champollion-sulcal \
--env CHAMPOLLION_PIPELINE_DIR=/path/to/champollion_pipeline \
-- pixi run --manifest-path /path/to/champollion_sulcal_mcp/pixi.toml runOther MCP clients
Most other clients (Claude Desktop, Cursor, and others) read the common mcpServers format, for example
Claude Desktop's claude_desktop_config.json or Cursor's .cursor/mcp.json:
{
"mcpServers": {
"champollion-sulcal": {
"command": "pixi",
"args": ["run", "--manifest-path", "/path/to/champollion_sulcal_mcp/pixi.toml", "run"],
"env": {
"CHAMPOLLION_PIPELINE_DIR": "/path/to/champollion_pipeline"
}
}
}
}If your client has no env setting, export CHAMPOLLION_PIPELINE_DIR (and optionally HF_TOKEN) in the
environment the client is started from.
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 formatContributing
See CONTRIBUTING.md for the development setup, checks, branch model and how to report issues.
License
Released under the CeCILL-B free software licence, the same as champollion_pipeline. See LICENSE.
Available Tools
16 toolscancel_jobCancel JobB
Cancel a running job by sending SIGTERM to its process.
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | ||
| output_dir | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
get_job_logGet Job LogC
Retrieve the last N lines of a job's log output.
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | ||
| output_dir | Yes | ||
| tail_lines | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
get_job_statusGet Job StatusC
Get the current status and progress of a running or completed job.
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | ||
| output_dir | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
get_pipeline_infoGet Pipeline InfoB
Get metadata about the Champollion pipeline and available MCP tools.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
list_jobsList JobsC
List all jobs for a given output directory, optionally filtered by status.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| status | No | ||
| output_dir | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
preflight_checkPreflight CheckB
Check whether the Champollion pipeline is correctly configured and accessible.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
prune_failed_subjectsPrune 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.
| Name | Required | Description | Default |
|---|---|---|---|
| qc | Yes | ||
| output | Yes | ||
| dry_run | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
purge_subjectPurge 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.
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| subject | Yes | ||
| derivatives | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_combineStart CombineC
Launch Stage 5: collect all per-region embedding CSVs into a single output directory.
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | Yes | ||
| embeddings_source | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_configStart ConfigB
Launch Stage 3: generate Champollion dataset YAML configuration files.
The configs root defaults to //derivatives/champollion_V1/configs,
where is the parent of the directory in crop_path; region YAMLs
land at {configs root}/dataset//. output overrides the configs root;
external_config overrides where the dataset_localization YAML is written
(default {configs root}/dataset_localization/). Each is forwarded only when
supplied, so the pipeline defaults apply otherwise. When supplied, output and
external_config must be absolute paths and, when the MCP client declares
roots, inside a declared root. masks is the mask version tag forwarded as
--masks; it must match the stage-2 masks (script default canonical_25).
| Name | Required | Description | Default |
|---|---|---|---|
| masks | No | ||
| output | No | ||
| dataset | Yes | ||
| crop_path | Yes | ||
| external_crops | No | ||
| champollion_loc | No | ||
| external_config | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_cortical_tilesStart Cortical TilesC
Launch Stage 2: extract 28 sulcal region crops with cortical_tiles.
| Name | Required | Description | Default |
|---|---|---|---|
| masks | No | ||
| njobs | No | ||
| regions | No | ||
| input_dir | Yes | ||
| overwrite | No | ||
| output_dir | Yes | ||
| sk_qc_path | No | ||
| path_to_graph | Yes | ||
| labelling_session | No | ||
| path_sk_with_hull | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_embeddingsStart EmbeddingsC
Launch Stage 4: compute sulcal embeddings across all 56 model folds (28 regions × 2 hemispheres).
profiling: run the embeddings script under cProfile. no_cache: re-extract a models archive, ignoring the cache. legacy: read crops from derivatives/deep_folding-2025 (overrides cortical_version). use_last_checkpoint: evaluate with the native Lightning checkpoint in version_0/checkpoints/ instead of best_model_weights.pt, for regions that have one.
| Name | Required | Description | Default |
|---|---|---|---|
| cpu | No | ||
| masks | No | ||
| legacy | No | ||
| output | No | ||
| regions | No | ||
| run_cka | No | ||
| no_cache | No | ||
| subjects | No | ||
| overwrite | No | ||
| profiling | No | ||
| models_path | Yes | ||
| datasets_root | Yes | ||
| masks_version | No | ||
| cortical_version | No | ||
| use_last_checkpoint | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_morphologistStart MorphologistC
Launch Stage 1: generate sulcal graphs with Morphologist from raw T1 MRI data.
| Name | Required | Description | Default |
|---|---|---|---|
| parallel | No | ||
| input_dir | Yes | ||
| output_dir | Yes | ||
| enable_sulcal_recognition | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_pipelineStart PipelineB
Launch the full Champollion pipeline (all 6 stages sequentially). Returns a pipeline job_id immediately.
reference_data_dir is optional and forwarded to stage 6 (snapshots) for UMAP plots.
A non-empty masks is forwarded to stages 2, 3 and 4, and names the
<datasets_root>/derivatives/champollion_V1/<masks or canonical_25>/ directory that
stages 5 and 6 read and write (region_embeddings, embeddings, snapshots).
overwrite, run_cka, regions, masks_version and cortical_version
apply to stage 4 (embeddings) only. regions are model names (e.g. SCsylv_left);
cortical_version must name where the stage-2 crops actually are.
| Name | Required | Description | Default |
|---|---|---|---|
| cpu | No | ||
| masks | No | ||
| njobs | No | ||
| dataset | Yes | ||
| regions | No | ||
| run_cka | No | ||
| parallel | No | ||
| crop_path | Yes | ||
| input_dir | Yes | ||
| overwrite | No | ||
| output_dir | Yes | ||
| sk_qc_path | No | ||
| models_path | Yes | ||
| skip_stages | No | ||
| datasets_root | Yes | ||
| masks_version | No | ||
| path_to_graph | Yes | ||
| cortical_version | No | ||
| labelling_session | No | ||
| path_sk_with_hull | Yes | ||
| reference_data_dir | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_snapshotsStart SnapshotsC
Launch Stage 6: render sulcal graph meshes, cortical tile masks, and UMAP scatter plots.
UMAP plots need both embeddings_dir and reference_data_dir; there is no default for
reference_data_dir (not shipped with champollion_pipeline).
| Name | Required | Description | Default |
|---|---|---|---|
| subject | No | ||
| umap_only | No | ||
| output_dir | Yes | ||
| tiles_only | No | ||
| acquisition | No | ||
| sulcal_only | No | ||
| umap_region | No | ||
| embeddings_dir | No | ||
| morphologist_dir | No | ||
| cortical_tiles_dir | No | ||
| reference_data_dir | No | ||
| champollion_data_root | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
start_trainingStart 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.
When the MCP client declares roots, config_dir defaults to
<roots[0]>/data//derivatives/champollion_V1/configs (roots[0] = the
first declared root; same base as the output_dir default). Otherwise
config_dir defaults to /data//derivatives/champollion_V1/configs
( = the champollion_pipeline root). Pass config_dir when the configs
live elsewhere (use //derivatives/champollion_V1/configs) or when
start_config was given an explicit output (use that configs root).
| Name | Required | Description | Default |
|---|---|---|---|
| cpu | No | ||
| swf | No | ||
| mode | No | encoder | |
| njobs | No | ||
| region | Yes | ||
| dataset | Yes | ||
| overwrite | No | ||
| config_dir | No | ||
| output_dir | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
16 tool updates
v0.1.0- First observed
cancel_job - First observed
get_job_log - First observed
get_job_status - First observed
get_pipeline_info - First observed
list_jobs - First observed
preflight_check - First observed
prune_failed_subjects - First observed
purge_subject - First observed
start_combine - First observed
start_config - First observed
start_cortical_tiles - First observed
start_embeddings - First observed
start_morphologist - First observed
start_pipeline - First observed
start_snapshots - First observed
start_training
TDQS
Scored across 16 tools
Most tools have clearly distinct roles: stage launches are separated by stage number and resource, and job controls are status/list/cancel/log. Minor overlap exists between start_pipeline and the individual stage launchers, and between purge_subject and prune_failed_subjects, but descriptions make the distinctions clear.
Tool names are mostly consistent snake_case action-object patterns, especially the start_* stage launchers and job management verbs. preflight_check is a minor deviation from the verb_noun pattern but remains readable.
At 16 tools it is slightly heavy, but the count is justified by six pipeline stages, a full-pipeline launcher, configuration/training helpers, job management, cleanup, and informational tools. Each tool has a plausible role in the orchestration workflow.
The surface covers the main pipeline lifecycle well: preflight, all six stages, full pipeline execution, job status/list/cancel/log, cleanup, and pipeline info. Minor gaps remain, such as resume/retry operations and cleanup coverage outside cortical_tiles outputs.
Maintenance
Related MCP Connectors
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
Every Chipp tool in one MCP (large). For one area at a time, use the ai.chipp/chipp-* servers.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides agentic MCP tools for the Flux Framework, enabling job submission, management, and resource scheduling for HPC workloads.41 PyPI1MIT
- AlicenseAqualityDmaintenanceProvides browser automation, audio transcription, and LLM chat as MCP tools for any agent.7MIT
- FlicenseNot gradedqualityDmaintenanceExposes task management (add, list, complete tasks) and document search (RAG) as MCP tools for AI agents.-
- FlicenseAqualityBmaintenanceExposes each stage of the Champollion sulcal embedding pipeline as MCP tools, enabling agents to run, monitor, and debug the pipeline without manual shell commands.17-