Metadata-Version: 2.5
Name: mist-mcp
Version: 0.1.0a1
Summary: The Mist MCP server: tools for an AI agent's shared workspaces and lakes, for any MCP client.
Project-URL: Homepage, https://github.com/neonexia/mist-plugins
Author: Neonexia
License-Expression: LicenseRef-Mist-Evaluation
License-File: LICENSE
Keywords: agents,ai-agents,lakes,mcp,mist,model-context-protocol,workspaces
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
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: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: mcp<3,>=2.3.0
Requires-Dist: mist-sdk==0.1.0a1
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# mist-mcp: the Mist MCP server

Mist gives a model tools for workspaces (named sets of files, shared by agents, kept across tasks, sessions and
machines) and lakes (named sets of tables), and for sharing both. Any MCP client reaches them through the server
`mist-mcp`, which the client starts on your machine. The tools make a lake, find it and share it; the agent's own
engine (DuckDB, PyIceberg or Polars) loads and queries its tables, where the agent runs code. Each tool is one call of
the Mist Python SDK (`mist-sdk`, installed with it).

## Install

```bash
pip install mist-mcp     # Python 3.10 or later: the command `mist-mcp`, with the SDK and the command `mist`
```

`mist-mcp --version` is the version installed.

## Sign in

Sign in once, naming the address of your company's Mist; the server uses that address and that sign-in:

```bash
mist login https://mist.example
```

`mist login <another url>` switches every later tool call to that Mist, with no restart.

## Add it to your MCP client

### Claude Code

```bash
claude mcp add mist -- mist-mcp
```

or in `.mcp.json`:

```json
{"mcpServers": {"mist": {"command": "mist-mcp"}}}
```

### Any other MCP client

Start the command `mist-mcp` with the transport `stdio` (the stdio server's `command`).

## A first call

```python
namespace_list(org="acme")
workspace_create(namespace="arn:mist:mist::acme:namespace/research", name="market-research")
```

## In an agent runtime

Install the package in the runtime, start the server as `mist-mcp --url https://mist.example`, and give it its
platform's token file in `MIST_IDENTITY_TOKEN_FILE` (re-read when it changes). Set `MIST_NAMESPACE` to the full name
of the namespace the agent works in, and its tool calls need no `org` or `namespace`:

```bash
export MIST_IDENTITY_TOKEN_FILE=/var/run/secrets/mist/token
export MIST_NAMESPACE=arn:mist:mist::acme:namespace/research
mist-mcp --url https://mist.example
```

Add `MIST_CA_BUNDLE` only when your Mist install's certificate is not in the machine's trust store.

The server starts with nothing set and lists its tools. A call before anyone has signed in, or after the sign-in
expired, is told as a tool result that says what to do.

## The tools

Every tool names the org and the namespace it works in: its first arguments are `org` and `namespace`
(`namespace_list` and `role_list` take `org` only; `policy_get` and `policy_put` take them from the `arn`). One server
reaches every org and namespace you may use. Start with `namespace_list(org="acme")`: it lists the namespaces you can
use, each with its full name (`arn`, such as `arn:mist:mist::acme:namespace/research`), and the address of the Mist
that answered (`url`). Pass that full name as `namespace` and leave `org` out; an `org` that is not the full name's
is refused. Every workspace, lake and role a tool lists or makes carries its `arn` too, the name `policy_get` takes.

When the server is started with `MIST_NAMESPACE` (a namespace's full name), `namespace` and `org` may be left out of
every call: the call works in that namespace. A `namespace` you pass is used instead, and an `org` passed alone must be
that namespace's org.

| Tool | What it does |
|---|---|
| `namespace_list(org)` | The namespaces of the org you can use, each with its `arn`, and the Mist's `url` |
| `workspace_create(org, namespace, name)`, `workspace_list(org, namespace)` | Create a workspace; list those you can read |
| `file_list(org, namespace, workspace, prefix, pattern, limit, revision, cursor)` | Paths, sizes, types, revisions and tags; never content |
| `file_get(org, namespace, workspace, path, revision)` | A file's details |
| `file_read(org, namespace, workspace, path, lines, revision)` | Text, at most 2,000 lines or 100,000 characters; `next_lines` says what to ask for next |
| `file_write(org, namespace, workspace, path, text, if_absent, if_revision, content_type, tags, message)` | Save text |
| `file_edit(org, namespace, workspace, path, old, new, if_revision, message)` | Replace one exact occurrence, based on the revision it read (an `if_revision` you give must be that revision) |
| `file_delete(org, namespace, workspace, path, if_revision, message)` | Mark a file deleted; its revisions stay readable |
| `file_restore(org, namespace, workspace, path, revision, if_absent, if_revision, message)` | Make an old revision the newest |
| `file_batch(org, namespace, workspace, operations, message)` | Several files as one change, all or nothing |
| `workspace_changes(org, namespace, workspace, since, path, limit, cursor)` | What changed, who, when |
| `file_set_tags(org, namespace, workspace, path, tags, if_revision, message)` | Replace a file's tags |
| `lake_create(org, namespace, name, description, tags)`, `lake_list(org, namespace)`, `lake_get(org, namespace, name)` | Make a lake, list the lakes you can read, and read one's `catalog_url` and `warehouse` for your engine (DuckDB, PyIceberg or Polars) |
| `role_list(org)` | The org's roles, each with its groups |
| `policy_get(arn)`, `policy_put(arn, document, if_match)` | Read the policy of a namespace, workspace or lake, and write it back with the version you read: how you share what you made |
| `file_upload(org, namespace, workspace, path, filename, ...)`, `file_download(org, namespace, workspace, path, filename, revision)` | Move a file between the workspace and the agent's own disk |

Large files and binary files are moved with the Python SDK (`ws.upload_file`, `ws.download_file`).

Every write says what it is based on: `if_absent=true` for a new file, or `if_revision` with the revision any earlier
result returned. When the file changed since, nothing is saved and the result (marked as an error) lists each file's
current revision, who saved it and when, with `"next": "reread_and_redo"`: read again, redo the change, save.

Every failure is a result marked as an error holding one JSON object: `error` (a stable code), `message`, `next`
(`retry`, `retry_later`, `reread_and_redo`, `fix_arguments` or `ask_person`), `retryable`, `request_id`, and when
known `retry_after`, `rule`, `field`, `path` and `conflicts`. That includes an argument the tool does not take, a
missing one, a value of the wrong type, and a fault in the server itself (`InternalError`; its traceback goes to the
server's standard error, never to the model).

## Licence

Mist evaluation build: you may download and run it only to evaluate it; production use is not permitted (`LICENSE`).
