MCP Drift State Tracker
MCP server that scans multi-language codebases to detect stubs, missing imports, and structural incompleteness, assigning drift scores to quantify LLM context erosion.
README
MCP Drift State Tracker
MCP server that enforces code completeness, intercepts context erosion, and neutralizes LLM output degradation across multi-language repository workspaces.
Pure TypeScript. JSON-driven language profiles. Zero Python. Zero runtime bloat.
Author
Jeremy Anderson — dcos.net
What It Does
LLMs degrade output quality as context windows fill: they drop imports, leave stub bodies, omit function implementations, and produce structurally incomplete code. This server provides a real-time audit layer over any MCP-compatible coding client, flagging those patterns before they persist in the codebase.
Core Capabilities
- Multi-language parsing — 20+ languages supported via data-driven JSON profiles. No per-language parser classes.
- Stub and placeholder detection — flags
pass,TODO,FIXME,raise NotImplementedError,undefined,return null, and language-specific stub patterns. - Import and dependency tracking — verifies that declared imports correspond to symbols used in the file.
- Structural completeness verification — confirms that declared classes, functions, and interfaces have non-empty bodies.
- Drift scoring — assigns a numeric drift score to files and sessions to quantify context erosion.
- State persistence — writes audit state to
.mcp_drift_state.jsonat the repository root for cross-session continuity.
Architecture
The parsing engine is entirely data-driven. A single index.ts runtime loads
language_profiles.json at startup, compiles all regex patterns once, and
dispatches files to the correct parsing strategy via a flat extension-to-profile
dispatch table. No cascading conditionals. No nested control flow.
index.ts MCP server runtime
├── language_profiles.json language definitions, dispatch table, aliases
├── controller_config.json downstream AI service endpoints
├── mcp_config.json client integration reference config
└── Makefile standardized build and deploy targets
Language Support
| Category | Extensions | Strategy |
|---|---|---|
| C-style / Brace | .js .jsx .ts .tsx .c .cpp .h .hpp .java .cs .kt .kts .swift .dart .pike .pmod .r |
Brace-depth counting via cStyleDefault |
| Brace (custom) | .rs .go .php .hack .sh .zsh .ps1 |
Per-language regex overrides in braceProfiles |
| Block-end keywords | .jl .lua .ex .exs .adb .ads .au3 .vbs |
Start/end keyword pairing with nest-depth increment rules |
| Sequential labels | .bat .cmd .sql |
Label-based or statement-delimited flow |
| Indentation-sensitive | .mojo .hs .elm |
Signature detection with indent-level body verification |
Duplicate profiles (.sh/.zsh/.ps1, .ex/.exs, .adb/.ads,
.bat/.cmd, .php/.hack) resolve through the _aliases map in
language_profiles.json. Adding a new language requires appending one entry
to the dispatch table and restarting the server.
MCP Tools
| Tool | Purpose |
|---|---|
scan_file |
Scan a single source file for drift indicators |
scan_workspace |
Recursively scan a workspace directory, respecting globalIgnoreDirs |
get_drift_report |
Retrieve accumulated drift state and scores |
reset_drift_state |
Clear drift state to begin a fresh audit session |
Requirements
- Node.js >= 20.0.0
- npm (bundled with Node.js)
Installation
git clone https://git.dcos.net/dcosnet/mcp-drift-state-tracker.git
cd mcp-drift-state-tracker
make
Running
make dev # development, no compile step
make prod # compile and run
make inspect # interactive MCP tool testing via Inspector
Configuration
language_profiles.json
All language-specific regex patterns, stub detectors, file extension routing,
and ignore rules. Validated against the inline $schema. Key structure:
_dispatch— flat lookup table mapping every supported extension to its profile category and profile key. The runtime resolves extensions in O(1) without cascading conditionals._aliases— maps duplicate extensions to their canonical profile key._stubDefaults— common stub patterns applied to profiles that omit an explicitstubsarray.globalIgnoreDirs— directories skipped during workspace scans.stateFileName— per-repo state file name.cStyleDefault— fallback regex set for brace-matching languages.braceProfiles/braceExtensions— custom overrides and extension lists.blockEndProfiles— start/end keyword patterns.sequentialProfiles— label-based flow definitions.indentationProfiles— indent-sensitive language definitions.
controller_config.json
Downstream AI service endpoints. All ports are integers. All service keys are
lowercase slugs. The base_dir follows FHS conventions.
| Service | Port | Purpose |
|---|---|---|
| ollama | 11434 | Local inference engine |
| open-webui | 8080 | Browser-based LLM chat interface |
| aider-web | 8501 | Web frontend for Aider |
| hermes | 8000 | Orchestration proxy |
| odysseus | 7000 | Orchestration proxy |
| dify-engine | 5001 | Workflow automation platform |
mcp_config.json
Client integration reference. Uses ${MCP_TRACKER_PATH} environment variable
for path resolution — set once, referenced everywhere.
License
AGPL-3.0 — Copyright (c) 2026 Jeremy Anderson. dcos.net
Repository
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。