modex (module expert / modernization expert) is an MCP server that makes LLMs great at writing modern, idiomatic Go code.
It indexes Go standard library and project dependency documentation into a local SQLite FTS5 database, so LLMs can verify that APIs exist before using them — eliminating dependency hallucination, version skew, and stale idioms.
LLMs often generate Go code that:
- References functions or types that don't exist in the installed version
- Uses deprecated patterns superseded by newer stdlib additions
- Invents method signatures from memory rather than checking the actual API
modex gives the model a local, searchable index of real documentation — the same docs go doc would show — so it can look before it writes.
- Full-text search over stdlib + project dependency docs (FTS5, porter stemming)
- Background indexing with progress tracking — no blocking the model
- Dedup — packages with unchanged content/version are skipped on re-index
- Diagnostics orchestration — build/outdated/security/modernize checks via one tool
- Modernization apply mode — run
go fixchanges with dry-run support - Transports — stdio and streamable HTTP (recommended: run as persistent HTTP service)
- Pure-Go SQLite — no CGo, no system libraries required
| Tool | Description |
|---|---|
ping |
Health check — returns pong. |
register_project |
Register a Go project directory for indexing. Validates go.mod exists and starts background indexing of stdlib + all project dependencies. |
get_index_status |
Check indexing progress for a registered project. Returns phase, total/indexed/skipped/failed counts. |
reindex_project |
Restart indexing for a registered project (cancels any active indexing first). |
search_docs |
Search indexed docs with modes auto, text, symbol, or fts5, plus optional package/kind/parent filters. |
get_diagnostics |
Run diagnostics on a project. Categories: build, outdated, security, modernize (all categories by default). |
apply_modernize |
Apply go fix modernizations with optional selective fixers, aggressive, and dry_run modes. |
prompts/coding_modern_go.md contains a system prompt for writing modern, idiomatic Go code with modex.
Prerequisites: Go 1.26+ (modex uses go fix modernizers added in 1.26; it can index projects built with any Go version)
Build from source:
git clone https://github.com/0xCarbon/modex
cd modex
go build -o modex ./cmd/modexOr install directly:
go install github.com/0xCarbon/modex/cmd/modex@latestmodex is designed to run as a persistent HTTP service — start it once and connect from any number of Claude sessions.
modex --transport http --addr 127.0.0.1:3838The MCP endpoint is served at the root path, e.g. http://127.0.0.1:3838/mcp.
For single-session use (e.g. Claude Desktop on macOS/Windows):
modex --transport stdioThe index is stored at ~/.cache/modex/modex.db by default. Override with --db:
modex --db /path/to/modex.dbAdd modex as a global MCP server so it's available in every project:
claude mcp add --transport http modex http://127.0.0.1:3838/mcpOr edit ~/.claude.json directly — add to the top-level mcpServers:
{
"mcpServers": {
"modex": {
"type": "http",
"url": "http://127.0.0.1:3838/mcp"
}
}
}For stdio transport, add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"modex": {
"command": "modex"
}
}
}-
Register your project once:
register_project(project_path="/path/to/your/project") -
Indexing runs in the background. Check progress:
get_index_status(project_path="/path/to/your/project") -
Once
phaseisready, search docs before writing code:search_docs(query="bytes.Buffer.Write", mode="symbol") -
Run diagnostics when needed:
get_diagnostics(project_path="/path/to/your/project", categories=["build","security"]) -
Apply modernizations (or preview with
dry_run=true):apply_modernize(project_path="/path/to/your/project", dry_run=true)
cmd/modex/ main entry point, flag parsing, transport setup
internal/
db/ SQLite wrapper, FTS5 schema, auto-sync triggers
diagnostics/ build, outdated, security, modernize orchestration
docs/ go/doc extraction, background indexer, progress tracking
server/ MCP server, tool handlers
prompts/ coding_modern_go.md system prompt
Storage: SQLite with FTS5 virtual table backed by a docs content table. Auto-sync triggers keep FTS5 in sync with INSERT/DELETE/UPDATE operations without any manual management.
Indexing pipeline:
- Enumerate stdlib and project packages (lightweight
NeedName|NeedModule) - For each non-deduped package: full load with syntax, extract via
go/doc, insert in transaction
Dedup: SHA256 hash of packagePath@moduleVersion. Local packages (no version) use a content fingerprint of their source files instead.
# Build
go build ./...
# Fast tests (skips integration tests that index stdlib ~30s)
go test -short ./...
# All tests
go test ./... -timeout 10m
# Specific packages
go test ./internal/db/... -v
go test ./internal/docs/... -v
go test ./internal/server/... -v- MODEX-001: Core MCP server (ping, rate limiting, concurrency middleware)
- MODEX-002: Documentation indexing (SQLite FTS5, go/doc extraction, background indexer)
- MODEX-003:
search_docstool - MODEX-004:
get_diagnosticsorchestrator - MODEX-005: build diagnostics (via
get_diagnosticscategorybuild) - MODEX-006: outdated diagnostics (via
get_diagnosticscategoryoutdated) - MODEX-007: security diagnostics (via
get_diagnosticscategorysecurity) - MODEX-008: modernize diagnostics (via
get_diagnosticscategorymodernize) - MODEX-009:
apply_modernize - MODEX-010:
coding_modern_goprompt
MIT