mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-05 01:28:17 +01:00
* fix(mcp-servers): six of seven servers never started; convert them to ESM
mcp-servers/package.json declares "type": "module", but fs, git, lint,
shell, supabase and vitest called require() and died on their first line
with "require is not defined in ES module scope". Only github-server.js,
which already used import, ran. They now use ESM imports, as
github-server.js does. The "plain CommonJS" lint waiver in two of them
was wrong and is removed, along with fs-server's unused fsSync import.
Once they started, every tool call that returned data failed too: the
results were { type: 'json', json: ... }, which is not an MCP content
type, so the SDK rejected them (-32602). They now return
{ type: 'text', text: JSON.stringify(..., null, 2) }, as github-server
does.
fs-server imports glob and supabase-server imports @supabase/supabase-js,
but neither was declared, so they resolved from the app's node_modules
only when it happened to be installed. Both are now declared. glob is
^14.0.3, because glob 11 carries GHSA-3g3m-2fjr-6pw4 and the minimatch
advisory; list_files works unchanged on 14.
New mcp-servers/smoke.mjs (npm run smoke): starts every *-server.js,
sends initialize, notifications/initialized and tools/list over stdio,
and calls one read-only tool on fs, git, lint and shell. Main: 1/7.
This branch: 7/7.
The rest of the diff in these files is eslint --fix and prettier, which
lint-staged applies to any staged file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
* fix(mcp-servers): close stat-then-read race in fs-server (CodeQL)
read_file stat()ed the path, then readFile()d it again by name, so the
size check could apply to a different file than the one read (CodeQL
js/file-system-race, high). It now opens one handle and stats and reads
through it. delete_file had the same stat-then-unlink shape. unlink
never removes a directory, so it now calls unlink directly and maps
ENOENT to not_found and EISDIR/EPERM to the old refusal.
Checked over MCP: read ok, too-large refused, missing file errors,
delete ok then not_found, directory refused, path escape refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
---------
Co-authored-by: Claude <noreply@anthropic.com>