latentlab
The official Python package for LatentLab.
One distribution on PyPI, multiple submodules — the same shape as
anthropic, openai, etc.
| Submodule | Status | What it is |
|---|---|---|
latentlab.mcp |
shipped | MCP server that wraps the LatentLab API as Model Context Protocol tools, so MCP-aware agents (Claude Desktop, Claude Code, Cline, Anthropic Agent SDK, …) can drive a deployment with typed tools. Implements the agent-facing surface of ADR-055. |
latentlab (top level) |
reserved | A sync REST client (from latentlab import Client) is planned. Until it lands, the top level only exposes __version__. |
Install
pip install latentlab
# Or from source while developing:
pip install -e ./python
MCP — configure
Point the server at a LatentLab deployment. In your MCP host's config (example for Claude Desktop / Claude Code):
{
"mcpServers": {
"latentlab": {
"command": "python",
"args": ["-m", "latentlab.mcp"],
"env": {
"LATENTLAB_API_URL": "https://latentlabdev.media.mit.edu/api"
}
}
}
}
Restart the host. A new tool group latentlab_* becomes available.
MCP — auth (one-time per user)
The first call to any tool that needs auth runs the device-code flow:
- Server hits
POST /v1/auth/device/start, prints theverification_urlanduser_codefor the user to open. - User signs in to the deployment, lands on
/device, types the code, clicks "Approve." - Server polls
POST /v1/auth/device/polland persists the returned API key under~/.latentlab/credentials.json.
After that, every tool reuses the saved key. Run
latentlab_logout to forget it.
MCP — tools
| Tool | Args | What it does |
|---|---|---|
latentlab_login |
{} |
Run device-code flow if no key cached. |
latentlab_logout |
{} |
Delete the cached key. |
latentlab_whoami |
{} |
Return the LatentLab user this key belongs to. |
latentlab_list_datasets |
{} |
List the user's datasets. |
latentlab_get_dataset |
{ id } |
Get one dataset by id (includes status). |
latentlab_upload_csv |
{ path, name, description? } |
Upload a CSV from a local file. |
latentlab_create_live_url_dataset |
{ source_url, source_ref, name, ... } |
Create a git-source live folder dataset. |
latentlab_search |
{ dataset_id, query, k? } |
Semantic search inside a dataset. |
latentlab_wait_for_processing |
{ dataset_id, timeout_seconds? } |
Poll until status=='complete'. |
latentlab_dataset_url |
{ dataset_id } |
Return the human-facing /app/dataset URL. |
Source layout
python/
pyproject.toml
README.md (this file)
CONTRIBUTING.md Three-test checklist for new endpoints
src/latentlab/
__init__.py Exposes __version__; SDK lands here
mcp/
__init__.py
__main__.py `python -m latentlab.mcp` entry
server.py Tool registry + dispatch, MCP stdio bootstrap
client.py Thin REST client (httpx)
storage.py Local credentials persistence
settings_schema.py Per-call pipeline-settings overrides (ADR-056)
Versioning
Pinned to the LatentLab API version. Server-side OpenAPI changes that
break tool signatures are rolled out with a matching minor bump here.
See CONTRIBUTING.md for the rolling-patch convention.
The top-level latentlab.__version__ is read from package metadata
so it always matches what's on PyPI.
Releasing to PyPI
Publishing is automated by .github/workflows/publish-latentlab.yml.
It is wired to PyPI Trusted Publishing (OIDC) — no API token is
stored as a repo secret. To cut a release:
-
Bump
versioninpyproject.toml(the installed__version__is read from package metadata, so there's only one place to edit). -
Commit on
dev. -
Tag and push:
git tag v0.2.1 git push origin v0.2.1
The workflow verifies that the tag matches the pyproject version,
builds an sdist + wheel, and uploads them. The trusted-publisher
binding on PyPI must already be configured for this repo and the
publish-latentlab.yml workflow under environment pypi — see
docs/releasing-latentlab.md for the one-time setup.
Metadata
Release files for latentlab 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| latentlab-0.2.0.tar.gz | 21.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| latentlab-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.2 kB
Release files / latentlab-0.2.0.tar.gz
| Download URL | latentlab-0.2.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1e42c3dffcba8bd3e1bebfa5a341afbe75e87066ef3dc8d013fa54ec2d1a5bd
|
|
BLAKE2b-256 checksum How to use checksums |
6961b1bdcbe80f5970fa219adc239d77d1ce9133058c7bd0ad52eab12e8571e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / latentlab-0.2.0-py3-none-any.whl
| Download URL | latentlab-0.2.0-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0871d2ed9fb7d55accdcc604e21e04a80297962e8eb8076a24325020487b5370
|
|
BLAKE2b-256 checksum How to use checksums |
4416027d2effa2e1b520bd1662dcda3e9508fda76ab22f00a2b9e0314e32aa0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for latentlab 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.