Metadata-Version: 2.4
Name: strand-mcp
Version: 0.1.0
Summary: MCP server for the Strand Platform — exposes upload / predict / job lifecycle to Claude, Cursor, and any other MCP-aware agent.
Project-URL: Homepage, https://strandai.com
Project-URL: Documentation, https://app.strandai.com/docs/api
Project-URL: Repository, https://github.com/Strand-AI/strand-official
Author-email: Strand AI <engineering@strandai.bio>
License: Apache-2.0
Keywords: anthropic,claude,h&e,mcp,pathology,spatial-omics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Requires-Dist: mcp>=1.0.0
Requires-Dist: strand-sdk>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# strand-mcp

MCP server for the Strand Platform. Exposes upload / estimate / predict / job-lifecycle as MCP tools so any agent (Claude Code, Cursor, etc.) can run H&E → spatial-proteomics inference end-to-end.

## Install

```bash
pip install strand-mcp
```

Or from this repo:

```bash
cd sdks/mcp-server
pip install -e .
```

## Auth

Generate an API key at <https://app.strandai.com/settings/api-keys> and export it:

```bash
export STRAND_API_KEY=sk-strand-...
```

The server also reads `STRAND_BASE_URL` (defaults to `https://app.strandai.com`) if you need to point at staging.

## Wire into Claude Code

Add to `~/.claude/mcp.json` (or your project's `.mcp.json`):

```json
{
  "mcpServers": {
    "strand": {
      "command": "strand-mcp",
      "env": {
        "STRAND_API_KEY": "sk-strand-..."
      }
    }
  }
}
```

Then in Claude Code you can ask things like:

> Upload `~/slides/biopsy.svs` to Strand, run prediction for CD3, CD8, and Ki67, wait for the job, and download results into `~/results/`.

Claude calls the tools in sequence — no glue code needed.

## Tools

| Tool               | Purpose                                                                     |
| ------------------ | --------------------------------------------------------------------------- |
| `upload_slide`     | Upload a local WSI; returns `upload_id` + dimensions                        |
| `estimate_run`     | Patch count + credit cost for a `(upload_id, markers)` pair                 |
| `set_sample_mpp`   | Set user-reported slide microns per pixel before inference                  |
| `submit_run`       | Kick off a Lattice inference job; returns `job_id`                            |
| `get_job`          | Point-in-time status snapshot                                               |
| `cancel_job`       | Cancel an in-flight job and refund its reserved credits                     |
| `wait_for_job`     | Block until terminal state (uses SSE under the hood)                        |
| `download_results` | Pull OME-Zarr results into a local directory                                |
| `download_ome_tiff` | Render and download a completed job as a single OME-TIFF file              |

## Smoke test

```bash
STRAND_API_KEY=sk-strand-... strand-mcp
```

The server listens on stdio and waits for an MCP client to attach.

## Dev

```bash
cd sdks/mcp-server
pip install -e ".[dev]" || pip install -e .
python -m strand_mcp
```
