dfine-semantic
OfficialSemantic code search and indexing MCP server: it embeds a project locally and answers natural-language code questions, with optional near-duplicate detection.
Use
semantic_searchto find code by meaning from one natural-language sentence and get rankedfile:linereferences; defaults to.ts/.tsx, can include other indexed extensions, set similarity threshold/limit, or return full chunk content.Use
index_projectto build or refresh a project index incrementally; can force a clean rebuild, choose extensions, and enable/disable the duplicate index.Use
index_statusto list indexed projects with file, chunk, and size counts, or check one project.Use
find_duplicatesto list similar code candidates for files or line ranges; covers.ts,.tsx,.js,.jsx,.mjs, skips tests/specs/.d.ts, supports thresholds and exclusions, and is off per project until enabled.Run locally over MCP stdio, storing indexes and the model locally; searches refresh changed files and long runs can report progress.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dfine-semantic where do we handle API errors?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@dfine-io-gmbh/semantic-mcp
Semantic code search as an MCP server. It embeds a project's code into a
local SQLite vector store and answers natural-language questions that a plain grep cannot match.
Everything runs locally once the model is downloaded.
How it works
Code is split into chunks and embedded with
jinaai/jina-embeddings-v2-base-code(768 dimensions) through@huggingface/transformers.Vectors live in one local SQLite database per project (
sqlite-vec).The server speaks MCP over stdio, revision 2026-07-28 and the 2025 revisions, and works with any MCP client, for example Claude Code or Cursor.
Each search first re-indexes the files that changed since the last one. If that would take longer than about ten minutes, clients on MCP 2026-07-28 that support forms ask you first. Other clients re-index without asking.
Long runs report progress to clients that ask for it. Claude Code and other clients that reset their timeout on progress keep such a call open until it finishes.
Related MCP server: code-memory-rs
Requirements
Node.js 22 or newer
Git on the
PATH. Every indexed root must be inside a git work tree, because files are listed withgit ls-files.Network access to download the model (about 640 MB) into
~/.dfine-semantic/modelswhen it is not there yetbetter-sqlite3andsqlite-vecship prebuilt binaries for macOS (arm64, x64), Linux (x64, arm64) and Windows (x64). Other targets build from source and need a C/C++ toolchain.
Use it with an MCP client
No install step is needed: npx fetches and runs the server. Add it to your MCP client config
(.mcp.json for Claude Code project scope, or ~/.claude.json for user scope):
{
"mcpServers": {
"dfine-semantic": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@dfine-io-gmbh/semantic-mcp"]
}
}
}The server sends short usage instructions to the client when it connects.
Tools
Name | Purpose |
| Natural-language query, returns ranked |
| Index or refresh a project root, embedding only what changed |
| List indexed projects with file, chunk and size counts |
| List similar code for files or line ranges (opt-in, see below) |
semantic_search and find_duplicates also return their results as structured data, described by
each tool's output schema. Its status field tells an agent that duplicate search is off for a
project, which is not the same as finding no duplicates.
semantic_search covers .ts and .tsx by default. Pass include (for example [".md", ".vue"])
to search other indexed file types. index_project indexes the allow-listed extensions you pass
and keeps that list, so a later call without extensions indexes the same file types.
Duplicate search (opt-in)
find_duplicates is off until you turn it on for a project. It needs a second index of short code
windows, and building that index takes time and disk space, so projects that never use it never pay
for it.
Ask your agent to run
index_projectwithduplicates: trueonce for the project. On an indexed repository with about 1,400 TypeScript files, this takes about 50 minutes and 75 MB. A project without a search index yet needs about 35 minutes more.Ask for duplicates of files or line ranges, for example
src/a.ts:10-40, and your agent callsfind_duplicates. Searches and index runs keep the windows of edited files current. When a result says windows are missing, runindex_projectagain.Run
index_projectwithduplicates: falseto switch it off and delete the duplicate index.
Each result pairs a range of your file with a similar range in another file. It comes with a
similarity score and a band: likely from 0.88, check from 0.80 up to 0.88. The tool only lists
candidates, and your agent reads both ranges before it merges anything. The tool description tells
the agent what counts as a duplicate: both ranges follow the same rule, or a block repeats with only
names, data or texts swapped. A shared call or a short idiom does not count.
In a measured TypeScript project with about 1,400 files, the default threshold of 0.80 listed about
three in four of the real duplicates, and about half scored 0.88 or more. Short functions get an
entry of their own, so a word-for-word copy of a five-line function is found as well. Pass
threshold: 0.88 to list only likely pairs.
The tool covers .ts, .tsx, .js, .jsx and .mjs files and skips tests, specs and .d.ts
files. Pass exclude with folders such as src/generated to leave generated or vendored code out.
Configuration
Variable | Default | Purpose |
|
| Extra absolute roots the server may index (comma-separated) |
|
| Where the indexes and the model are stored |
The working directory counts as a root unless it is / or your home folder. Indexes are keyed by
project path and survive upgrades. Run index_project with force: true for a clean rebuild.
Upgrading from 0.1.4
In projects with duplicate search on, run
index_projectonce. It rebuilds the duplicate index with the new entries for short functions, which takes about as long as the first build. Until thenfind_duplicateskeeps working with the old index.find_duplicatesnow lists pairs from 0.80 instead of 0.88. Passthreshold: 0.88for the shorter list.
Upgrading from 0.1.3 or older
Restart every session that still runs 0.1.3 or older. An old server cannot read an upgraded index.
The model downloads once more into its new folder. Copies inside old
npxcaches can be deleted.Files are now split into chunks differently. Searches keep using your existing index, and clients that support forms offer a rebuild. You can also run
index_project.find_duplicatesis new and stays off until your agent runsindex_projectwithduplicates: true.
Security
See SECURITY.md for the security model and how to report a vulnerability.
Local development
pnpm install
pnpm build # tsc
pnpm lint:dlint # dlint, the dfine linter on the TypeScript compiler
pnpm check # tsc, dlint and prettier
pnpm startLicense and support
MIT, see LICENSE. Questions or issues: support@dfine.io or the issue tracker.
Available Tools
4 toolsfind_duplicatesFind duplicate codeARead-onlyIdempotent
List code in other files that nearly matches the given files or line ranges. Use it in reviews and refactors - pass changed line ranges ("src/a.ts:10-40") for sharper pairs. Treat every pair as a candidate - read both ranges before you call it a duplicate. Expect it to be off per project - ask the user before you turn it on. Turn it on with index_project duplicates: true - the first build can take over an hour on large projects. Covers .ts, .tsx, .js, .jsx, .mjs files; skips tests, specs and .d.ts files.
Inputs: files (required), path, limit, exclude, +1 more. Returns: notes, pairs, status
index_projectIndex a projectADestructiveIdempotent
Build or refresh the semantic index of a project root. Embeds only new, edited or outdated files and drops deleted ones. Pass duplicates: true once to enable find_duplicates for this project.
Inputs: path (required), force, duplicates, extensions.
index_statusIndex statusARead-onlyIdempotent
List indexed projects with file, chunk and size counts - pass path for one project.
Inputs: path.
semantic_searchSemantic code searchARead-onlyIdempotent
Find code by meaning in an indexed project. Ask one full natural-language sentence, not keywords. Good: "How does the app validate share token permissions?" Bad: "shareToken auth validate". Returns file:line references by default - read the files you need. Searches .ts and .tsx unless include adds other indexed extensions.
Inputs: query (required), path, limit, include, +2 more. Returns: notes, status, hasMore, results
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: semantic_search retrieves code, index_project builds/refreshes the index, index_status reports state, and find_duplicates detects near-matches. There is no overlap between searching, indexing, status, and duplicate detection.
All names use snake_case consistently, but the internal pattern varies slightly (adjective_noun, noun_verb, noun_noun, verb_noun). Still highly readable and predictable as a set.
Four tools is lean but well-matched to a focused semantic-search-and-indexing server. Each tool earns its place without redundancy, though the surface is on the thin side.
The core lifecycle (index build, status, search, duplicate detection) is covered. Minor gaps exist, such as removing or clearing an index and per-file reindexing, but agents can work around these via index_project.
Maintenance
Related MCP Connectors
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Ask how your codebase works. Hosted codebase intelligence for repos indexed on repowise.dev.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides semantic code search over codebases using local embeddings with natural language queries. Supports hybrid search, file watching, and respects .gitignore.117MIT
- FlicenseNot gradedqualityDmaintenanceEnables local semantic code search across repositories using natural language, with AST-aware chunking and hybrid vector/FTS5 retrieval.-
- AlicenseAqualityBmaintenanceEnables semantic and keyword search over a local codebase by chunking source files along function and class boundaries, embedding them offline, and fusing vector and BM25 results. Runs entirely on your machine in a single SQLite file, so AI coding agents can find relevant code with no API keys, telemetry, or cloud calls.711 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables coding agents to search a locally indexed repository and get back a token-budgeted deck of ranked code and doc snippets instead of a full-tree grep dump, with lexical, semantic, and prose-answering modes plus index status reporting. Runs fully offline for lexical queries and optionally uses an OpenAI-compatible provider for semantic or ask modes.MIT