Metadata-Version: 2.5
Name: strand-mcp
Version: 0.6.0
Summary: MCP server for Lattice spatial proteomics from H&E — predicted virtual mIF channels from upload through download.
Project-URL: Homepage, https://strandai.com
Project-URL: Documentation, https://docs.strandai.com/sdks/mcp
Author-email: Strand AI <engineering@strandai.bio>
License: Apache-2.0
License-File: LICENSE
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.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.12
Requires-Dist: google-auth[requests]<3,>=2.40
Requires-Dist: httpx<1,>=0.27
Requires-Dist: mcp==2.2.0
Requires-Dist: openai-mcp-extensions==0.1.0
Requires-Dist: strand-sdk<1,>=0.18.0
Requires-Dist: uvicorn<1,>=0.35
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# Strand AI MCP server (`strand-mcp` distribution)

The server identity is `strand-ai`; the public title is **Strand AI** and the
product is **Lattice**. The Python distribution/import is `strand-mcp`/`strand_mcp`.
Available tools depend on the hosted server version and client capabilities.

Hosted MCP server for [Lattice spatial proteomics from H&E](https://strandai.com/lattice).
Lattice predicts spatially resolved protein-marker maps from routine H&E,
delivered as virtual mIF channels. MCP clients with direct file-transfer
network access can browse, upload, estimate or submit, monitor, and download
over a bearer-authenticated Streamable HTTP connection.

📚 **Full documentation: <https://docs.strandai.com/sdks/mcp>**

## Connect

In Claude, add **Strand AI** from the public Connectors Directory. Other MCP
clients can add `https://mcp.strandai.com/mcp` as a custom remote connector over
Streamable HTTP. Interactive Claude clients authorize with OAuth; clients that
manage their own credentials may supply an existing Strand AI API key as a bearer
token. Step-by-step: <https://docs.strandai.com/mcp/claude>.

The source server exposes fifteen core tools to every client. MCP `2026-07-28`
clients with MCP Apps (claude.ai, Claude Desktop, ChatGPT) get a 17-tool catalog:
the fifteen core tools, model-visible `strand_ai.view_sample`, and app-only
`strand_ai.viewer_session`. Open the read-only viewer by calling `list_samples`,
then passing that connection's organization-scoped ID to
`strand_ai.view_sample(sample_id)`; there is no in-viewer picker. The same public
slide can have a different ID in another organization. See the
[MCP documentation](https://docs.strandai.com/sdks/mcp). Claude Code uses the fifteen
core tools without an in-chat viewer. Artifact tools require a compatible hosted server.

There is nothing to install. Upload and download bytes
bypass the conversational model context and MCP transport: `upload_sample`
immediately creates the owned sample and returns a presigned, resumable transfer
the client PUTs bytes to directly. Lattice still processes the stored slide to
generate predictions. The returned `upload_id` is the sample id used by
`get_sample` and `submit_job`; finalizing the transfer starts ingest. Download
tools return short-lived signed links.

Agents can browse owned and public samples through one catalog, inspect capped
sample job history, read one exact job with `get_job`, update sample fields,
and estimate a job with `submit_job(dry_run=true)` before reserving credits.
`get_job` is one-shot: it does not poll, schedule another check, or wake the
conversation after a nonterminal response.

Research use only (RUO). Not for use in clinical or diagnostic procedures.

For programmatic or bulk workflows, use the
[Python SDK](https://docs.strandai.com/sdks/python) or
[REST API](https://docs.strandai.com/api/overview) instead.

## Sample field definitions

`list_sample_fields` returns the organization field catalog, including nullable
descriptions. `list_samples` also includes descriptions in `field_definitions`.
`create_sample_field` accepts `label`, `valueType`, and optional `key`, `options`,
and `description`, using `POST /api/v1/sample-fields` through
`client.samples.create_field(...)`. Creation is credit-free and requires
`samples:write`; it does not assign values to samples.

Keys derive from labels when omitted. Descriptions are trimmed, blank becomes
null, NUL is rejected, and the limit is 1,000 characters. Select types require
options; other types cannot supply options. Duplicate keys/labels and the
100-custom-field organization cap return conflict errors.

## Platform artifacts

- `create_artifact(title, description, html, sample_ids?, job_ids?, assets?)`
  publishes an immutable org-private HTML report through `client.artifacts.create`.
  Description is required, nonblank provenance: sources, methods and limitations.
  Assets use safe relative paths and canonical base64; decoded HTML plus assets
  are limited to 32 MiB. Organization and author derive from the bearer credential.
- `list_artifacts(sample_id?, job_id?, limit=50, offset=0)` returns
  `{count, artifacts}`, where count is this page's length. Limit is 1–100;
  offset is 0–100000.
- `get_artifact(artifact_id)` returns metadata, description and an org-gated
  relative in-app `url`, not HTML, asset bytes or a public sharing link.

All three are credit-free. Reads require `samples:read` and `results:read`;
creation requires `samples:write` and `results:read`. These tools require a
compatible hosted server and Python SDK.

Permanent deletion uses dashboard confirmation, `DELETE /artifacts/{id}`, or
`client.artifacts.delete(artifact_id)` with `samples:write`. It retains linked
samples/jobs and attempts best-effort bundle cleanup after revoking report access.
The curated MCP catalog deliberately omits a permanent-delete tool.

## Analytics and privacy

The hosted server emits one canonical PostHog `$mcp_tool_call` event per tool
invocation. Its closed schema contains only native MCP fields for tool name,
static inferred intent, bounded latency, error status/category, and coarse client,
plus deterministic hashed organization/user/auth-client pseudonyms and a schema
version. PostHog person/group profiles and GeoIP enrichment are disabled for
these events. Conversation/session identifiers are not collected.

The server never sends tool arguments or results, prompts, filenames, sample or
job IDs, marker names, slide data, bearer credentials, signed URLs, raw
User-Agent values, exception names, or exception messages. Adding an analytics
property requires a code and privacy review; unrestricted argument capture is
forbidden.

MCP events use Strand AI's shared PostHog project. That project is currently
configured for **84 months of event retention**; its API reports
`events_retention_enforced=false`, and there is no shorter MCP-specific TTL.
This long shared retention is why the payload is minimized and identifiers are
one-way pseudonymized before ingestion. The project owner must reverify and
document any retention-setting change. Analytics are used only for product
reliability and aggregate connector usage; access is limited to Strand AI staff
with PostHog project access.

PostHog project tokens are public ingestion identifiers, so these events are
not a security audit log and can be forged by someone who obtains the browser
project token. Security, billing, and authorization decisions must use Strand AI's
server-side records instead. Analytics delivery is best-effort and adds at most
1.25 seconds to a tool response.

## MCP protocol and request state

The local release candidate supports both MCP `2025-11-25` and `2026-07-28` on the
single `/mcp` route. The anonymous boundary exposes only catalog discovery;
tool calls always require a bearer credential. Legacy and generic clients receive the
exact ordered 15-tool catalog and no resource surface. A `2026-07-28` client that
advertises `io.modelcontextprotocol/ui` with the MCP App HTML MIME type additionally
receives the read-only Lattice viewer: the model-visible `strand_ai.view_sample`
(requiring `sample_id`), the app-only `strand_ai.viewer_session`, and one
content-versioned HTML resource. Compliant hosts keep `viewer_session` out of
model visibility. The viewer connects only to its configured API origin and reads
authorized result files directly; result pixels are not returned to the model.

Paid `submit_job` calls under `2026-07-28` first return an estimate and confirmation
form. Only explicit acceptance submits the confirmed job. Decline, cancel, expiry,
or a changed estimate submits nothing. Confirmation expires after 600 seconds.
Legacy `2025-11-25` paid submission and modern `dry_run=true` retain their prior behavior.

## Support

Email [support@strandai.com](mailto:support@strandai.com).

## License

Apache 2.0
