Liking cljdoc? Tell your friends :D

clj-kondo-mcp

Standalone MCP server for clj-kondo static analysis. Runs on Babashka via the modex-bb framework.

Provides 7 tools for Clojure code analysis: linting, call graph traversal, var lookup, namespace dependency graphs, and dead code detection.

Requirements

Quick Start

bb --config bb.edn run server

Claude Code MCP config

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "clj-kondo": {
      "command": "bb",
      "args": ["--config", "/path/to/clj-kondo-mcp/bb.edn", "run", "server"]
    }
  }
}

Tools

ToolDescription
analyzeProject analysis — var definitions, usages, namespaces, findings summary
lintLint with severity filtering (error, warning, info)
find_callersFind all call sites of a specific var
find_callsFind all vars that a function calls
find_varFind definition(s) of a var by name
namespace_graphNamespace dependency graph — nodes and edges
unused_varsDead code detection — unused private vars

IAddon Integration

clj-kondo-mcp implements the IAddon protocol for dynamic registration in hive-mcp. When loaded as an addon, its handlers override the embedded kondo handlers in the consolidated analysis tool via last-write-wins in the extension registry.

(require '[clj-kondo-mcp.init :as init])
(init/init-as-addon!)
;; => {:registered ["kondo"] :total 1}

The addon exposes a single kondo supertool with command dispatch:

;; Direct handler usage
(require '[clj-kondo-mcp.tools :as tools])
(tools/handle-kondo {:command "lint" :path "src/" :level "warning"})

Project Structure

src/clj_kondo_mcp/
  core.clj    — clj-kondo pod wrapper (analysis, linting, call graphs)
  tools.clj   — Command handlers + MCP tool schema (IAddon interface)
  init.clj    — IAddon reify + nil-railway registration pipeline
  server.clj  — modex-bb standalone MCP server (7 tools)
  log.clj     — Logging shim (timbre on JVM, stderr on bb)

Dependencies

License

MIT

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close