Skip to main content
Glama
README.md
# viva-mcp

[![ci](https://github.com/vivarium-collective/viva-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/vivarium-collective/viva-mcp/actions/workflows/ci.yml)

An **MCP server that fronts [compose-api](https://github.com/biosimulations/compose-api)** — the hosted cosimulation service for reproducible biological workflows. It exposes compose-api's run / status / fetch / catalog surface as MCP tools, so **any MCP client — a chat session, Claude Science, or Claude Code — can run process-bigraph composites without a local Workbench server.**

This is **Phase 1 (P1)** of [RFC-0009](https://github.com/vivarium-collective/viva-superpowers/blob/main/docs/rfcs/RFC-0009-hosted-mcp-connector.md): a thin, stateless [FastMCP](https://github.com/jlowin/fastmcp) wrapper over the typed `compose-api-client`. compose-api runs the same `process-bigraph` / `bigraph-schema` runtime as the viva ecosystem, so it executes viva composites natively.

## Tools

| Tool | What it does | compose-api |
|---|---|---|
| `whoami` | Who the server is authed as (or anonymous) + service health | `whoami`, `health` |
| `list_simulators` | The simulators the service can run | `simulators` |
| `list_processes` | Registered process-bigraph processes | `processes` |
| `run_simulation` | Submit a composite/SED-ML document (detached by default; `wait=True` to block) | `submit` / `run_and_wait` |
| `simulation_status` | Poll a run's status | `status` |
| `fetch_results` | Download a finished run's results to a local file | `download` |
| `list_simulations` | Recent runs (filter by status / only yours) | `simulations` |
| `cancel_simulation` | Cancel a running simulation | `cancel_simulation` |

Typical flow: `list_simulators` → `run_simulation(document_path=…)` → `simulation_status(id)` until terminal → `fetch_results(id)`.

### Observability, datasets, and registry

| Tool | What it does | compose-api |
|---|---|---|
| `simulation_detail` | One run's detail — latest job, event/dataset counts | `simulation` |
| `simulation_events` | A page of a run's events (filter by level/name; paged) | `events` |
| `simulation_trace` | A run's execution trace as a tree of spans | `trace` |
| `list_datasets` | Data files a run (or the caller) advertised | `datasets` |
| `fetch_dataset` | Download one dataset file locally | `download_dataset` |
| `catalog` | The registry — entries, curation level, providing environments | `catalog` |
| `list_environments` | The environments documents run in | `environments` |
| `list_steps` | Registered process-bigraph Steps (the `/core` steps) | `steps` |

Read `catalog` / `list_environments` before authoring a document to see which process/step classes are available and in which environment.

## Install & run

```bash
uv pip install -e .            # or: pip install -e .
viva-mcp                       # serves over stdio (the default MCP transport)
```

Register it with an MCP client (Claude Code example):

```bash
claude mcp add viva-mcp -- viva-mcp
```

## Configuration (environment)

| Variable | Default | Meaning |
|---|---|---|
| `COMPOSE_API_URL` | `https://compose.cam.uchc.edu` | compose-api base URL (point at a local instance for dev) |
| `COMPOSE_API_TOKEN` | *(unset)* | Bearer token. Omit to run **anonymously** — anonymous runs are public. |

Without a token the server runs anonymously (public runs). To run as yourself, obtain a token via the compose-api CLI (`compose-api auth login`, then an automation token) and set `COMPOSE_API_TOKEN`. See the [compose-api CLI docs](https://github.com/biosimulations/compose-api/blob/main/docs/cli.md).

## Develop

```bash
uv venv .venv && . .venv/bin/activate
uv pip install -e ".[dev]"
pytest -q                      # unit tests run offline (compose-api is mocked)
```

## Status & roadmap

P1 (this repo) covers the run/status/fetch/catalog surface over stdio, and the full
**run → status → fetch** chain is validated live (anonymously) against
`compose.cam.uchc.edu`. Later phases (per RFC-0009): complete the surface
(trace/events/datasets/registry), a hosted streamable-HTTP transport with token
passthrough, and declaring the connector in the `viva` plugin so chat/Claude Science
clients pick it up automatically.

> **Submitting documents.** `run_simulation` takes a `.pbg` (process-bigraph
> composite) or `.omex`. A `.pbg` that references an external model file needs an
> `.omex` bundle instead. The environment is inferred from the document's process
> classes; this deployment currently offers `viva-biogears` and `viva-pde-particle`.

## License

Apache-2.0.

TDQS

B3.4/5.0

Scored across 16 tools

Disambiguation4/5

Most tools target clearly distinct objects or lifecycle stages (run, poll, fetch, cancel, inspect events/trace). The one soft spot is the cluster of discovery tools — catalog, list_simulators, list_processes, list_steps, list_environments — whose boundaries overlap, though descriptions mostly differentiate them (catalog is authoritative, simulators are runnable targets, processes/steps are class catalogs).

Naming Consistency3/5

Action tools follow a clean verb_noun pattern (run_simulation, fetch_results, cancel_simulation, list_datasets), but the read/inspection tools use bare nouns (catalog, simulation_status, simulation_detail, simulation_trace, whoami). The two conventions are readable but mixed within the same set.

Tool Count4/5

16 tools is slightly on the heavy side but each maps to a real part of the simulation lifecycle: discovery, submission, polling, observability, and artifact retrieval. None feel clearly redundant, though consolidation of the discovery tools could trim the set.

Completeness4/5

The surface covers discovery, submission, status/detail, cancellation, listing, event/trace inspection, and dataset fetching — a full lifecycle. Minor gaps remain, such as validating or editing a document before submission and deleting/cleaning up simulations or datasets.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues