Listed from the MCP registry; nobody on Odel publishes it.

MCP server: One MCP server.

Sentinel-IR

@jakcmenczMCP server · External

Structural IR of JS/TS/Python/Rust files for AI agents: risk and signals instead of raw source.

Code searchv0.5.23Apache-2.0JavaScript
Freeno charge per call

Runs on your machine from its package; the steps are below.

What it does

  1. Reads
  2. Writes
  3. High impact

At most: only reads or looks up information.

What it costs

Free

Odel charges nothing per call. The publisher may charge for its own service.

Runs locally over stdio

This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).

npmsentinel-ir-mcpv0.5.23

Run

npx -y sentinel-ir-mcp

MCP client config

{
  "mcpServers": {
    "sentinel-ir": {
      "command": "npx",
      "args": [
        "-y",
        "sentinel-ir-mcp"
      ]
    }
  }
}
README22 min read

Sentinel-IR-MCP

Glama MCP Registry M8ven Score ProtocolProbe

MCP server for sentinel-ir: it lets AI agents in Claude Desktop, Cursor, Windsurf or any other Model Context Protocol client read a compact structural IR of JavaScript, TypeScript, Python and Rust files instead of the raw source.

Quick start

Requires Node.js 20 or newer. In your project folder:

bash
npx -y sentinel-ir-mcp@stable-0.5 setup     # asks which AI app, shows the change, writes after you confirm
# restart the AI app
npx -y sentinel-ir-mcp@stable-0.5 doctor    # checks that the app can start the server

Then ask the agent, for example, "Use sentinel-ir to find the riskiest files in this project." Details and other options: Setup.

What the agent gets

The IR tells the agent what a file does (risk level, dangerous capabilities such as eval or child_process, routes, exports, imports, environment reads, network / filesystem / process / crypto calls) in a few hundred characters. The agent can triage a folder first and then read the raw source only of the files that matter.

Supported: JavaScript (.js, .mjs, .cjs, .jsx; .jsx since 0.5.8), TypeScript (.ts, .mts, .cts, .tsx; since 0.2.0), Python (.py, .pyi; since 0.3.0) and Rust (.rs; since 0.5.0). The language is picked from the file extension, so analyze_file refuses a file without one (a shell script, Makefile); analyze_code also takes target or an explicit language (javascript/js, typescript/ts, tsx, python/py, rust/rs; case-insensitive since 0.5.10). Every result carries language and analysisStatus; a file that does not parse cleanly (including JSX in a .ts file) is "incomplete", and a low risk on an incomplete result is not evidence of safety. Other languages are not supported yet. What is detected in Python and Rust (and what is not) is listed in the sentinel-ir README.

What's new

Older versions: CHANGELOG.md.

0.5.23 fixes from a test with real agents (Cursor, VS Code Copilot) on Linux, macOS and Windows:

  • Several folders: every path in a result is a full path, so a file from a scan of the second folder is never analyzed from the first one; analyze_directory lists them in allowedFolders. A relative path that exists in more than one folder is refused as ambiguous.
  • setup refuses --project given twice (it used to keep only the last one).
  • analyze_code refuses empty code instead of answering complete / low.
  • The audit log no longer writes the name of an excluded file that was asked for, as this README said.
  • doctor: no min-release-age warning on npm 10 (it ignores the setting); before shows the date and that npx may find no version at all (ENOVERSIONS); with only a global Cursor config every hint names --global, also when the project config is broken; an exclusion is "matches nothing" only when it matches in none of the folders.
  • Windows hints use double quotes, which work in PowerShell and cmd.exe. A symlink loop in a parent folder is named as such. Hard links skipped in a scan no longer take places in max_files.
  • sentinel-ir 0.5.16 and 0.5.17: an unsupported script (install, Makefile, .sh, .ps1, .rb) that pipes a download to a shell, opens a reverse shell, sends secrets or spawns processes is critical; deletes and persistence are high. 0.5.17: these checks take milliseconds even on a 1 MB line.
  • SECURITY.md names a real version instead of <version>.

Tools

