AI Agents
Deslop tells your coding agent when similar code already exists, before it writes another copy. The agent asks; Deslop answers from the live analysis of the repository the agent is working in. Nothing is scheduled, nothing is batched, and no one has to remember to run a scan.
This page is for you, the human wiring it up. It covers what the MCP server offers and how to connect each client to it.
The instructions for the agent itself — the rule it follows before writing code, the similarity thresholds, the CLI fallback when MCP is unavailable, and how to parse the report — are on For AI. That page is written in the second person and addressed to the machine. Point your agent at that URL.
The paste-ready rule block for your project's AGENTS.md / CLAUDE.md is in the agent recipe. It works with Claude Code, Cursor, Copilot, Continue, and Codex.
The MCP tools, all live
Only find-similar belongs in the authoring inner loop. Everything else is a read-only report query or a config tool you reach for on demand, so the agent's working context stays lean instead of carrying a wall of tool output.
| Tool | When to call it |
|---|---|
find-similar |
Before writing new code — does an equivalent already exist? This is the prevention tool. |
top-offenders |
Worst clusters in the workspace, worst first. Start cleanup here. |
cluster-by-id |
Full member list and signals for one cluster you are about to merge. |
report-for-file |
Per-file cluster slice. |
report-for-range |
Per-selection cluster slice. |
report-get |
Whole-workspace report. |
report-query |
Filtered query over the report. |
rescan |
Force-refresh after large external changes. |
list-embedding-models |
Models the provider advertises. |
set-embedding-model |
Switch the same behavior, different code [Type-4] semantic model at runtime. |
session-config |
Inspect the running server's effective config. |
schema-doc |
Authoritative JSON schema for every response. Call once per session, not per response. |
Every response is computed against the live workspace state. The editor server holds the live report in memory and refreshes it on every change (debounced, with a hard cap); the MCP server reads that live state over the local IPC endpoint on the next tool call. macOS and Linux use .deslop/cache/deslop.sock; Windows uses a token-gated TCP loopback endpoint discovered through .deslop/cache/deslop.port. There is no batch step.
Wire deslop-mcp into your client — point at the VSIX-bundled binary
deslop-mcp ships inside the VS Code extension VSIX. After you install the extension, every external MCP client (Claude Code, Claude Desktop, Codex, Cursor, Continue) should reference the unpacked VSIX binary by absolute path so the agent runs the exact binary the extension ships — version-locked to the VSIX, no PATH drift.
Once the extension is installed from the Marketplace, the binary lives at:
~/.vscode/extensions/nimblesite.deslop-live-<VERSION>-<platform>/bin/<platform>/deslop-mcp
<platform> is darwin-arm64, darwin-x64, linux-x64, linux-arm64, or win32-x64. <VERSION> is the installed extension version — bump it whenever you update the VSIX.
Claude Code
claude mcp add deslop -s user -- \
~/.vscode/extensions/nimblesite.deslop-live-<VERSION>-darwin-arm64/bin/darwin-arm64/deslop-mcp \
--root .
Codex (~/.codex/config.toml)
[mcp_servers.deslop]
command = "/Users/you/.vscode/extensions/nimblesite.deslop-live-<VERSION>-darwin-arm64/bin/darwin-arm64/deslop-mcp"
args = ["--root", "."]
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"deslop": {
"command": "/Users/you/.vscode/extensions/nimblesite.deslop-live-<VERSION>-darwin-arm64/bin/darwin-arm64/deslop-mcp",
"args": ["--root", "/absolute/path/to/your/repo"]
}
}
}
Do not point an MCP client at a
cargo installortarget/releasebuild. Building Deslop from source is for testing the change you just made; it is not a distribution channel. The repo deliberately ships nomake install-binarytarget.
Homebrew / Scoop CLI users — point at the bare deslop-mcp on $PATH
If you installed the CLI with brew install nimblesite/tap/deslop or scoop install deslop, the package also puts deslop-mcp and deslop-lsp on your $PATH alongside deslop — the tap formula and Scoop manifest install all three binaries, version-locked to the release. No VSIX, no extension directory, no absolute path. Use the bare command:
claude mcp add deslop -s user -- deslop-mcp --root .
{
"mcpServers": {
"deslop": {
"command": "deslop-mcp",
"args": ["--root", "."]
}
}
}
The same "command": "deslop-mcp" form works in Codex (~/.codex/config.toml), Cursor, and Continue. It is the right value for a checked-in .mcp.json or shared team config — every machine resolves it through $PATH.
Two things to know:
- There is no
deslop mcpsubcommand. ThedeslopCLI runs one-shot and CI audits only; MCP is served by the separatedeslop-mcpbinary. - Building from source does not put anything on
$PATH. Onlybrew/scoopdo. Those package managers version the binary lock-step with the release; acargo builddoes not.
The agent loop
The headline workflow is reactive, not batch:
- The agent proposes a change. Before it writes the new code, it calls
find-similarover the proposed snippet. - If
find-similarreturns a cluster above the similarity floor, the agent reuses the canonical occurrence or rewrites the call site. - As the agent edits files, the file watcher fires and the analysis refreshes. The MCP server serves the new state on the next tool call.
- The agent re-queries
top-offendersorreport-for-fileto confirm the cluster is gone. No re-run, no flag, no batch CLI invocation.
When MCP is not available — CI, a cold-cache audit, or an agent with no MCP client — the loop degrades to the deslop CLI, which runs the identical pipeline and emits the identical JSON. The incremental cache is on by default, so a re-run after an edit only re-parses the files that changed. The step-by-step fallback is on For AI.
What Deslop deliberately does not do
- It does not rewrite your code. Deslop finds, ranks, compares, and prevents duplication; extraction is your call.
- It does not fail CI unless you set a threshold yourself.
- It does not assume "near-miss = bug." Some duplication is intentional (test fixtures, bootstrapping). Deslop reports; you decide.
- It does not talk to the network unless you explicitly pick a remote embedding model.