sem-mcp

by ataraxy-labs

Not rated
GitHub

About

Entity-level code intelligence for agents

Details

Author
ataraxy-labs
Categories
Developer Tools

Setup

Install sem-mcp in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/ataraxy-labs/sem

Follow the installation instructions in the repository README, then restart your MCP client.

Part of theAtaraxy Labsstack— agent-native infrastructure for software development. See also:weave(entity-level git merge driver) ·inspect(semantic code review) ·opensessions(tmux sidebar for coding agents).

Read the manifesto:https://ataraxy-labs.com/#thesis· Essays:https://ataraxy-labs.com/blogs· LLMs:https://ataraxy-labs.com/llms.txt

Semantic version control built on Git.
Instead of lines changed, sem tells you what entities changed: functions, methods, classes.

Why sem?·Install·Commands·Agents (MCP)·Cloud consent·Releases

sem is a semantic version control tool that works on top of Git. It parses your code with tree-sitter, extracts every function, class, and method as an entity, and diffs at the entity level instead of lines. This means you see "functionblahhwas modified" instead of "lines x-y changed."

Cloud-backed queries are opt-in per repo: logging in does not upload a repo or send a query. See thecloud consent flowfor the public/private repo states, preview screen, local audit log, and forget controls.

curl -fsSL https://raw.githubusercontent.com/Ataraxy-Labs/sem/main/install.sh | sh

Or install the npm wrapper intonode_modules:

npm install --save-dev @ataraxy-labs/sem

With Bun, trust the package so itspostinstallscript can download the binary:

bun add -d @ataraxy-labs/sem bun pm trust @ataraxy-labs/sem

Once installed, update to the latest release any time:

cargo install --git https://github.com/Ataraxy-Labs/sem sem-cli
docker build -t sem . docker run --rm -it -u "$(id -u):$(id -g)" -v "$(pwd):/repo" sem diff

