Hyperlight

io.github.hyperlight-dev由 GitHub 帳號 hyperlight-dev 發布v0.1.1更新於 Oct 29, 2026

Runs Python in a local, hardware-isolated micro-VM that keeps its state between calls

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

在本地硬體隔離的 micro-VM 中執行 Python,並像筆記本一樣在多次呼叫間保留變數與匯入。

可以做什麼
  • 在沙箱 micro-VM 中執行 Python 程式碼,回傳列印內容以及結尾運算式的值
  • 在多次呼叫之間保留變數、匯入與函式,如同筆記本
  • 重設沙箱,換成全新執行個體並清空所有狀態
  • 可選在啟動時與每次重設後安裝額外套件,並允許連線指定網路主機
適用情境
適合助理需要進行運算、資料分析或執行不應碰觸本機的程式碼,同時又要跨步驟保留狀態的情況。也適合希望在本機執行、隔離性強於一般行程、又不想使用雲端沙箱帳號的使用者。
執行需求
以 uvx 或 pip 啟動的本機行程;需要 hluk CLI v0.18.0 或更新版本,以及虛擬機監控程式(Linux 上為 KVM 或 MSHV,Windows 上為 WHP,Apple 晶片 Mac 上為 HVF)。不需帳號或 API 金鑰。首次啟動會下載約 400 MB 的映像並儲存快照,可能耗時數秒到數分鐘。僅限桌面端。
安裝前請注意
預設情況下客體沒有網路存取,也看不到你的檔案;用 --net-allow 開放主機或用 --hluk-arg 掛載目錄會擴大這個範圍。呼叫超過逾時時間(預設 30 秒)會被停止並替換客體,狀態也隨之遺失。伺服器結束時仍在啟動的客體不會一併停止。輸出最多保留 100,000 個字元。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Hyperlight,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-server-hyperlight

An MCP server that runs Python in a local Hyperlight micro-VM, for any MCP client: Claude Code, Claude Desktop, VS Code, Cursor and others.

The server boots a Unikraft unikernel in its own hardware-isolated micro-VM (KVM or MSHV on Linux, WHP on Windows, HVF on Apple silicon Macs) through the hluk CLI. It needs no account, no daemon and no API key, and the code and its data stay on your machine. The guest has no network access unless you allow hosts with --net-allow, and none of your files unless you mount them.

Pyodide serverscloud sandboxesmcp-server-hyperlight
IsolationWasm, in a Deno processcloud VM or containermicro-VM, its own kernel
PythonPyodide's packages onlyfullfull CPython 3.12, native wheels
Runs on your machineyesnoyes
NeedsDenoaccount, API keyhluk and a hypervisor
Ready insecondsseconds~40 ms (Linux, KVM)

Install

Install hluk v0.18.0 or later. On Linux or macOS:

bash
curl -fsSL https://raw.githubusercontent.com/hyperlight-dev/hyperlight-unikraft/main/install.sh | sh

On Windows, in PowerShell:

powershell
irm https://raw.githubusercontent.com/hyperlight-dev/hyperlight-unikraft/main/install.ps1 | iex

Then add the server to your client. It runs with uv's uvx, or with pip install mcp-server-hyperlight and the mcp-server-hyperlight command.

Claude Code:

bash
claude mcp add hyperlight -- uvx mcp-server-hyperlight

Claude Desktop, Cursor and other clients that take a JSON config:

json
{  "mcpServers": {    "hyperlight": {      "command": "uvx",      "args": ["mcp-server-hyperlight"]    }  }}

VS Code (.vscode/mcp.json):

json
{  "servers": {    "hyperlight": {      "command": "uvx",      "args": ["mcp-server-hyperlight"]    }  }}

Codex (~/.codex/config.toml), with time for uvx to install the server on its first start, and for the first call to wait for the guest image (--startup-timeout, 300 s) and then run (--timeout, 30 s), one call at a time:

toml
[mcp_servers.hyperlight]command = "uvx"args = ["mcp-server-hyperlight"]startup_timeout_sec = 60tool_timeout_sec = 360

The OpenAI Agents SDK runs it with MCPServerStdio(params={"command": "uvx", "args": ["mcp-server-hyperlight"]}, client_session_timeout_seconds=360), for the same first call; its default of 5 seconds is shorter than a call may run.

Claude Desktop also takes it as a Desktop Extension, which needs no config: download mcp-server-hyperlight-0.1.1.mcpb from its release and open it. It installs the server from PyPI with uv. Its settings set --timeout and --net-allow.

The server starts its guest as soon as the client starts it. The first time, hluk pulls the agent image of its release (about 400 MB, a 130 MB download) and saves a warm snapshot of it booted (about 800 MB), which takes some seconds to a few minutes; after that the guest starts from the snapshot in milliseconds. The image ships CPython 3.12 with numpy, pandas, scipy, scikit-learn, matplotlib, pillow and requests. To have both ready before a client first starts the server, run hluk run --runtime agent --exec 'print("ready")'.

Tools

