Docs chevron_right AI Agents

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.

Connect a coding agent to the Deslop MCP server · 1:03 · English narration and captions
Read the English transcript

Ask the agent before writing

Before asking my coding agent to write another helper, I ask it to check the project first. Here I am using pi with the Deslop connection enabled. I give it the existing file so the request is about the code I actually have.

Let the agent check Deslop

The agent reads the file and calls Deslop to look for similar code. This is a real tool call against the open project. I can see the request and the returned result in the conversation, instead of relying on the agent to guess.

Review the returned files

Deslop returns two matching files, and pi points me to them. That gives me an existing implementation to review before I create another copy. I read the file names and the reported locations, then check the source rather than stopping at the agent's summary.

Check the source yourself

I open the matching files side by side in Deslop. Now I can check the code and its differences myself. The agent helped me find a possible reuse; I still decide whether that implementation fits the change I want to make.

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.
duplicates Ranked clusters, worst first. Start with a small summary; narrow by path, language, or kinds. Omitted kinds inherit configuration, normally identical and nearly identical.
cluster-by-id Full member list for one cluster you are about to merge. Evidence belongs to compare-pair, never to a cluster.
compare-pair Why two specific occurrences were admitted as duplicates of each other.
merge-plan Read-only mechanical merge plan for a cluster, before you hand-edit.
rescan Force-refresh after large external changes.
session Session metadata; list the semantic models a provider advertises, or switch to one you picked.
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 install or target/release build. Building Deslop from source is for testing the change you just made; it is not a distribution channel. The repo deliberately ships no make install-binary target.

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, on any machine where Deslop came from Homebrew or Scoop. Do not put it in a checked-in .mcp.json or a shared team config: teammates who use the VS Code extension have nothing on $PATH, and the extension's absolute path differs by version and platform. Have each person register the server for themselves instead, with claude mcp add … -s user or their client's user-level config.

Two things to know:

  • There is no deslop mcp subcommand. The deslop CLI runs one-shot and CI audits only; MCP is served by the separate deslop-mcp binary.
  • Building from source does not put anything on $PATH. Only the release-locked installers do: brew, scoop, and the published curl installer, which pins a release and verifies its checksum. A cargo build is pinned to nothing.

The agent loop

The headline workflow is reactive, not batch:

  1. The agent proposes a change. Before it writes the new code, it calls find-similar over the proposed snippet.
  2. If find-similar returns a cluster above the similarity floor, the agent reuses the canonical occurrence or rewrites the call site.
  3. 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.
  4. The agent re-queries duplicates to confirm the cluster is gone. No re-run, no flag, no batch CLI invocation.

When MCP fails, the agent first reads an existing JSON report and checks its version, paths, and freshness. If none is usable, it runs the matching bundled deslop CLI to generate .deslop/deslop-report.json. Persisted caching is enabled by default unless repository configuration disables it, so subsequent scans reuse unchanged parse results. A snapshot cannot answer an unwritten-snippet query. The full startup and recovery procedure is on For AI.

Find similar code before writing with an AI coding agent · 1:02 · English narration and captions
Read the English transcript

Ask what is repeated

I ask pi to check the repeated code in this project before making a change. It calls Deslop and brings the result into the conversation. I start with one finding so the review stays small enough to understand and act on.

Read the files behind the result

I ask the agent for the files behind that finding. The reply shows where the repeated code lives and how many copies were found. I use those locations to guide the next step, rather than asking for a broad rewrite of the project.

Check before adding a helper

Before adding another helper, I ask pi to read the existing file and search for similar code. Deslop returns the matching files. This is the useful moment to spot something I can reuse, while there is still time to avoid writing another copy.

Review before accepting a change

I finish by opening the source comparison in the editor. I check that the proposed reuse preserves the behavior I need. After a focused change, I run the project's tests and review Deslop again instead of assuming the agent's first answer is enough.

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.