toolinputreturns
analyze_codecode (string), optional target (file name; its extension picks the language), optional language (javascript, typescript, tsx, python, rust, or js/ts/py/rs since 0.5.9)compact IR of the given source
analyze_filepathcompact IR of one file inside the allowed folders, plus sha256 of the exact bytes analyzed (0.5.12)
analyze_directoryoptional path, max_files (default 50, max 500), recursive (default true), detail ("summary" default, or "full")one short entry per file (path, risk, status, language, lines, operations, up to 3 risk signals, sha256 since 0.5.12; "full": all facts), sorted from highest to lowest risk, plus riskCounts, statusCounts and incomplete (paths whose analysis did not finish; check them separately, their low risk is not evidence of safety); files that could not be read are listed in skipped.unreadable and are not counted as analyzed; excluded files and folders are only counted in skipped.excluded; truncated, notScanned (source files left out past max_files, since 0.5.15; notScannedAtLeast: true when counting stopped early and it is a lower bound, since 0.5.16), warning (only on a partial answer) and skipped

Every tool returns the result twice: as JSON text (for clients that only read text) and as structuredContent. All three are annotated readOnlyHint: true, destructiveHint: false, openWorldHint: false.

Example analyze_file result for a three-line file that calls eval and child_process (real output, wrapped for reading):

json
{"analysisStatus":"complete",
 "mission":{"target":"danger.js","objective":"general_optimization"},
 "world":{"pressure":0.5,"confidence":0.75,"budget":0.015,"risk":"critical"},
 "constraints":["preserve_api","avoid_breaking_changes"],
 "forbidden":["eval","child_process","process_spawn"],
 "summary":{"size":93,"lines":3,"hasCrypto":false,"hasFilesystem":false,"hasNetwork":false},
 "facts":{"ast":true,"exports":["default"],"imports":["child_process"],
  "operations":["dynamicEval","processSpawn","childProcess"],
  "calls":{"process":["cp.exec","require(child_process)"],"dynamic":["eval"]},
  "dangerous":["eval","child_process","process_spawn"],
  "riskSignals":["child_process_import:require(child_process)@1","dynamic_code:eval@2","process_spawn:cp.exec@2"]}}

Rely on world.risk, forbidden and facts. mission.objective is a coarse hint from sentinel-ir and can stay general_optimization even for risky files, as above.

Setup

Requires Node.js 20 or newer. npx downloads and runs the server; there is nothing to compile (the parser is WebAssembly).

Quick setup (since 0.2.2)

Run it in your project folder:

bash
npx -y sentinel-ir-mcp@stable-0.5 setup --client cursor     # or windsurf, claude-desktop, vscode, claude-code
npx -y sentinel-ir-mcp@stable-0.5 doctor --client cursor    # after restarting the client
npx -y sentinel-ir-mcp@stable-0.5 guide                     # optional: text for AGENTS.md / client rules

setup (without --client it asks which client):

  • shows the change first and writes only after you confirm (or with --yes); --dry-run shows the change and writes nothing;
  • adds or replaces only the "sentinel-ir" entry; other servers and other fields in the file stay as they are, and running it again changes nothing;
  • copies the old file to <file>.bak-<timestamp> before writing and writes through a temporary file plus rename; a file with invalid JSON is never touched;
  • gives the agent one folder (--project, default: the current folder) and refuses your home folder or a whole disk;
  • writes sentinel-ir-mcp@stable-0.5, an npm tag for the newest 0.5.x, so clients get 0.5.x fixes on their next start but no unexpected new features;
  • asks which files or folders the agent must not read (--exclude <name>, repeatable, skips the question; see Excluding files);
  • for VS Code and Claude Code it writes nothing and prints their own install command (code --add-mcp ..., claude mcp add ...) instead.
--clientfile written by setup
cursor<project>/.cursor/mcp.json with ${workspaceFolder}; --global: ~/.cursor/mcp.json with the absolute path
windsurf~/.config/devin/mcp_config.json (or $XDG_CONFIG_HOME/devin/), Windows %APPDATA%\devin\mcp_config.json. Servers from an older ~/.codeium/windsurf/mcp_config.json are copied over; that file stays unchanged
claude-desktopmacOS ~/Library/Application Support/Claude/claude_desktop_config.json, Windows %APPDATA%\Claude\claude_desktop_config.json; elsewhere pass --config <file>
vscode, claude-codenothing; prints the command to run