Tool
run_pythonRuns Python code. Variables, imports and functions stay for the next call, as in a notebook. Returns what the code printed, subprocesses included, and the value of a trailing expression after Out:. An error returns its traceback, as a tool error.
reset_sandboxReplaces the guest with a fresh one from the warm snapshot, in about 60 ms on Linux with KVM, after code still running ends or times out. Packages passed with --package are installed again, with --net-allow.

A call that runs longer than --timeout (30 s by default) is stopped, and the guest replaced with a fresh one; so is a call that crashes the guest. The model is told its variables are gone. A call the client cancels before its turn does not run; one already running goes on until it ends or times out, as the server has no way yet to stop code short of its time limit.

Options

Pass them after the command, e.g. uvx mcp-server-hyperlight --net-allow pypi.org --net-allow files.pythonhosted.org --package sympy.

OptionDefault
--net-allow HOSTnoneA host or IP the guest may connect to; repeat for more, or separate them with commas. With none, every connection is refused.
--package NAMEnoneA package to install in the guest at start and after each reset, if the image lacks it. Installing needs --net-allow for the package index.
--timeout SECONDS30Longest a call may run, and so the longest a reset or the next call waits for one.
--runtime NAMEagentPublished image to run, by name or full reference.
--initrd PATHA rootfs CPIO of your own to run instead (it must have CPython 3).
--scratch-mb MIBthe image'sGuest memory in MiB.
--hluk-path PATHhluk on PATHElse where it is installed: $HLUK_INSTALL_DIR, the install scripts' ~/.local/bin (%LOCALAPPDATA%\hluk\bin on Windows), or Cargo's $CARGO_HOME/bin (~/.cargo/bin), for a client that starts the server with another PATH.
--hluk-arg ARGMore arguments for hluk run, one per option: --hluk-arg=--mount --hluk-arg=/data:/data:ro mounts /data read-only.
--startup-timeout SECONDS300Longest to wait for the guest; the first start pulls the image.

The tool descriptions tell the model what the guest has: its packages, which hosts it may reach, and whether it sees any of your files. With --hluk-arg, which can mount directories or open the network, they no longer say the guest has neither.

How it works

The server is a thin layer over smolagents-hyperlight's executor, which starts hluk run as a child process and talks to a small Python script in the guest over its console. The two packages share one guest protocol, its tests and its bounds on what the guest sends back.

  • One guest serves the server's client, and tool calls take turns on it, so state stays consistent. A guest that fails to start is reported on the standard error, and to the model on its first call, which tries again.
  • Between calls, the whole micro-VM is paused: a thread or subprocess a call leaves running only goes on while a call runs.
  • The guest is not trusted: replies are bounded (64 MiB, 2 MiB of printed output) and checked before the server uses them. A tool result keeps at most 100,000 characters, its beginning and its end, as MCP clients take far less than an agent's executor does.
  • The server speaks MCP on its standard input and output, and logs to its standard error. What hluk itself writes is kept apart, and comes with the error when a guest fails to start. It stops its guest as it exits, the input closed or on a SIGTERM or SIGINT.

Known limits

  • Python only, and text only: an image the code makes comes back as its repr. Save it to a mounted directory to keep it.
  • Packages installed by the code itself, with pip, are gone after a reset; those passed with --package are installed again.
  • One vCPU, and threads in the guest take turns rather than run at once.
  • A guest still starting when the server exits, pulling its image or installing --package packages, is not stopped with it, and runs until that start ends: the executor gives the server no handle on it before then.
  • With hluk v0.19.1 or earlier, each Python subprocess, pip install included, leaves about 15 MiB of guest memory in use until the guest is restarted (a guest kernel bug, fixed in v0.20.0).
  • CI tests the server on Linux (KVM) and Windows (WHP). hluk supports Apple silicon Macs too, but the server is not tested there yet.

Development

bash
pip install -e ../smolagents -e '.[test]'pytest                    # unit tests, and the server end to end with a stand-in for hlukRUN_ALL=1 pytest          # also the tests in a real micro-VM, with the hluk on PATH

As for smolagents-hyperlight, HLUK_PATH, HLUK_INITRD and HLUK_SCRATCH_MB test a local build of hluk and its agent rootfs instead of the hluk on PATH and its published image.

來源:integrations/mcp/README.md,提交 78c55ef

工具

2

run_python

Run Python in a micro-VM

Run Python code in a sandbox: a local Hyperlight micro-VM, isolated from this machine by a hypervisor. Variables, imports and functions persist from one call to the next, as in a notebook, until reset_sandbox. The result is what the code prints, then the value of a trailing expression after `Out:`. The sandbox has CPython 3.12 with numpy, pandas, scipy, scikit-learn, matplotlib, pillow and requests. Network: none, every connection is refused. Files: the sandbox has its own filesystem, and none of this machine's files. A call that runs longer than 30 seconds is stopped. That, or a crash, restarts the sandbox, and the variables of earlier calls are lost.

輸入參數code必填

reset_sandbox

Reset the sandbox

Replace the sandbox with a fresh one, in milliseconds: variables and imports are gone. It first waits for calls still running or sent before it, each of which runs for at most 30 seconds, then for the restart one that ran out of time needs; longer while the sandbox first starts, its image pulled.

無需輸入參數。

版本歷史

1
  1. v0.1.1最新Oct 21, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分