代码度量服务

基于MCP协议的独立代码度量服务器,提供项目分析、复杂度热点、文件度量和目录比较功能。

  • by hive-agi
  • Clojure
  • 本地部署
  • 更新于
在 GitHub 查看 hive-agi/scc-mcp

使用说明

scc-mcp

Standalone MCP server for scc code metrics. Runs on Babashka via the modex-bb framework.

Provides 4 tools for code metrics: project analysis, complexity hotspots, per-file metrics, and directory comparison.

Requirements

Quick Start

bb --config bb.edn run server

Claude Code MCP config

Add to ~/.claude/settings.json:

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

Tools

Tool Description
analyze Project metrics — LOC, complexity, language breakdown
hotspots Complexity hotspots — files exceeding a threshold (default: 20)
file Detailed metrics for a single file
compare Compare metrics between two directories (diff LOC, code, complexity)

IAddon Integration

scc-mcp implements the IAddon protocol for dynamic registration in hive-mcp. When loaded as an addon, its handlers override the embedded scc handlers in the consolidated analysis tool.

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

The addon exposes a single scc supertool with command dispatch:

(require '[scc-mcp.tools :as tools])
(tools/handle-scc {:command "analyze" :path "src/"})

Project Structure

src/scc_mcp/
  core.clj    — Shell wrapper for scc binary, JSON parsing, hotspot extraction
  tools.clj   — Command handlers + MCP tool schema (IAddon interface)
  init.clj    — IAddon reify + nil-railway registration pipeline
  server.clj  — modex-bb standalone MCP server (4 tools)
  log.clj     — Logging shim (timbre on JVM, stderr on bb)

Dependencies

  • modex-bb — MCP server framework
  • scc — external binary (not bundled)

License

MIT