Semdex
Semdex
A local MCP server that gives AI coding assistants structured, queryable intelligence about a codebase.
Overview
Semdex (semantic + index) is a local MCP server that parses codebases into semantic chunks (functions, classes, interfaces), indexes them in SQLite with vector embeddings, and exposes MCP tools for LLM agents to query.
Think of it as an LSP, but for AI — instead of "go to definition" for humans, it's "find all relevant code" for an LLM.
Why Semdex?
Context windows are limited. LLMs can't fit an entire codebase in context. Semdex finds exactly the relevant code and feeds only that to the model.
Structure-aware, not grep. Traditional search matches text; Semdex understands code structure — functions, classes, methods, interfaces — and their relationships.
Runs locally. No cloud dependencies, no API keys, no data leaving your machine. Works offline.
Editor-agnostic. Speaks MCP, the standard protocol for AI tool integration. Works with any MCP-compatible client.
Status
⚠️ Early Development — This project is in the design and planning phase. No source code has been written yet. See CONTRIBUTING.md if you'd like to help build it.
Technology Stack
Layer | Choice | Constraint |
Runtime | Node.js 22 LTS | Do NOT use APIs that require 23+ |
Language | TypeScript 5.x | Strict mode, no |
CLI | Commander.js | One entry point: |
AST | Tree-sitter WASM | NOT native bindings. |
DB | better-sqlite3 + sqlite-vec |
|
Hashing | hash-wasm |
|
Embedding | Transformers.js v3.x |
|
Watcher | Chokidar |
|
Telemetry | OpenTelemetry JS | Custom |
MCP SDK | @modelcontextprotocol/sdk | v1.29.0 ( |
Testing | Vitest | In-memory SQLite for DB tests, no external deps |
Architecture
src/
├── cli.ts # Commander.js entry point
├── server.ts # McpServer + tool registration
├── indexer/
│ ├── parser.ts # Tree-sitter WASM → AST
│ ├── chunker.ts # AST → canonical semantic nodes
│ ├── hasher.ts # XXH3 content hashing
│ └── embedder.ts # Transformers.js pipeline
├── db/
│ ├── connection.ts # better-sqlite3 + sqlite-vec
│ ├── schema.ts # Migration framework (PRAGMA user_version)
│ └── queries.ts # Typed SQL query builders
├── tools/
│ ├── symbol.ts # symbol.find, symbol.callers
│ ├── search.ts # search.semantic, search.lexical
│ ├── repo.ts # repo.manifest, repo.architecture
│ └── index.ts # index.status, code.read
└── telemetry/
├── tracer.ts # OpenTelemetry setup
└── file-exporter.ts # Custom FileSpanExporter (~50 lines)Getting Started
📝 Coming soon. Setup instructions will be added once initial source code is written.
Planned workflow:
sdx init # Initialize index in current repo
sdx index --dry-run # Preview what would be indexed
sdx serve # Start MCP server (stdio transport)Key Commands
npm run build # tsc
npm run dev # tsx src/cli.ts
npm test # vitest
npm run lint # eslint src/
npm run typecheck # tsc --noEmit
sdx init # Initialize index in current repo
sdx index --dry-run # Preview what would be indexed
sdx serve # Start MCP server (stdio transport)
sdx bench # Run benchmarks
sdx bench --sla # Check against SLA targetsDesign Principles
Never fail silently. Every degraded mode must log a warning and produce useful results.
Lexical fallback beats an error. If embeddings fail, FTS5 is better than nothing.
Partial index beats no index. One broken file should never block the whole repo.
Content-addressable everything. Never recompute what hasn't changed.
Explicit over implicit. Schema migrations, model switches — all opt-in, never automatic.
Local only. No cloud, no telemetry phoning home, no API keys required.
Key Constraints
all-MiniLM-L6-v2 max input: 256 tokens. Chunks longer than this must be split for embedding.
sqlite-vec max dimensions: 8192. We use 384 — well within limits.
Node 22 LTS only. No
node:sqlite(requires 23.5+). Usebetter-sqlite3.WASM grammars only. No native Tree-sitter bindings — portable across macOS/Linux/Windows.
MCP SDK v1.29.0 only. v2 is alpha. Migration is post-MVP.
Contributing
Contributions are welcome! See CONTRIBUTING.md for development setup, code conventions, and the pull request process.
Before contributing, please read our Code of Conduct and Security Policy.
License
MIT © 2026 Raghav Wahi
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/raghavwahi/semdex-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server