LatentLab Python package: MCP server (latentlab.mcp) + reserved namespace for a forthcoming REST SDK
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file latentlab-0.2.0.tar.gz.
File metadata
- Download URL: latentlab-0.2.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1e42c3dffcba8bd3e1bebfa5a341afbe75e87066ef3dc8d013fa54ec2d1a5bd
|
|
| MD5 |
3ef47a2c5609c3ddb7d8b08c04fdd6b9
|
|
| BLAKE2b-256 |
6961b1bdcbe80f5970fa219adc239d77d1ce9133058c7bd0ad52eab12e8571e8
|
File details
Details for the file latentlab-0.2.0-py3-none-any.whl.
File metadata
- Download URL: latentlab-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0871d2ed9fb7d55accdcc604e21e04a80297962e8eb8076a24325020487b5370
|
|
| MD5 |
96524a1a2ed9bd034a830c4587e2e04e
|
|
| BLAKE2b-256 |
4416027d2effa2e1b520bd1662dcda3e9508fda76ab22f00a2b9e0314e32aa0e
|