On Windows the entry is "command": "cmd", "args": ["/c", "npx", "-y", "sentinel-ir-mcp@stable-0.5", "<folder>"]: there npx is npx.cmd, and starting it without a shell failed with ENOENT on a real Windows runner. For VS Code and Claude Code, setup prints a PowerShell and a Command Prompt version of the command. What was measured on which system: COMPATIBILITY.md.

doctor checks Node.js, the package version (and asks the npm registry, or npm_config_registry, through npm's proxy settings, whether its stable-X.Y tag has a newer release), the client config (valid JSON, a "sentinel-ir" entry that starts sentinel-ir-mcp, existing folders), then starts its own server with the same folders, performs a real MCP handshake, expects exactly the three tools and calls analyze_directory with max_files: 1. It lists your exclusions, how many files and folders they skip in the project right now, and warns about one that matches nothing (a typo). It never runs the command stored in the client config. Exit code 0 when everything passes, 1 otherwise; --json gives a machine-readable report.

Only setup writes files, and only the client config. The MCP server itself reads only; the one exception is the audit log, if you turn it on.

Cursor: a server from a project .cursor/mcp.json starts switched off. Open Cursor Settings → Customize → MCPs and turn on the switch next to sentinel-ir (its source is the project's .cursor/mcp.json). It then shows Connected and 3 tools. A server installed with the link below (user-level ~/.cursor/mcp.json) connected without this step. Keep sentinel-ir in only one of the two files: with both, Cursor may start the global one, which does not have the project's --exclude and --audit-log. Since 0.5.22 setup and doctor warn about it, and doctor --client cursor checks the global file when the project has no entry.

Getting a newer version

npx keeps the package it downloaded for a version or range (sentinel-ir-mcp@0.5, @0.2, ...) and keeps starting that copy, together with the sentinel-ir it got then, even when newer versions are on npm (measured with npm 10.8.2, 10.8.3, 10.9.9 and 11.21.2; on npm 10 --prefer-online and npm cache clean --force did not change it; other npm versions may refresh a range, a pinned version such as @0.5.8 never changes). The tag setup writes since 0.5.1 (@stable-0.5) is looked up again on every start instead. If a client still starts an old copy:

  1. Run npx -y sentinel-ir-mcp@stable-0.5 doctor. It prints the versions it runs and lists every cached copy with a sentinel-ir older than the version it needs, with its folder.
  2. Close the client app and delete those folders (npm 11 can also do it: npm cache npx rm <key>; npm 10 has no such command). Deleting the whole _npx folder in npm's cache also works (npm config get cache shows where it is; usually ~/.npm/_npx, on Windows %LocalAppData%\npm-cache\_npx); it removes all packages cached by npx, which are downloaded again when needed.
  3. Run npx -y sentinel-ir-mcp@stable-0.5 setup for your client and start the client again.

If doctor warns about min-release-age or before (npm.policy), an .npmrc (in the project, a parent folder or your npm config) tells npm to install only older releases, so @stable-0.5 starts an older version and deleting the cache does not help. npm config list in that folder shows which file sets it.

A folder that is literally named setup, doctor or guide must now be passed as ./setup (or an absolute path); the bare word is the command.

Upgrading from 0.3.x or older

Configs written by older versions pin sentinel-ir-mcp@0.3 (or @0.2) and keep running that line. 0.3.x has no native-code detection, and its parser stops working in long sessions (see 0.4.0 in CHANGELOG.md); 0.2.x also has no Python support. Run setup again for your client (it replaces only the "sentinel-ir" entry); doctor warns about an entry that still pins 0.3 or older. If the client still starts an old version, see Getting a newer version.

These links follow the Cursor and VS Code documentation. They were opened in VS Code 1.143 and Cursor 3.26 (see COMPATIBILITY.md). A link cannot know your project path, so it uses ${workspaceFolder}; if your client does not expand it, use setup instead.

Some sites (including GitLab and npm) may not open cursor:// or vscode: links; copy the link into the browser address bar or use setup. The links write "command": "npx". On Windows setup writes "command": "cmd", "args": ["/c", "npx", ...] instead, because some clients there do not find npx without a shell; doctor warns about a plain npx entry on Windows.

Manual setup

Pass the folder(s) the agent may read as arguments. Use absolute paths.

Claude Desktop

Settings → Developer → Edit Config opens claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):

json
{
  "mcpServers": {
    "sentinel-ir": {
      "command": "npx",
      "args": ["-y", "sentinel-ir-mcp@stable-0.5", "/Users/you/projects/my-app"]
    }
  }
}

Restart Claude Desktop afterwards.

Cursor

Project .cursor/mcp.json (or ~/.cursor/mcp.json for all projects). ${workspaceFolder} is the folder that contains .cursor/mcp.json. A project entry has to be switched on once in Cursor Settings → Customize → MCPs:

json
{
  "mcpServers": {
    "sentinel-ir": {
      "command": "npx",
      "args": ["-y", "sentinel-ir-mcp@stable-0.5", "${workspaceFolder}"]
    }
  }
}

Windsurf

Windsurf 3 (Devin Desktop) reads ~/.config/devin/mcp_config.json (Windows: %APPDATA%\devin\mcp_config.json); older versions read ~/.codeium/windsurf/mcp_config.json. Add the same entry as for Claude Desktop with your project's absolute path.

Other clients

Any MCP client that starts stdio servers works with command: "npx", args: ["-y", "sentinel-ir-mcp@stable-0.5", "<folder>"] (on Windows: command: "cmd", args: ["/c", "npx", "-y", "sentinel-ir-mcp@stable-0.5", "<folder>"]). Without folder arguments the server uses the client's MCP roots if the client offers them; if it offers none, only analyze_code works.

Excluding files

bash
npx -y sentinel-ir-mcp@stable-0.5 setup --client cursor --exclude secrets --exclude "*.min.js"
you writeexcludes
secretsevery file or folder named secrets, anywhere in the project, with everything inside
config/prod.jsonly this path, relative to the project folder
*.min.jsfiles by mask; * and ? stay within one name
generated/**/out** stands for any number of folders
  • Only additions: there is no ! to re-include something. Absolute paths, .. and the characters " & | < > ^ % ! are refused.
  • Windows \ works like /. On Windows and macOS letter case does not matter (SECRETS/a.js is excluded by secrets), on Linux it does.
  • The check uses the real path, so lib/../secrets/a.js, a symlink to an excluded file and a Windows short name (SECRE~1) are refused too. It is repeated when the file is opened.
  • analyze_code is not affected: it analyzes text the agent already has.

The exclusions only bind this server. An agent that can read files with other tools of its client is told about them, but this server cannot stop it.

Audit log

bash
npx -y sentinel-ir-mcp@stable-0.5 setup --client cursor --audit-log   # or answer "y" in setup
npx -y sentinel-ir-mcp@stable-0.5 log                                 # what the agent asked for
systemfolder
Windows%LOCALAPPDATA%\sentinel-ir-mcp\audit-log\
macOS~/Library/Logs/sentinel-ir-mcp/
Linux~/.local/state/sentinel-ir-mcp/audit-log/ (or $XDG_STATE_HOME)

--audit-log=<folder> uses another folder: a full path outside the project (the characters " & | < > ^ % ! are refused because Windows starts the server through cmd). Then read it with log --dir <folder>.

  • What is written: one JSON line per tool call in audit-YYYY-MM-DD.jsonl (local date): time, client name, tool, the path the agent asked for, the result (risk, analysisStatus, file counts, up to 20 critical/high file paths of a folder) or why it was refused (excluded, outside, not-found, too-large, hardlink, symlink, unsupported, not-a-file, not-a-folder, url, no-folders), and the duration. A line when the server starts. Since 0.5.21 the line is on disk before the agent gets the answer.
  • Which version of a file (0.4.5): for every file the server read, the SHA-256 of the exact bytes it analyzed: sha256 for analyze_file; for analyze_directory the folder line gets a call id and hashed count, and the hashes follow in "event": "hashes" lines (40 files each, same call id), so no line gets long. log shows the first 12 digits for files and the risky files of a folder; log --json has all of them. To check whether a file is still the one the agent saw, compare with certutil -hashfile <file> SHA256 (Windows), shasum -a 256 <file> (macOS) or sha256sum <file> (Linux). Pasted code (analyze_code) gets no hash: a very short snippet could be guessed from it. Since 0.5.12 the agent gets the same sha256 in the analyze_file answer and in every analyze_directory entry, so it can check that a file is still the one it saw before running or relying on it.
  • What is not written: source code. For analyze_code only the size in bytes, the language and the risk. Names of excluded files are not written either, only their count. Long values are cut to 300 characters.
  • Cleanup: day files older than 30 days are deleted; a day stops 1 MB below 50 MB with one line saying so, so parallel servers stay under 50 MB too. Other files in the folder are never touched.
  • Set by you only, like exclusions: the agent and the project cannot turn it on, off or move it. The log is never written inside the project.
  • Safe to read: a path with a newline cannot add a fake line (JSON escapes it), and log shows control and bidi characters as \u{1b}, so a path cannot recolor or rewrite your terminal.
  • Never breaks the tools: when the log cannot be written (disk full, no permission) the tools answer as usual and the server says so once on stderr; doctor reports it as [FAIL]. Several servers can share the folder: each line is one append, so lines do not mix.
  • doctor adds one line, doctor checked that the log can be written, and none of its own tool calls.
  • A day file that is a symlink, junction or hard link is not written to, on Windows too, so the log cannot be used to overwrite another file.
  • It records only what the agent asked this server for. Other file tools of your AI app are not in it.
  • Files are created readable by you only (0600, folder 0700; on Windows the folder in %LOCALAPPDATA% is private to your account).

Options

text
sentinel-ir-mcp [--exclude <name>]... [--audit-log[=<folder>]] [--max-file-bytes <n>] [--max-files <n>] [--time-budget-ms <n>] [folder ...]

  --exclude <name>       file or folder the file tools refuse (repeatable, max 100); see Excluding files
  --audit-log[=<folder>] keep a log of the tool calls (never source code); see Audit log

  --max-file-bytes <n>   largest file to analyze (default 1048576 = 1 MiB, max 2097152 = 2 MiB)
  --time-budget-ms <n>   analyze_directory starts no new file after this (default 30000, max 600000)
  --max-files <n>        default file limit for analyze_directory (default 50, max 500)

What the server can and cannot do

  • Reads only. The MCP server never writes project files, runs commands or opens network connections. It writes only the audit log when you turn it on (outside the project). The separate setup command writes only the client config file you confirm; doctor starts this package's own server. The only files it opens are .js/.mjs/.cjs/.jsx/.ts/.mts/.cts/.tsx/.py/.pyi/.rs files up to --max-file-bytes.
  • Only inside the allowed folders. Every path is resolved to its real path (symlinks followed) and must lie inside a folder given on the command line, or, without folder arguments, inside one of the client's MCP roots. ../, absolute paths elsewhere and symlinks pointing outside are refused, with the same answer whether or not the path exists (since 0.5.8).
  • Several folders. Every path in a result is a full path and analyze_directory lists the folders in allowedFolders (since 0.5.23). A relative path is taken from the allowed folder in which it exists; one that exists in more than one is refused as Ambiguous path (since 0.5.23; 0.5.22 took the first, older versions always the first folder). analyze_directory without path scans only the first folder and lists the others in otherFolders. setup writes one folder; add more to the server's args in the config by hand.
  • Local paths only. URLs (http://…, data:, mailto:, file:src/x.js), network paths (\\server\share\x.js, //server/share/x.js) and file://server/… are refused as Not a file path: … is a URL or as outside the allowed folders before any file system call, so Windows does not open an SMB connection to another machine (since 0.5.9). Local file:///… paths work.
  • Exclusions are yours. They come only from the command line the client starts (written by setup), never from the agent or from files in the project. Excluded paths are refused by analyze_file and counted, not named, in skipped.excluded.
  • analyze_directory skips node_modules, .git, hidden folders and every symlink, and stops after max_files files (truncated: true, the number left out in notScanned) or when the time budget is spent (timedOut: true, rest in notAnalyzed). A partial answer carries a warning: its riskCounts are not a result for the whole folder. Each file is checked again when it is opened: it must still be a regular file inside the allowed folders.
  • Hard links are refused. A hard link inside the folder can point to a file outside it, and the other names of a file cannot be found. So files with more than one hard link are refused (analyze_file error, skipped.hardlinks in analyze_directory). This also refuses harmless hard links, e.g. pnpm's in node_modules.
  • The IR is still untrusted text. Comments, string bodies and function bodies are not copied into it, so instructions hidden there do not reach the agent through the IR. It does contain identifiers and some literals from the code (route paths, module names, export names, env variable names). That reduces the prompt-injection surface; it does not remove it.
  • It is not a security scanner. The risk level comes from a fixed set of AST patterns in sentinel-ir; code that hides its behaviour (e.g. building a module name at runtime) can look harmless.

Measurements

The library's own published sources (sentinel-ir@0.1.3), read through analyze_file / analyze_directory over stdio. Tokens counted with gpt-tokenizer@4.0.4 (o200k_base encoding); other models' tokenizers give different numbers.

fileraw charsraw tokensIR charsIR tokens
src/ast-facts.js39,8778,439450120
src/sentinel-ir.js9,1232,084515133
src/tree-parser.js4,393891465121
examples/basic.js600150461120
all 4 via analyze_directory11,564317

The IR has a floor of roughly 120 tokens per file, so it does not pay off for very small files. analyze_file on src/ast-facts.js took about 160 ms per call (average of 10, Node 24, Linux cloud VM); the first call also loads the WebAssembly parser.

Long session (one server process over stdio, 6,000 analyze_code calls on the same 17.8 KB JavaScript file, about 107 MB in total, Node 24):

versioncalls with a different analysisStatus than the firstfirst such call
0.3.0 + sentinel-ir 0.3.11,0834,918
0.4.0 + sentinel-ir 0.4.20—

Dependencies

Three runtime dependencies: the official @modelcontextprotocol/sdk, zod (its schema peer dependency) and sentinel-ir (0.5.11 or newer; doctor fails when an older copy is loaded). With their own dependencies that is about 100 packages in node_modules; npm audit reported 0 vulnerabilities at release time (0.4.0: after updating body-parser to 2.4.0 in the lock file). Unlike sentinel-ir itself, this package is not dependency-free.

Development

sh
npm ci
npm test        # starts the real server over stdio and talks to it with the MCP SDK client

Tests cover the tool list and annotations, all three tools, refusals for ../, absolute paths, symlinks out of the folder, unsupported file types and size limits, MCP roots from the client, and the command-line options. setup/doctor tests run against temporary HOME/APPDATA folders: new file, keeping other servers and fields, backup, idempotent second run, invalid JSON left untouched, --dry-run, refused home/root folders, symlinked config, Claude Desktop/Windsurf macOS/Windows paths (simulated), a real MCP handshake, failing configs and old Node.js.

A second CI job runs on a real Windows runner (Node 20/22/24): the full test suite, the packed package with setup/doctor against the real %APPDATA%, starting the published package through npx, and the printed VS Code/Claude Code commands pasted into PowerShell 5.1, PowerShell 7 and cmd.exe. See COMPATIBILITY.md. On every push it runs on GitHub Actions in the mirror (.github/workflows/windows.yml); on GitLab it runs on release tags before publish, and by hand on other branches. The informational large-file size probe runs on release tags only.

Release: bump version in package.json and both version fields in server.json (a test checks they match), push a protected tag vX.Y.Z; GitLab CI tests and publishes to npm with provenance through npm trusted publishing (GitLab OIDC, no stored npm token). The GitLab mirror pushes the tag to GitHub, where .github/workflows/release.yml waits for npm, creates the GitHub release and publishes the tag's server.json to the MCP Registry (by hand: mcp-publisher login github and mcp-publisher publish).

Sponsor

sentinel-ir-mcp has one maintainer, Jakub (@jakcmencz). He decides what it should do, tests it on his own machines and approves every release. Most of the code is written by an AI coding agent working from his specs, and every change goes through the tests and CI described above. Sponsorship pays for that agent time, for CI and Linux, macOS and Windows test machines, and for the next language, Go.

Sponsor on GitHub

For company sponsorship, grants or integration, write to sentinel.ir.contact@gmail.com.

Contributing

Development, CI and npm releases run on GitLab. The GitHub repository is a mirror that GitLab updates on every push to main and every tag. Issues are welcome on either; a pull request opened on GitHub is applied on GitLab, and the mirror then brings it back.

License

Apache-2.0. See NOTICE.

Similar modules

Browse Code search