code-context-mcp

code-context-mcp

Indexes codebases into a SQLite database to provide metadata, exports, dependency graphs, and change tracking for JS/TS projects. It enables users to search for symbols, map internal dependencies, and monitor file changes through MCP tools and a web dashboard.

Category
访问服务器

README

code-context-mcp

CI

AI agents waste most of their context window reading raw source files just to understand what a codebase does. This MCP server pre-indexes your project into a SQLite database so agents can query structured metadata instead — 3x fewer tokens, 8x less data, instant answers.

npx code-context-mcp .

That's it. Your codebase is indexed, .mcp.json is configured, and your AI client has 10 tools to query files, exports, dependencies, changes, and directory metadata — without ever reading a single source file. With a .claude/ directory present, 25 additional scrum management tools activate.

The problem

Every time an AI agent needs to understand your codebase, it reads files. All of them. A 25-file project burns ~62K tokens just to answer "what does the server directory do?" With pre-indexed metadata, the same answer costs ~20K tokens. The gap widens with larger codebases.

How it works

  1. Index once — the indexer walks your project, parses JS/TS imports and exports, extracts summaries from comments and JSDoc, builds a dependency graph, and generates descriptions for every file and directory.
  2. Query many times — AI agents use MCP tools to get structured answers: file context, symbol lookups, dependency edges, change history with reasons — all pre-computed.
  3. Stay current — the dashboard watches for file changes and re-indexes automatically. Descriptions persist across re-indexes.

Architecture

Three integrated components form the system:

MCP Server (src/server/) — TypeScript parser indexes files, exports, imports, and dependencies into SQLite. Ten MCP tools expose structured metadata to AI agents, replacing raw file reads.

Scrum System (src/scrum/) — 10 database tables covering the full sprint lifecycle. 25 MCP tools for sprint, ticket, milestone, retro, blocker, and bug management. Imports from a .claude/ directory structure.

React Dashboard (src/dashboard/) — Vite + React 18 + Tailwind CSS frontend with Framer Motion animations, served by a Node.js HTTP server. Five Zustand stores manage file, sprint, agent, planning, and UI state.

See docs/ARCHITECTURE.md for the full component hierarchy, API endpoint reference, and build pipeline.

MCP Tools (35 total: 10 code-context + 25 scrum)

Tool What it does
index_directory Scan a directory, build the full index
find_symbol Find which files export a given function, type, or constant
get_file_context Full file context: summary, exports, imports, dependents, change history
set_description Set a human-written description for a file (persists across re-indexes)
set_directory_description Set a description for a directory
set_change_reason Annotate a recorded change with a reason
get_changes View recent file changes with diffs and reasons
search_files Search files by path or summary
query Read-only SQL against the database
execute Write SQL (INSERT/UPDATE/DELETE)

Setup

# Install globally
npm install -g vlm-code-context-mcp

# Or run directly
npx code-context-mcp /path/to/your/project

This will:

  • Create context.db in your project root
  • Index all files, exports, dependencies, and directories
  • Auto-generate descriptions for every file and folder
  • Write .mcp.json so your AI client picks up the tools

Dashboard

npx code-context-dashboard ./context.db

Opens at http://localhost:3333 with a landing page and two main sections:

Code Explorer:

  • Folder tree sidebar with expandable directories
  • File detail panel: exports, packages, imports, dependents, folder metadata
  • Change history with inline diffs and reasons
  • Dependency graph that filters to the selected file's connections
  • Keyboard shortcuts: Cmd+K search, arrow navigation, hash routing for state persistence
  • Live reload — watches for file changes and re-indexes automatically

Sprint Process (when .claude/ directory is present):

  • Sprint Board: sprint cards with velocity bars and process health checklist, kanban board (TODO/IN_PROGRESS/DONE/BLOCKED columns), planning view, QA view, retro view
  • Project Planning: velocity trend chart across all sprints, Gantt-style milestone timeline, milestones detail, product vision
  • Team: agent cards with health indicators, mood scores (computed from ticket load + retro sentiment), workload bars

Agent Team (9 roles)

When a .claude/agents/ directory is present, the scrum MCP service loads the team:

Role Responsibility
Product Owner Vision, milestones, tickets
Scrum Master Blockers, process, sprint health
Manager Cost efficiency, anti-overengineering
Lead Developer Conflict resolution, code quality
Backend Developer APIs, services, database
Frontend Developer UI, dashboard, styling
Architect Infrastructure, CI/CD, system design
QA Engineer Testing, bug verification, quality gate
Security Specialist Vulnerability audit, input validation, secure defaults

What gets indexed

  • Files — path, language, size, line count, summary, auto-generated description, content
  • Exports — name and kind (function, const, type, class, interface)
  • Dependencies — which file imports what from which file, with symbol names
  • Directories — file count, total lines, size, language breakdown, description
  • Changes — append-only log of add/change/delete events with before/after snapshots, inline diffs, and reasons

Context efficiency

Tested on this project (25 files, 7K lines):

Metric With MCP Without MCP
Tokens per analysis ~20K ~62K
Raw data transferred ~6K chars ~111K chars
Tool calls 7 16

The first index costs more (you need to read files to generate metadata). Every subsequent query is 3x cheaper. Break-even after ~2 uses.

Schema reference

Code context tables

Table Columns Purpose
files path, language, extension, size_bytes, line_count, summary, description, external_imports, content, created_at, modified_at Every indexed file
exports file_id, name, kind (function/class/type/interface/enum/const/re-export) Named exports from JS/TS files
dependencies source_id, target_id, symbols Import edges between files
directories path, name, parent_path, depth, file_count, total_size_bytes, total_lines, language_breakdown, description Directory-level aggregates
changes file_path, event (add/change/delete), timestamp, old/new summary/lines/size/exports, diff_text, reason Append-only change log

Scrum tables

Table Columns Purpose
agents role, name, description, model, tools, system_prompt Team agent definitions
sprints name, goal, start_date, end_date, status, velocity_committed/completed Sprint tracking
tickets sprint_id, ticket_ref, title, priority (P0-P3), status, assigned_to, story_points, qa_verified, acceptance_criteria User stories
subtasks ticket_id, description, status, assigned_to Task breakdown
retro_findings sprint_id, role, category (went_well/went_wrong/try_next), finding, action_owner Retrospective items
blockers sprint_id, ticket_id, description, status (open/resolved) Impediments
bugs sprint_id, ticket_id, severity, description, status (open/fixed/deferred) Defects
skills name, content, owner_role Team knowledge docs
processes name, content, version Versioned process definitions

Scrum MCP tools

In addition to the 10 code context tools, the server exposes 25 scrum management tools when a .claude/ directory is present:

Tool Type What it does
list_agents Read List all scrum team agents
get_agent Read Get agent details by role
list_sprints Read List sprints with ticket counts
get_sprint Read Full sprint details (tickets, bugs, blockers, retro)
list_tickets Read Filter tickets by sprint, status, assignee
get_ticket Read Ticket details with subtasks and linked bugs
list_retro_findings Read Filter retro findings by sprint, category
search_scrum Read Full-text search across scrum data
create_sprint Write Create a new sprint
update_sprint Write Update sprint status/velocity
create_ticket Write Add a ticket to a sprint
update_ticket Write Change ticket status, assignment, QA sign-off
add_retro_finding Write Add a retrospective finding
create_blocker Write Report a blocker
resolve_blocker Write Mark blocker as resolved
log_bug Write Log a bug with severity
sync_scrum_data Write Re-import from .claude/ directory
export_sprint_report Read Generate complete markdown sprint report

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选