GNU Parallel ships asembinary (/usr/bin/sem) as a symlink toparallel. If you have both installed, they'll collide. Runsem --versionto check which one you're using. (#77)

# Option 1: alias in your shell profile (~/.bashrc, ~/.zshrc) alias sem="$HOME/.cargo/bin/sem" # Option 2: make sure cargo bin comes first in PATH export PATH="$HOME/.cargo/bin:$PATH" # Option 3: if installed via Homebrew export PATH="$(brew --prefix)/bin:$PATH"

If you installed via npm/bun, the binary lives innode_modules/.bin/semand is invoked throughnpx semorbunx sem, which avoids the conflict entirely.

Works in any Git repo. No setup required. Also works outside Git for arbitrary file comparison.

sem stores its SQLite entity cache outside the repository, under the OS cache directory by default. SetSEM_CACHE_DIR=/path/to/cacheto override the cache root; repo-local overrides are ignored so cache files do not dirty the working tree.

Entity-level diff with rename detection, structural hashing, and word-level inline highlights.

# Semantic diff of working changes sem diff # Staged changes only sem diff --staged # Specific commit sem diff --commit abc1234 # Commit range sem diff --from HEAD~5 --to HEAD # Verbose mode (word-level inline diffs for each entity) sem diff -v # Plain text output (git status style) sem diff --format plain # JSON output (for AI agents, CI pipelines) sem diff --format json # Markdown output (for PRs, reports) sem diff --format markdown # Compare any two files (no git repo needed) sem diff file1.ts file2.ts # Read file changes from stdin (no git repo needed) echo '[{"filePath":"src/main.rs","status":"modified","beforeContent":"...","afterContent":"..."}]' \ | sem diff --stdin --format json # Only specific file types sem diff --file-exts .py .rs

Cross-file dependency graph shows what breaks if an entity changes.

# Full impact analysis sem impact authenticateUser # Direct dependencies only sem impact authenticateUser --deps # Direct dependents only sem impact authenticateUser --dependents # Affected tests only sem impact authenticateUser --tests # JSON output sem impact authenticateUser --json # Disambiguate by file sem impact authenticateUser --file src/auth.ts # Include default-excluded paths such as generated, fixture, vendor, benchmark, and build trees sem impact authenticateUser --no-default-excludes

Entity-level blame showing who last modified each function, class, or method.

sem blame src/auth.ts # JSON output sem blame src/auth.ts --json

Track how a single entity evolved through git history.

sem log authenticateUser # Verbose mode (show content diff between versions) sem log authenticateUser -v # Limit commits scanned sem log authenticateUser --limit 20 # JSON output sem log authenticateUser --json

With no entity,sem loganalyzes recent repo history at the entity level:hotspots(most-changed functions/classes, with author counts) andco-change pairs(entities that repeatedly change in the same commits — "if you touch one, don't forget the other"):

sem log # repo hotspots + co-change pairs (last 50 commits) sem log --limit 200 # deeper history sem log --file src/auth.ts # scoped to one file sem log --json # full data

List all entities under a file or directory path. No path is the same as..

sem entities sem entities . sem entities src/auth.ts # JSON output sem entities --json sem entities src/auth.ts --json # Include default-excluded paths such as generated, fixture, vendor, benchmark, and build trees sem entities --no-default-excludes

Token-budgeted context for LLMs: the entity, its dependencies, and its dependents, fitted to a strict content token budget. When the target signature itself does not fit, JSON output reportstarget_omitted: true.

sem context authenticateUser # Custom token budget sem context authenticateUser --budget 4000 # JSON output sem context authenticateUser --json # Include default-excluded paths such as generated, fixture, vendor, benchmark, and build trees sem context authenticateUser --no-default-excludes

Replacegit diffoutput with entity-level diffs. Agents and humans get sem output automatically without changing any commands.

Nowgit diffshows entity-level changes instead of line-level. No prompts, no agent configuration needed. Everything that callsgit diffgets sem output automatically. Also installs a pre-commit hook that shows entity-level blast radius of staged changes.

On macOS and Linux,sem setupalso wires sem into your Claude Code sessions (free, local, no login): awarm resident graphso structural queries answer in single-digit milliseconds instead of rebuilding each time, andprompt-time contextso the code an agent would otherwise forage for arrives at the start of the turn. It edits~/.claude/settings.jsonidempotently, backs it up first, and leaves any hooks you already have untouched.

To disable and go back to normal git diff (also removes the session hooks):

Entity-level diffs on every pull request

Add the GitHub Action and every PR gets one sticky comment showing which functions, classes, and methods changed — updated in place on each push, and calling out cosmetic-only PRs (formatting/comments) explicitly:

# .github/workflows/entity-diff.yml name: Entity diff on: pull_request permissions: contents: read pull-requests: write jobs: entity-diff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: Ataraxy-Labs/sem/action@v0.15.1

No config, no API keys, never fails your build. Seeaction/for details.

Cloud acceleration (for scale and teams)

Local is always free and, aftersem setup, always warm — the resident graph keeps your repo hot on your own machine, so day-to-day queries are instant with no login. You do not pay to make your laptop fast.

Cloud is for what a laptop can't do. On a very large monorepo the first local graph build can take a few seconds; a shared team graph shouldn't be rebuilt per developer; and CI wants the graph without checking anything out.sem loginconnects those cases to sem cloud, which keeps a warm, pre-built graph for your registered repos and serves the heavy queries from it (on a large repo like deno, animpactquery is ~86ms from the cloud vs ~573ms rebuilt locally).

sem login # GitHub device flow, one time sem impact myFunc --file src/foo.rs # served from the cloud's warm graph

- Not logged in, or the cloud is unreachable? sem computes locally and prints the exact same output. No failures, no difference in results.
- SEM_LOCAL=1forces local computation even when logged in.
- Small repos see no change, local is already fast. The win is for large codebases where rebuilding the graph each time is the bottleneck.

32 programming languages with full entity extraction via tree-sitter:

Everything else falls back to chunk-based diffing.

Custom extensions and extensionless files

For files with non-standard extensions, create a.semrcin your project root:

sem also reads.gitattributespatterns (diff=andlinguist-language=) if you already have those set up..semrctakes priority when both define the same extension.

For files with no extension at all, sem detects the language automatically from content (imports, declarations, shebang lines, vim modelines). This covers 19 languages with no config needed.
- Exact ID match— same entity in before/after = modified or unchanged
- Structural hash match— same AST structure, different name = renamed or moved (ignores whitespace/comments)
- Fuzzy similarity— >80% token overlap = probable rename

This means sem detects renames and moves, not just additions and deletions. Structural hashing also distinguishes cosmetic changes (whitespace, formatting) from real logic changes.

sem mcpstarts aModel Context Protocolserver over stdin/stdout. It's not a command you run and read yourself: it's a server your coding agent launches in the background so it can ask sem questions while it works. That's the reasonmcplives alongside the normal commands. The agent gets 6 tools, all entity-level:sem_impact,sem_context,sem_diff,sem_entities,sem_blame,sem_log.

Why an agent wants these: instead of reading whole files and burning tokens, it can ask "what breaks if I changesubmitOrder" (sem_impact) or "give me just the context to refactor this function" (sem_context) and get a precise answer from the dependency graph.

Add it once, then talk to your agent normally. It calls the tools on its own.

Or one command that also installs the skill, so the agent knowswhento reach for sem:

Cursor, Claude Desktop, or any client with anmcpServersconfig:

{ "mcpServers": { "sem": { "command": "sem", "args": ["mcp"] } } }

Ifsemisn't on the agent's PATH, use the absolute path to the binary. No separate install is needed:sem mcpships in the same binary as every other command.

{ "summary": { "fileCount": 2, "added": 1, "modified": 1, "deleted": 1, "moved": 0, "renamed": 0, "reordered": 0, "binary": 0, "orphan": 0, "total": 3 }, "changes": [ { "entityId": "src/auth.ts::function::validateToken", "changeType": "added", "entityType": "function", "entityName": "validateToken", "startLine": 12, "endLine": 18, "oldStartLine": null, "oldEndLine": null, "filePath": "src/auth.ts" } ], "binaryChanges": [] }

The named change-type buckets (added,modified,deleted,moved,renamed,reordered) always sum tototal.orphanis a cross-cutting metadata count for module-level changes, and those changes are already included in the named change-type buckets.

sem-core can be used as a Rust library dependency:

[dependencies] sem-core = { git = "https://github.com/Ataraxy-Labs/sem", version = "0.5" }

Used byweave(semantic merge driver) andinspect(entity-level code review).

- tree-sitterfor code parsing (native Rust, not WASM)
- git2for Git operations
- rayonfor parallel file processing
- xxhashfor structural hashing
- Plugin system for adding new languages and formats

sem collects anonymous usage data: the command name (e.g.diff,impact), CLI version, and operating system. Nothing else — no code, file paths, repo names, or user identity. Events are batched locally and sent in the background, so commands never wait on the network.

export SEM_NO_TELEMETRY=1 # or DO_NOT_TRACK=1

Want to add a new language? SeeCONTRIBUTING.mdfor a step-by-step guide.

Automate Google Jules, the AI coding assistant, for tasks like code reviews, repository management, and AI-powered development workflows.

Token-efficient MCP server for GitHub source code exploration via tree-sitter AST parsing

Code intelligence MCP server - PageRank, blast radius, co-change, hotspots, clone detection across 34 languages in a single Rust binary.

Refactor TypeScript and JavaScript codebases using ts-morph. Supports renaming symbols and files, moving symbols, and searching for references.

MCP server that gives AI coding agents real-time npm & PyPI package versions, metadata, and dependency info.

Integrates with the Gerrit code review system to review code changes and details.

Make git commits on behalf of AI to track AI contributions in your codebase.

Browse GitHub repositories, explore directories, and view file contents.

AI drafts the commits, you decide what ships. GitInProgress lets your AI read your uncommitted working tree and propose how to split it into focused commit candidates — each with a draft commit message. Nothing lands in git history until you review and approve; the AI never commits on its own.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.