Repository navigation
Releases
v0.7.1
Stored hashes name their algorithm, and release tags are signed.
Changed
- Tool fingerprints in pins, audit chain hashes and the hash of a call's arguments are stored with
the name of their algorithm, assha256:<hex>, so the algorithm can change without a new store
format. Pins and audit logs written by 0.7.0 and earlier, with bare SHA-256 hex, still check. A pin
written by this version looks changed to 0.7.0, which then asks for the tools to be approved again. - The release tag is signed with the maintainer's SSH key, and GitHub shows it as Verified. Tags up
to v0.7.0 are not signed.
v0.7.0
Python servers. A server started with uvx from PyPI is caged as an npx one is: resolved into a
lock with every package's hash, then installed from wheels only, so no package's code runs while
its image is built, on your machine or in Docker.
Security
- Windows: mcpcage looked at paths a configuration entry names before deciding anything about it:
itsenvFile, itscommand(and the node andcli.jsof a caged entry), the directories of its
PATH, its mount and argument paths, the.gitfile in a mounted folder. Windows opens a
\\host\shareor//host/sharepath by connecting to that host over SMB, and authenticates with
the credentials of your session (NTLM). So an entry in a cloned repository's.vscode/mcp.json,
or one written by any program, handed its author's host your NTLM response as soon as
mcpcage protectread it: on a Windows 10 PC, looking at anenvFileor acommandon a share
opened TCP connections to port 445 of the machine that served it. mcpcage now tells such a path
by its text alone, after the variables it fills in (any path that starts with two slashes or
backslashes, in any mix:\\server\share,//server/share,\\?\UNC\...,\\.\...), and never
looks at it: the entry is not counted as caged,wrapand--fixleave it as it is ("one of its
args is a network path, which mcpcage does not open"), andrunrefuses such a mount. The uv
settings that 0.7.0 reads for uvx entries follow the same rule: anAPPDATA,USERPROFILE,
PROGRAMDATA,SYSTEMDRIVEorUV_CONFIG_FILEthat points at a share, or at a host without a
share (\\host), stops the cage instead of being read ("its env sets APPDATA to a network path,
which mcpcage does not open, ..."). Your own AppData folder, where Windows' folder redirection
puts it on a share, is still read, as every program of your session reads it. On macOS a path
under/net/<host>is left alone the same way: where the automounter's-hostsmap is turned on
(it is not by default), looking there mounts that host over NFS. A symlink or a junction on a
local disk that points at a share is not seen by a test of the text. Every published version up
to 0.6.4 is affected. Advisory:
GHSA-ghcm-rm79-6w6g.
Added
- uvx servers.
run,prepare,wrap,protect --fixandprotect --inspecttake a server
started withuvx <package>,uvx --from <package> <command>,uv tool runoruv tool uvx,
uvx by its full path, and on Windows a plaincmd /c uvx ...(kept after--, so thatunwrap
gives the entry back as it was, as forcmd /c npx). The package is a name with optional extras
and versions;pkg@1.2ispkg==1.2, andpkg@latesttakes the newest release.--with,
--python(3.10 to 3.15),--prereleaseand--exclude-newerare read, and so areUV_PYTHON,
UV_PRERELEASEandUV_EXCLUDE_NEWER; flags that only tune uv's cache, output or interpreter
lookup on the host are ignored. A plain date given to--exclude-neweris the next midnight in
your time zone, as uv reads it on the host. A server's id leaves out its version, extras,--with
and--python, so an upgrade is compared with the tools you approved.run --no-sandboxstill
starts a uv line on the host as written, under the id it had. See
Python servers. - How a uvx server is built. The resolve runs
uv pip compile --no-buildin a container of uv's
image, pinned by digest, hardened as the cage is but with the network on for PyPI, with no host
file and none of the entry's variables. It pins the server's own release first, so that a
dependency without a wheel cannot move it back to an old release (dbt-mcp2.10.1 became 0.2.1
so), then locks every package with its sha256 hashes. The image is built from that lock with
uv pip sync --require-hashes --no-buildon a distroless base, with no shell and no pip, and runs
as 65532. Python is 3.13 unless the line asks for another, raised to 3.14 or 3.15 when the newest
release needs it, with a line saying so ("Python 3.14 for windows-mcp 0.8.8, which needs it (on
Python 3.13 it would be 0.8.5)"). The lock is reused until--rebuild, or a change in what
decides the install, so@lateststays at the release of the first build; a lock kept in the
store is checked again before each build as a fresh one is. - What is refused, with the reason, naming a flag or a variable and never its value: a server
whose packages are not all on PyPI as wheels ("dbt-mcp cannot be installed from PyPI wheels on
Python 3.13 for Linux on ARM (linux/arm64), and the cage never builds a package from source:" and
uv's reason); a git, URL or path source,--with-editable,--with-requirements; another index
(--index-url,UV_INDEX_URL...); a file on your machine (--constraints,--env-file, an
entry'sUV_CONFIG_FILE...); a build from source or for another platform (--no-binary,
--python-platform...); a package that uvx reads as a Python interpreter to start (python3.13,
pypy,pyodide); and uv settings, yours, the system's or those an entry's variables point uvx
to (uv.tomlunder~/.config/uv,/etc/xdg/uv,/etc/uv,%APPDATA%\uv,%PROGRAMDATA%\uv,
or the fileUV_CONFIG_FILEnames), that name an index or change what uvx installs
(resolution,prerelease,exclude-newer,dependency-metadata,no-binary,
allow-insecure-host...): "your uv settings (~/.config/uv/uv.toml) name a package index, and the
cage builds from PyPI only". wrapandprotect --fixresolve each uvx server before they write its entry. One that uv finds
no solution for is left as it is, with uv's reason; one whose resolve fails for another reason
(Docker stopped, no network) is written with a note, and resolved at its first start. Nothing is
kept in mcpcage's store until you answer yes, and the image is built from the lock the plan made.
--no-buildskips the resolve and says so.protect --inspectstarts uvx servers in the cage, and names a package that ships no wheel
("builds from source: uuid 1.30 ships no wheel (uvx runs its build code with your permissions when
it installs it); mcpcage installs wheels only"), counted in its own summary line.prepareprints the Python and the wheels' platform ("python 3.13.18, wheels for
aarch64-manylinux_2_40"), andrunwrites the package, its version, the Python, the platform and
the uv release into the audit log's sandbox entry.doctorprints the four PyPI base images with their digests, after the npm ones.- The first resolve on a machine says that it is pulling uv's image, once, instead of waiting
without a word. - Compatibility: the 39 Python MCP servers started with
uvxthat PyPI
counts the most downloads for, run through the cage on macOS and Linux, 9 of them on Windows. On
the Mac 26 work with the defaults, 3 need--allow-net, 6 fail (outside mcpcage too, or because
they check dummy keys against their service), and 4 are refused for a package without a wheel;
on Linux, 27 work, since one of the 4 has its wheel for x86_64 only.npm run compat -- --runner uvxruns them, and the weekly workflow runs all 63 servers. - Property-based tests of the uvx line reader, the uv settings scan, the lock check, network paths
on Windows, the lines to paste intoclaude mcp add(run through/bin/sh) and the build output.
Mutation scores of the files 0.7 added or changed the most:pypi.ts92.5%,uv-settings.ts
92.6%,network-path.ts100%,windows-places.ts87.0%,terminal.ts85.9%, and 71% for the
uvx parts ofprotect.ts, whose report wording the CLI tests check from a process Stryker cannot
see.
Changed
protectreports a uvx entry (uvx,uv tool run,uv tool uvx,cmd /c uvx) as NOT CAGED,
with what it asks PyPI for ("asks PyPI for: mcp-server-time") or why it cannot be caged, and
--fixcages it. 0.6 said "uvx, not supported yet" and counted it with the remote and
containerized servers. So the exit code counts uvx entries:protectexits 1 on a machine with
an uncaged uvx server, where 0.6 exited 0, andprotect --fixexits 1 when one it could not cage
is left. A script that gates onprotectmay change result.- Any other program is reported as ", not npx or uvx: cannot be caged yet".
Fixed
protectcalled caged an entry whose line after--mcpcage runrefuses at every start: a
program that is neither npx nor uvx (run -- node server.js),run -- npx -p x y, a bare
mcpcage run. Such an entry is now "cannot start:" with run's reason, is not counted as caged,
the summary counts it ("N cannot start: mcpcage run refuses its command line, for the reason
shown above."), and--fixleaves it with the reason.- macOS: an entry that starts
NPX(orUVX) in another case was "another command", so
protectexited 0 and--fixhad nothing to change, though APFS findsnpxby that name and
the server ran on the host. npx and uvx are now compared without case on macOS, as on Windows. - The lines
protect --fixprints to paste intoclaude mcp add, while Claude Code is running,
were the report's command column: an argument holding$(id)and backquotes was printed as it is,
and pasted into a shell it ranid. Each word is now quoted for the shell (POSIX single quotes on
macOS and Linux; double quotes on Windows, for PowerShell and cmd). A server with a word that no
quoting gives back unchanged, or that the terminal would show otherwise (a line break, an
invisible or bidi character), gets "close Claude Code and run mcpcage protect --fix again" in
place of a line. - What
docker buildanddocker pullprinted went straight to the terminal: the classic builder
wraps a step's stderr in color codes, and a package'...
v0.6.4
v0.6.3
Changed
- Releases are published to npm by trusted publishing: the release workflow trades its GitHub
Actions OIDC token for a short-lived npm one, so no npm token is stored in the repository or
anywhere else. The package keeps its provenance, its CycloneDX SBOM and its signed build
attestation. The release job runs on Node 24, whose npm supports it. - Development only: Stryker, which runs the mutation tests, is given minimatch and qs versions
without known vulnerabilities, through scoped npm overrides. Nothing changes for whoever installs
mcpcage, which still has no runtime dependencies.
v0.6.2
A round of testing aimed at trust: a fourth review of the Windows code, the 24 most downloaded
MCP servers run in the cage, property-based tests of everything that reads untrusted input, and
mutation testing.
Security
- A server could slip a new tool past the pin by listing one malformed entry with it: a
tools/listanswer such as[{"name":"read_file"}, {"name":"send_keys", ...}, {"name":null}]
reached the client whole, the new tool neither pinned nor compared with the pin, with no block.
mcpcage compared a listing with the pin only when every entry was a tool definition. Such an
answer is now refused whole: the client gets an error, nothing is pinned, the session is locked,
and the audit log recordslist-blockedwith reasonnot-tools. Every published version up to
0.6.1 is affected. - A
tools/callsent without an id (a JSON-RPC notification) skipped the call filter and the
audit log, so a call to a tool nobody approved reached the server. Everytools/callis now
filtered; a refused one without an id gets no answer, as JSON-RPC requires, and is recorded as
call-blocked. - A
tools/callwhose tool name is not a string was looked up as"": with a tool named""
approved, every such call passed. It is now refused. - A
tools/callwhose arguments were nested a few thousand levels deep stopped mcpcage with a
stack overflow before it answered. Arguments nested more than 256 levels deep are now refused. - Windows: an entry's
envcould makedockerstart another program on the host whileprotect
counted the entry as caged:ProgramData(or another of Windows' place variables) naming a folder
with adocker-buildx.exeof its own,GODEBUG, or, when a client leaves those variables out, a
project folder holding Docker plugins. mcpcage now moves Windows' place variables andGODEBUG
from an entry'senvinto the cage, and gives docker and npm the places Windows itself reports
(the registry, the account's home,SystemRoot), not the ones it was started with. - Windows: an
envthat sets one variable twice in two cases (PathandPATH) is counted as not
caged. Windows keeps only one of them, and which one depends on the client. - Windows: an entry that starts mcpcage through
mcpcage.cmdwith arguments thatcmd.exereads
again (a quote,&,|, ...) is counted as not caged: cmd runs them as commands before mcpcage
starts (CVE-2024-27980).--fixrewrites it as node with mcpcage'scli.js. - macOS and Linux: a writable mount whose path has
..after a symlink
(/x/link/../proj:rw) got no read-only.git, and a server in the cage could write
.git/configon the host, which git then runs. mcpcage looked through the directory the system
finds (the..taken from where the symlink leads) while Docker mounted the one the path spells.
A mount's path is now read as Docker reads it before mcpcage checks and looks through it. Affects
0.5.0 to 0.6.1.
Fixed
- A new server, or
--rebuild, could get an old version of its package from Docker's build cache
instead of npm'slatest: a build that resolves a package now runs without the cache. npx -sandnpx --silentare accepted, as@modelcontextprotocol/server-pdf's README writes
them; 0.6.1 refused them as an unsupported flag.wrapand--fixleave as it is an entry whoseenvnames a variable with=in it (the cage
would read a different value), and write a variable whose name starts with a dash as
--env=NAME, whichrunused to refuse at every start.- Windows: a
--mountof\\,//or\\.alone is refused as written. It was resolved toC:\
and, with--allow-sensitive-mount, mounted the whole drive, whileprotectsaid the entry
could not start.
Added
- Compatibility: the 24 MCP servers started with
npxthat npm counts the
most downloads for, run through the cage on macOS and Windows: 22 work with the defaults, 2 need
--allow-net.npm run compatruns it, and a weekly workflow runs it on Linux. - Property-based tests (fast-check) of the proxy, the pin, wrap and unwrap, the places never
mounted and Windows' paths, with a far longer run every week on Linux and Windows. They
found the first four security items above, and theenvand\\fixes. - Mutation testing (Stryker,
npm run mutation), weekly: the tests notice 88% of the changes made
to the code that decides what is safe. - The OpenSSF Scorecard runs on every push to
mainand weekly, with its badge in the README. Each
GitHub release carries the signed build provenance (.sigstore.json).
Changed
- The README and the threat model say that the read-only settings in a writable mount are looked
for at any depth except insidenode_modules, and why.
v0.6.1
Fixed
protect --fixandwraprun throughpnpm dlx,yarn dlxorbunxwrote the runner's copy of
mcpcage into configurations (on Windows itscli.js, for pnpm the one in its store), which the
runner deletes or replaces (yarn as soon as mcpcage exits): every caged server then stopped
starting. 0.6.0 refused only npx's. They now refuse any mcpcage in a temporary place, the system's
temporary directory, npm's_npxor pnpm's dlx cache, an explicit--commandincluded, and say
to install mcpcage (npm install -g mcpcage) or to pass--command.protectwithout--fix
still works from any of them.npx mcpcage protectsaid of an entry caged by the installed mcpcage that it starts "not the
mcpcage on your PATH" (on Windows "not mcpcage's cli.js and your node") and counted it as running
uncaged, and--fixrefused though mcpcage was installed;pnpm dlxandbunxlikewise. The
runner puts its own directories first on the PATH it gives mcpcage, which took them for yours.
Run from a temporary place, mcpcage leaves out of your PATH the directories in a temporary place,
everynode_modules/.binand npm'snode-gyp-bin, finds the installed mcpcage past them (on
Windows thecli.jsnpm installs next to itsmcpcage.cmd), counts what it caged as caged, and
--fixwrites it. An entry whosePATHnames one of those directories is no longer taken for
one on yours, and a look-alike mcpcage in a project'snode_modules/.binis never taken for the
installed one.
v0.6.0
Windows. Run on a Windows 10 PC for the first time, the unit suite gave 62 failed, 254 passed, and
mcpcage run stopped before a server given a folder could start. mcpcage now runs there with
Docker Desktop's Linux containers, tested with Node 24, and a CI job runs the typecheck and the unit
tests on Windows. Every Windows change below was found on that PC.
Added
- Windows: a folder is mounted in the cage at
/c/...(C:\Users\me\notesat
/c/Users/me/notes, spelled as Windows keeps it on disk), and the server is given that path for
each argument that names a mounted folder or a path inside one.runprints where each folder is
in the cage. Tool calls are not translated: the model has to use the paths the server lists. - Windows: an entry that starts
cmd /c npx ...counts as npx, andwrapand--fixcage it,
keepingcmd /cafter--so thatunwrapgives it back as it was; mcpcage never startscmd
for it. One whose line holds more than npx and its arguments is reported as not a plain npx
command line and left as it is. - Windows: Claude Desktop installed from its MSIX package keeps its configuration under
%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude.protectreads it, and
that directory is never mounted (see Security). - A banner with mcpcage's name, version and tagline at the start of
mcpcage,help,doctorand
protect, only when stdout is a terminal; only the version line in one narrower than 62 columns.
Never for any other command, and never when the output is piped or redirected.
Changed
- Windows:
protect --fixandwrapwrite the node that runs mcpcage (node.exe) with mcpcage's
cli.js, by their full paths, instead of npm'smcpcage.cmd: Node refuses a plain spawn of a
.cmdsince the fix of CVE-2024-27980 (EINVAL), so a client that starts servers that way could
not start what 0.5.0 wrote.protectsays of an entry caged withmcpcage.cmd(or.bat) that
some clients cannot start it, counts it on a line of its own, and--fixgives itnode.exewith
cli.js, its options kept. - Windows: a bare
mcpcagein an entry never counts as mcpcage, since Windows looks for a bare name
in the client's current directory first:protectcounts it as running uncaged,--fixrewrites
it, and a bare--commandis refused. - Windows: a writable mount that holds any of git's or the editors' settings, a directory as well
as a file, refuses to start, and so does a read-only mount given inside a writable one (see
Security). - The install scripts lookup (
npm view) runs the npm that packs a local package, on every system:
next to the node that runs mcpcage, then the standard places, with a PATH of those places, instead
of the first npm on the PATH.
Fixed
Windows
run --no-sandboxcould not start npx ("spawn npx ENOENT"). It starts npm'snpx-cli.jswith the
node that runs mcpcage, never through a shell, and refuses any other batch file as the host
command, saying what to give instead.- The install scripts lookup started
npm.cmdthroughcmd.exewith the package spec on its command
line, and Node 24 printed a DEP0190 warning in the report; a spec with"or%was refused. NPX.CMD,npx.CMDorC:\NODEJS\NPX.CMDwas "not npx": the server ran uncaged and was not
counted. npx, uvx, docker and mcpcage are compared without case.- A local package given as
.\x,..\x,C:\xor\xwas looked up on the registry by that name. protect --fixrewrote~/.claude.jsonwhile Claude Code was running: a runningclaude.exeis
now found withtasklist.exe, as Claude Code is withpson macOS and Linux.- A network share or a device path (
\\server\share,\\?\...) given to a server was mounted by
wrapand--fix, and the entry never started, whileprotectcalled it caged. Such a server is
left as it is with the reason, a caged entry that mounts one is said not to start, and
protect --inspectinspects the server without it. protect --inspectmounted a folder named in another case than on disk at another place than
rundoes, so the inspected server listed other paths than the caged one.- A directory of your PATH spelled with 8.3 short names (
C:\PROGRA~1) in one place and long names
in the other counted as another directory, and the same mcpcage spelled in another case
(mcpcage.CMD) as another file: paths are compared as the system spells them on disk. - A
mcpcage.batwas "another command", not counted as uncaged whatever it ran. It is read as a
mcpcage.cmdis.
Everywhere
npx mcpcage protect --fixwrote the mcpcage of npx's own cache into configurations (on Windows
itscli.js), whichnpm cache npx rmdeletes and a later npx replaces: once it was gone, every
caged server stopped starting.--fixandwraprefuse to write a command from npx's cache, an
explicit--commandincluded, and say to install mcpcage (npm install -g mcpcage) or to pass
--command.protectwithout--fixstill works from npx.
Security
- Windows: a program in the current directory ran in place of docker or npm.
doctorran a
project'sdocker.exe,prepareitsnpm.exe, since Windows looks for a bare name there first,
whatever the PATH. docker and npm are never started by a bare name there. - Windows:
protect --fixrun in a directory that held amcpcage.cmdwrote that file into the
user's configurations, sincewherelooked in the current directory first; the clients then
started it on the host.--fixno longer runswhere, on any system: mcpcage is looked up in the
absolute directories of the PATH only. - Windows: Docker Desktop lets a server in a writable folder reach a read-only folder inside it under
another case of its name. Through the cage, a server wrote.GIT/configaround a read-only.git
and changed the repository's.git\configon the host, from which git runs commands. mcpcage now
puts no read-only mount inside a writable one there (see Changed). - Windows: the repository a
.gitfile names by an absolute path, as git writes it on Windows, or
by 8.3 short names was not found, and stayed writable inside a writable mount: a server could
change its configuration and hooks. - Windows: Claude Desktop's MSIX configuration directory was an ordinary path for
runandwrap:
mounted, it gave a server the other servers' tokens, and with:rwa place to add an uncaged
server of its own. It is refused as a mount like%APPDATA%\Claude, and an entry's env that sets
LOCALAPPDATAcounts as moving the client configurations, asAPPDATAdoes.
mcpcage 0.5.0
Hardening, second round. Independent reviews tried to break 0.4.0 from both sides: a server
talking to the proxy or writing in its mounts, and a client configuration entry that nobody meant
to write. Two more reviews then tried to break the fixes. Every change below closes something one
of them found.
Changed
wrapandprotect --fixmount the paths a server is configured with read-only. Three review
rounds each found another way for a server with a writable mount of a project to have the host
run code (git hooks and configuration, editor settings,.envfiles a client loads), and no list
of names to protect can be complete.--writablekeeps the previous behavior, with a warning for
each writable mount, andprotectreports a writable mount as an opened cage.- On macOS and Windows, a writable mount that holds a file setting (a
.gitfile,.mcp.json)
refuses to start: the server could rewrite it under another case of its name. An entry that
0.4.0 caged with such a mount starts again once its:rwis dropped. - mcpcage runs docker from the standard install places and npm from next to the node running it,
each with a PATH of those places only, instead of the PATH a client was given. protectexits 1 when it could not check a configuration file, as it does for an uncaged server.- The server's stderr reaches the client's log line by line, prefixed with
[<server-id>]. wrapandprotect --fixmove some variables of an entry'senvinto the cage as
--env NAME=valuearguments (see Fixed), so their values show in the process list while the
server runs;unwrapputs them back inenv.- Many more paths are never mounted (see Fixed):
wrapand--fixmay leave uncaged a server that
0.4.0 caged, with the reason, andrunrefuses its--mountwithout--allow-sensitive-mount. - Inside a writable mount, existing git and editor settings are mounted read-only and the
directories that lead to them are held in place: a server can no longer rename those directories,
and moving a file across them fails (EXDEV). protectcounts an entry as caged only when it starts the mcpcage on your PATH (or the one that
runs the report), and says when an entry's run options, its ownPATH(any directory that is not
on yours), itsenvFile, or a writable mount open the cage.wrapand--fixcheck the entry
they write with the same rules and leave one that would not count as caged as it is.mcpcage runrefuses a--memoryor--cpusthat is not positive, and a server id with other
characters than letters, digits, dots, dashes and underscores.- A definition approved by an earlier version with a
"__proto__"key counts as changed once and
needs a fresh approval, and an audit entry an earlier version wrote with such a key no longer
verifies.
Fixed
The proxy and the pin
- Names that every JavaScript object inherits fooled the pinning: what a definition held under a
"__proto__"key was left out of its fingerprint, so hidden text added there passed as no change,
and atools/callforconstructor,toStringor__proto__reached the server although no tool
of that name was approved. Every key now counts, and a call passes only for a tool approved under
its own name. - Trust on first use reached past the first listing: a server that had the client list again, or
answered a cursor it never issued, replaced approved definitions. Only the first listing is trusted
now, its first page and the pages asked for with the cursor each page returned, and none of them
may redefine a tool pinned before. - The limit of 10,000 tools held for one page only. It now holds for what is pinned and pending
together, across pages, listings and approvals. - Text a server controls reached the terminal raw: escape sequences in a tool's name could clear or
rewrite whatmcpcage diffshows before approval, and the server's stderr could print lines that
read like mcpcage's own. Everything mcpcage prints from a server or a configuration spells out
control and format characters as[U+XXXX], long names and keys show a 200-character excerpt
with their length, and the new-tool view shows every field the user approves. - With a client that does not read mcpcage's stderr, log lines piled up in memory, and one long
message went through whole. At most 1 MiB now waits; a message that does not fit is cut with its
length or dropped, and the dropped lines are counted. - The signs of hidden instructions missed the keys of a definition, anything but a plain URI or
JSON pointer under$schema,$idand$ref, and the address, name, title and description of a
resource_linkor an embedded resource in a result.
The cage and its mounts
wrap,protect --fixandrun --mountreached places from which the machine later runs
commands: other clients' MCP configurations (also where XDG_CONFIG_HOME, COPILOT_HOME or APPDATA
move them), shell and login startup files, git's configuration and any repository's.git,
project editor and agent settings, the programs on the PATH and where they are installed, and
more Docker sockets. They are never mounted now, and the report names them.- A writable mount of a project let a caged server change the project's
.gitand editor
settings, from which git and editors run commands on the host as soon as the project is open, or
rename the directory holding them and write new ones in its place, or change the repository a
.gitfile points to. Existing settings are now mounted read-only, the directories leading to
them are held in place, and a repository a.gitfile orcommondirpoints to is followed and kept
read-only; anything that cannot be kept so refuses the start. - A server entry's
envconfigured mcpcage itself oncewrapor--fixrouted it through mcpcage:
NODE_OPTIONS or OPENSSL_CONF ran code on the host before the cage existed, DOCKER_HOST sent the cage
to another daemon, a HOME pointed elsewhere turned the real~/.sshinto an ordinary path, and
MCPCAGE_HOME moved the pins to an empty store.NODE_*(exceptNODE_ENV),LD_*,DYLD_*,
DOCKER_*(except a local-socketDOCKER_HOST),OPENSSL_*,GCONV_PATH,npm_config_*and
the shell'sBASH_ENV,SHELLOPTS,BASHOPTS,PS4,ZDOTDIRandBASH_FUNC_*now move into
the cage as--env NAME=value; HOME, USERPROFILE and MCPCAGE_HOME are dropped; the mount
check counts the account's own home whatever HOME says; a relative MCPCAGE_HOME is made absolute. protect --inspectread a path argument ending in:rwas a mount option, so a directory named
~/.ssh:rwgot the real~/.sshmounted writable, and it mounted sensitive paths for the listing.
It now mounts each path argument read-only as written, never one thatwraprefuses, and names in
the report what a server was inspected without.- An entry's
PATHchose the docker mcpcage runs, the credential helpers docker runs and the npm
that packs a local package, and a VS CodeenvFilecould set any of the variables above unseen.
docker and npm now come from trusted places, an entry'sPATHcounts only when it stays within
yours, andprotectreads anenvFilelikeenv. - When a package declares several programs, the launcher in the image ran the first one where npx
refuses to choose; it now chooses as npx does. run --idand the id given todiff,approve,audit showandaudit verifywere used as
given, so../../xread and wrote outside mcpcage's store.
The report of mcpcage protect
protectsaid "caged" for any command namedmcpcage, a look-alike or one next to a package.json
that claims the name included, for entries whose run options open the cage, and for entries whose
ownPATHmakes the client start anothernode. An entry now counts as caged only when its
command is the same file as the mcpcage--fixwrites or the one running the report; a
look-alike is caged by--fixand bywrap; opened cages and aPATHthat picks other programs
are named, one line each, and not counted as caged.- One malformed entry or file stopped the whole report: an argument that is not a string, a value
nested thousands of levels deep, a FIFO in a configuration's place or annpm viewanswer of an
unexpected shape. Each now becomes a line of the report and the scan goes on; a file over 16 MiB
is reported without being read. - The report printed credentials it promises to keep out: the second value of a repeated query
name, a SAS signature or an Azure Functions key, a real key containingxxxorchangeme, an
address behind--url=, a token used as the user name of an address, and values a server copied
into its tools during--inspect, whole, cut up, spliced with invisible characters or printed on
several lines. All are masked now. protectmissed VS Code configurations under XDG_CONFIG_HOME on Linux and in named profiles.
wrap, unwrap and --inspect
wrapandunwrapwrote the configuration straight over the live file, stopped at one malformed
entry, and dropped an env variable named__proto__. They now replace the file atomically, leave a
malformed entry as it is with the reason, and keep every variable.protect --inspectqueued without bound the answers and requests for a server that does not
read its input, and accepted a listing of any size over its pages. Nothing is added while 16 MiB
wait to be sent, and a listing over 16 MiB in total is refused.
mcpcage 0.4.0
Hardening. Every change below came out of trying to break mcpcage: hostile servers against the
proxy, abuse inside the cage, mounts that undo it, and a first CodeQL scan.
Added
mcpcage run --allow-sensitive-mountand--allow-server-requests, each printing a warning when
used.- The proxy reads every
tools/callresult with the hidden-instruction rules that make sense on free
text, records the signs in the audit log (result-signs) and prints the high-severity ones. Results
always pass unchanged. - Docker tests that abuse the cage: writes outside the mounts, a file run from
/tmp, a fork bomb,
a memory bomb, the environment, the capabilities, the absence of a Docker socket, DNS and TCP
without and with--allow-net. - CodeQL on every change and every Monday; secret scanning with push protection and Dependabot
security updates on the repository.
Changed
mcpcage wrapandprotect --fixno longer cage a server that needs the whole disk, the home
directory or its parents, the system configuration, a Docker socket, a directory with credentials
(.ssh,.aws,.gnupg,.kube,.docker, gcloud,.azure,.npmrc,.netrc,
.git-credentials,.password-store, the keychains, Colima's and OrbStack's sockets,
.claude.json) or mcpcage's own pins and audit logs: the entry is left as it is, with the reason.
run --mountrefuses such a path unless--allow-sensitive-mountis given;protectnames it.
A server that 0.3.0 caged with such a mount is refused at its next start, with a message that says
what to do.- The proxy reads the server's output with a bounded splitter: a line over 16 MiB is dropped and
counted (oversize-line), output that is not JSON-RPC is dropped (stdout-noise), a response to
an id the client is not waiting for is dropped (unsolicited-response), and an id must come back
with the type the client sent. - Requests from the server to the client:
pingandroots/listpass;sampling/createMessage,
elicitation/createand any other method are refused with error -32001 unless
--allow-server-requestsis given (server-request-blocked). - A
tools/listwith more than 10,000 tools, or with a definition nested more than 256 levels
deep, is refused whole: the client gets an error, nothing is pinned, the session is locked.
diffandapproverefuse such a pending file;protect --inspectreports such a server as
refused and reads servers with the same limits. - The hidden-instruction rules read a text in windows of 1 MiB, at most 100 matches per rule per
window, and at most 20,000 strings or 32 Mi characters per definition or result; ascan-budget
sign stands for the rest. - Nothing a server sends that is nested more than 256 levels deep is serialized again or walked:
a tool result like that passes unchanged, unmeasured (call-resultrecords no size) and with a
scan-budgetsign; an answer nobody asked for or a batch message like that is dropped
(deep-message); a pin or pending entry like that, written by an older version, is left out and
the tool counts as new. The inspect client answers a server's requests only when their id is a
string or a number. - The cage gets no swap:
--memory-swapequals--memory. Before, Docker allowed as much swap
again on a host that has some, and the limit doubled.
Fixed
- The proxy crashed with EPIPE when the server exited while the client was still writing, when the
client went away while the proxy wrote to it, or when the log pipe closed. It now ends cleanly
with the server's exit code. - A client that reads slower than the server writes no longer lets the server's output pile up in
memory, and answers to a server that does not read its input are capped. - The hidden-instruction rules could crash or stall on texts of millions of characters or strings
and on definitions nested thousands of levels deep. - Backups of configuration files are created with an exclusive write,
wrapreads the file instead
of checking for it first, and the demo's probe server writes a file with a random name (the three
findings of the first CodeQL scan).
Full Changelog: v0.3.0...v0.4.0
mcpcage 0.3.0
Added
- Devin:
mcpcage protectfinds its MCP configuration files,~/.config/devin/mcp_config.json
(%APPDATA%\devin\mcp_config.jsonon Windows),<project>/.devin/mcp_config.jsonand
<project>/.devin/mcp_config.local.json, and reports their servers;--fixroutes their npx
servers through mcpcage, with a backup, as it does for Cursor, andmcpcage wraptakes these
files too. The Windsurf files of older installs are still read.
Changed
mcpcage protectlists the clients of the files it did not find on their own line, under the
count, so the report stays readable in narrow terminals.
Full Changelog: v0.2.1...v0.3.0