Spaces:
Runtime error
Runtime error
File size: 2,051 Bytes
857a91b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # matrixcloud — Python client & CLI
Official Python SDK and command-line interface for **Matrix Cloud / Matrix
Runtime**. Talk to the `/v1` API: authenticate, run jobs, inspect models, and
drive MCP sandboxes.
## Install (with [uv](https://docs.astral.sh/uv/) — fast)
```bash
cd clients/python
uv sync --extra dev # creates .venv and installs the package + dev tools
uv run mxc status # or: source .venv/bin/activate && mxc status
```
From the repo root you can also run `make venv` (uv) and `make py-test`.
Plain pip works too:
```bash
python -m venv .venv && . .venv/bin/activate
pip install -e '.[dev]'
```
## CLI
```bash
mxc signup # create a workspace + owner
mxc login # sign in (token stored in ~/.config/matrixcloud)
mxc status # runtime health + capabilities
mxc jobs # list jobs
mxc inspect hf:Qwen/Qwen2.5-7B-Instruct
mxc sandbox start mcp_server:filesystem \
--cmd 'npx -y @modelcontextprotocol/server-filesystem /tmp'
mxc sandbox tools <session_id>
mxc sandbox call <session_id> list_directory --args '{"path":"/tmp"}'
mxc sandbox stop <session_id>
```
Point at a remote runtime with `--url` or `MATRIXCLOUD_URL`; use
`MATRIXCLOUD_TOKEN` to pass a session token in CI.
## Library
```python
from matrixcloud import MatrixCloud
with MatrixCloud("http://localhost:8080") as mc:
mc.login("you@acme.io", "secret123")
print(mc.capabilities()["capabilities"])
meta = mc.inspect_model("hf:Qwen/Qwen2.5-7B-Instruct")
print(meta["recommended_runtime"], meta["estimated_parameters"])
s = mc.create_sandbox("mcp_server:filesystem",
"npx -y @modelcontextprotocol/server-filesystem /tmp")
for ev in mc.stream_sandbox_events(s["session_id"]):
print(ev["step"], ev["message"])
if ev["step"] == "ready":
break
print([t["name"] for t in mc.sandbox_tools(s["session_id"])])
mc.delete_sandbox(s["session_id"])
```
Licensed under Apache-2.0.
|