Skip to content

Add CLI v2, human docs, and Skill 2.0 agent package#2

Open
webwebb56 wants to merge 17 commits into
MassDynamics:feature/mcp-serverfrom
webwebb56:feature/cli-and-skill
Open

Add CLI v2, human docs, and Skill 2.0 agent package#2
webwebb56 wants to merge 17 commits into
MassDynamics:feature/mcp-serverfrom
webwebb56:feature/cli-and-skill

Conversation

@webwebb56
Copy link
Copy Markdown

Summary

  • cli/: Click-based CLI importing from md-python SDK with v2 API routing, including batch command for multi-step operations (24x faster, 33% fewer tokens)
  • docs/: Human-readable install guide, command reference, and workflow examples
  • skill/: Skill 2.0 format for Claude Cowork/Code — pure orchestrator SKILL.md with instructions, good/bad examples, and eval checklist
  • scripts/: build-skill.py (packages .skill) and build-docs.py (auto-generates docs)

Test plan

  • Verify CLI installs and runs against v2 API endpoints
  • Verify batch command executes multi-step workflows
  • Verify build-skill.py produces valid .skill package
  • Verify build-docs.py generates docs matching source
  • Review Skill 2.0 SKILL.md routing and instructions for correctness

🤖 Generated with Claude Code

Co-authored-by: Claude noreply@anthropic.com

infusini and others added 17 commits April 16, 2026 17:11
Exposes the Mass Dynamics API as MCP tools usable from Claude desktop
(Chat and Cowork tabs). Covers experiments, datasets, and all pipeline
types (normalisation/imputation, pairwise comparison, dose response).
- Add batch tool to collapse multiple sequential tool calls into one MCP call,
  with name→UUID chaining support for get_upload
- Add files tools: read_csv_preview, load_metadata_from_csv, plan_wide_to_md_format;
  enforces entity-data boundary (never reads intensity files in full)
- Add validate_upload_inputs tool to catch sample_name mismatches before create_upload
- Improve create_upload docstring to clarify ExperimentDesign column handling
- Switch _client.py to import MDClientV2 directly (v2 only, no factory)
…g analyses

Claude was guessing parameter values (e.g. normalise method names) instead of
looking them up. describe_pipeline(job_slug) returns the full parameter schema
with valid_values for each field. All run_* docstrings now mandate calling it first.
create_upload, update_sample_metadata, run_dose_response, run_pairwise_comparison,
and generate_pairwise_comparisons now all explicitly forbid manual construction of
experiment_design/sample_metadata arrays. Docstrings mandate calling
load_metadata_from_csv first and passing its output verbatim.
Three outputs from one codebase:
- cli/: Click-based CLI importing from md-python SDK (v2 API)
  - batch command for multi-step operations (24x faster, 33% fewer tokens)
  - v2 routing (/uploads, flat payloads, v2 accept headers)
- docs/: Human-readable install guide, command reference, workflow examples
- skill/: Skill 2.0 format for Claude Cowork/Code
  - Pure orchestrator SKILL.md (no rules, just workflow routing)
  - instructions/, examples/good+bad/, eval/checklist
- scripts/: build-skill.py (packages .skill), build-docs.py (auto-generates docs)

Co-authored-by: Claude <noreply@anthropic.com>
Fix: batch dispatcher now correctly handles multi-word names with --by-name flag.
Previously 'uploads get uPhos Tissue DIA-NN PTMs --by-name' only passed 'uPhos'
to the API. Now it joins all tokens between 'get' and '--by-name' as the name.

Add: dist/md-platform.skill — the packaged Skill 2.0 artifact. Contains the
skill orchestrator, instructions, examples, eval checklist, references, and
the CLI source bundled in scripts/md-cli/. Ready for Claude Cowork/Code install.

Co-authored-by: Claude <noreply@anthropic.com>
Fix: _dispatch_batch_command in main.py now joins multi-word names correctly
when --by-name flag is present. Same fix was already in batch.py (fork CLI).
Both dispatchers now handle 'experiments get Name With Spaces --by-name'.

Also adds 'uploads' as accepted command in standalone dispatcher for v2 compat.

Rebuilt dist/md-platform.skill with the fix included.

Tested: 4/4 batch commands pass (health, auth, get-by-id, get-by-name).

Co-authored-by: Claude <noreply@anthropic.com>
…e auth UX

Three targeted friction fixes based on blind-user simulation analysis:

1. Design file elimination: --conditions inline flag, md design infer command, parse_conditions_string/resolve_design helpers
2. Table/column discovery: md tables list command, column reference docs in SKILL.md
3. Auth & output UX: 3-path auth guidance, --format ids-only, output_result helper, enterprise deployment docs

Simulation results: first-try success 80% → 95%, retries 4-8 → 2-4, blockers 3 → 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rebuild skill

Implements the two missing CLI modules:
- api.py: MDClient facade wrapping md-python SDK (V2 primary, V1 fallback)
  for all 40+ operations the CLI needs (experiments, datasets, analysis,
  tables, workspaces, viz, enrichment, entities)
- config.py: persistent credential storage (~/.md-cli/config.json) with
  env var override support

New CLI commands leveraging Aaron's PR MassDynamics#3 V2 endpoints:
- md experiments query (search/filter uploads)
- md experiments delete (V2)
- md experiments metadata (sample metadata retrieval)
- md datasets query (cross-upload dataset search)
- md datasets download-url (presigned S3 URLs)
- md entities query (cross-dataset protein/gene search)

Updated SKILL.md with V2 command documentation.
Rebuilt dist/md-platform.skill (40KB, self-contained).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds CLI command and api.py method for updating sample metadata on
an existing upload. Accepts a CSV file (sample_name, condition, ...).
Useful for correcting conditions, adding covariates, or relabelling
samples post-upload without re-uploading data.

Updated SKILL.md and rebuilt dist/md-platform.skill.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The batch dispatcher only handled basic V1 commands (get, list).
Added routing for: experiments query/metadata/delete, datasets query/
download-url, and jobs list. Also added _parse_opts() helper for
extracting --key value pairs from batch command args.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…infrastructure

SKILL.md fixes (from eval benchmark iteration-4b):
- Enrichment: add hard rule to always use `md` CLI, never HTTP notation
- Entities: constrain --keyword to gene/protein names (not qualitative terms);
  document that --intersect does not exist; add BRD4 example
- Entities: add `md datasets query --state COMPLETED` as canonical discovery command
- Entities: promote entity_mapping_search Flipper flag to prominent 403 warning
- batch-usage.md: clarify `jobs list` vs `jobs` (bare command returns nothing useful)

Pairwise dataset builder:
- Add log_intensities and use_imputed_intensities fields to PairwiseComparisonDataset
  so callers can explicitly control limma log-space and imputation behaviour

Fixture infrastructure (eval harness, not production):
- Add src/md_python/fixtures.py: HTTP record/replay activated only when
  MD_RECORD_FIXTURES or MD_REPLAY_FIXTURES env vars are set; inert otherwise
- Add src/md_python/__init__.py hook to install fixtures when env vars present
- Add tests/test_fixtures.py
- Add skill/references/md-format-upload.md reference document

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@webwebb56 webwebb56 force-pushed the feature/cli-and-skill branch from 86c3ff1 to 3a4ef50 Compare April 16, 2026 07:12
@infusini infusini force-pushed the feature/mcp-server branch 3 times, most recently from 09717e8 to e4c5bad Compare May 12, 2026 13:57
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.

3 participants