codebase-analyzer-mcp 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,36 +3,11 @@
3
3
  [![npm](https://img.shields.io/npm/v/codebase-analyzer-mcp)](https://www.npmjs.com/package/codebase-analyzer-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Analyze any codebase with Gemini AI. Progressive disclosure keeps costs low - start with free structural analysis, drill into semantic details only when needed.
6
+ MCP server for codebase analysis with Gemini AI. Progressive disclosure keeps costs low start with free structural analysis, drill into semantic details only when needed.
7
7
 
8
- ## Quick Start
8
+ ## Install
9
9
 
10
- ### Claude Code Plugin
11
-
12
- ```bash
13
- claude /plugin install https://github.com/jaykaycodes/codebase-analyzer-mcp
14
- ```
15
-
16
- Then use `/cba:analyze` to analyze a codebase, or just ask questions naturally.
17
-
18
- ### MCP Server
19
-
20
- Add to `~/.mcp.json` (create if it doesn't exist):
21
-
22
- ```json
23
- {
24
- "mcpServers": {
25
- "codebase-analyzer": {
26
- "command": "npx",
27
- "args": ["-y", "codebase-analyzer-mcp"]
28
- }
29
- }
30
- }
31
- ```
32
-
33
- Restart Claude Code, then use the `analyze_repo` or `query_repo` tools.
34
-
35
- **Optional:** For semantic analysis with Gemini AI, get an API key at https://aistudio.google.com/apikey and add it:
10
+ Add to your MCP config (`~/.mcp.json` for Claude Code):
36
11
 
37
12
  ```json
38
13
  {
@@ -41,25 +16,30 @@ Restart Claude Code, then use the `analyze_repo` or `query_repo` tools.
41
16
  "command": "npx",
42
17
  "args": ["-y", "codebase-analyzer-mcp"],
43
18
  "env": {
44
- "GEMINI_API_KEY": "your_api_key"
19
+ "GEMINI_API_KEY": "your_key_here"
45
20
  }
46
21
  }
47
22
  }
48
23
  }
49
24
  ```
50
25
 
51
- ### CLI
26
+ Restart Claude Code. The tools will be available immediately.
52
27
 
53
- ```bash
54
- npx codebase-analyzer-mcp analyze . # Standard analysis
55
- npx codebase-analyzer-mcp analyze . -d surface # Fast, free overview
56
- npx codebase-analyzer-mcp analyze . -d deep -s # Full semantic analysis
57
- npx codebase-analyzer-mcp query . "how is auth handled?" # Ask a question
58
- npx codebase-analyzer-mcp patterns . # Find design patterns
59
- npx codebase-analyzer-mcp dataflow . "user login" # Trace data flow
60
- ```
28
+ **Gemini API key** is optional — enables semantic analysis, pattern detection, and dataflow tracing. Without it, you still get structural analysis. Get a free key at https://aistudio.google.com/apikey
29
+
30
+ ## Tools
31
+
32
+ | Tool | Description | Requires Gemini |
33
+ |------|-------------|:---:|
34
+ | `analyze_repo` | Full analysis with progressive disclosure | No |
35
+ | `query_repo` | Ask questions about a codebase | Optional |
36
+ | `expand_section` | Drill into specific analysis sections | No |
37
+ | `read_files` | Read source files from a cached analysis | No |
38
+ | `find_patterns` | Detect design/architecture patterns | Yes |
39
+ | `trace_dataflow` | Trace data flow through the system | Yes |
40
+ | `get_analysis_capabilities` | List supported languages and options | No |
61
41
 
62
- ## What It Does
42
+ ## Analysis Layers
63
43
 
64
44
  | Layer | Cost | What You Get |
65
45
  |-------|------|--------------|
@@ -67,48 +47,17 @@ npx codebase-analyzer-mcp dataflow . "user login" # Trace data fl
67
47
  | **Structural** | Free | Symbols, imports, complexity (via tree-sitter) |
68
48
  | **Semantic** | Gemini | Architecture insights, pattern detection |
69
49
 
70
- Analysis results include expandable sections - you only pay for what you drill into.
50
+ Results include expandable sections you only pay for what you drill into.
71
51
 
72
- ## MCP Tools
73
-
74
- | Tool | Description |
75
- |------|-------------|
76
- | `analyze_repo` | Full analysis with progressive disclosure |
77
- | `query_repo` | Ask questions about a codebase |
78
- | `expand_section` | Drill into specific sections |
79
- | `read_files` | Read source files from a cached analysis |
80
- | `find_patterns` | Detect design/architecture patterns |
81
- | `trace_dataflow` | Trace data flow through the system |
82
- | `get_analysis_capabilities` | List supported languages and analysis options |
83
-
84
- ## Plugin
85
-
86
- ### Command
87
-
88
- ```
89
- /cba:analyze [source] [--depth surface|standard|deep] [--focus <paths>]
90
- ```
91
-
92
- ### Agents
93
-
94
- | Agent | Purpose |
95
- |-------|---------|
96
- | `architecture-analyzer` | Full codebase architecture analysis |
97
- | `pattern-detective` | Design/anti-pattern detection |
98
- | `dataflow-tracer` | Data flow tracing through systems |
99
- | `codebase-explorer` | Quick exploration and Q&A |
100
-
101
- Agents are routed automatically based on your question — just ask naturally.
102
-
103
- ---
104
-
105
- ## Alternative Installation
106
-
107
- ### Global Install
52
+ ## CLI
108
53
 
109
54
  ```bash
110
- npm install -g codebase-analyzer-mcp
111
- # Then use: cba analyze .
55
+ npx codebase-analyzer-mcp analyze . # Standard analysis
56
+ npx codebase-analyzer-mcp analyze . -d surface # Fast, free overview
57
+ npx codebase-analyzer-mcp analyze . -d deep -s # Full semantic analysis
58
+ npx codebase-analyzer-mcp query . "how is auth handled?" # Ask a question
59
+ npx codebase-analyzer-mcp patterns . # Find design patterns
60
+ npx codebase-analyzer-mcp dataflow . "user login" # Trace data flow
112
61
  ```
113
62
 
114
63
  ## Development
@@ -117,9 +66,20 @@ npm install -g codebase-analyzer-mcp
117
66
  git clone https://github.com/jaykaycodes/codebase-analyzer-mcp.git
118
67
  cd codebase-analyzer-mcp
119
68
  bun install
120
- bun run dev # Watch mode
121
- bun run build # Build
122
- bun run cba analyze . # Test CLI
69
+ bun run build
70
+ ```
71
+
72
+ For local MCP testing, create `.mcp.json` at repo root:
73
+
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "codebase-analyzer": {
78
+ "command": "node",
79
+ "args": ["dist/mcp/server.js"]
80
+ }
81
+ }
82
+ }
123
83
  ```
124
84
 
125
85
  ## License
package/dist/cli/index.js CHANGED
@@ -44251,8 +44251,8 @@ var package_default;
44251
44251
  var init_package = __esm(() => {
44252
44252
  package_default = {
44253
44253
  name: "codebase-analyzer-mcp",
44254
- version: "2.1.1",
44255
- description: "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
44254
+ version: "2.2.0",
44255
+ description: "Multi-layer codebase analysis MCP server with Gemini AI and progressive disclosure.",
44256
44256
  type: "module",
44257
44257
  main: "dist/mcp/server.js",
44258
44258
  packageManager: "bun@1.3.8",
@@ -44262,13 +44262,7 @@ var init_package = __esm(() => {
44262
44262
  },
44263
44263
  files: [
44264
44264
  "dist/cli",
44265
- "dist/mcp",
44266
- "agents",
44267
- "commands",
44268
- "skills",
44269
- ".claude-plugin",
44270
- "CLAUDE.md",
44271
- "AGENTS.md"
44265
+ "dist/mcp"
44272
44266
  ],
44273
44267
  scripts: {
44274
44268
  build: "bun scripts/build.ts",
@@ -44277,7 +44271,7 @@ var init_package = __esm(() => {
44277
44271
  typecheck: "tsc --noEmit",
44278
44272
  test: "bun test",
44279
44273
  cli: "bun src/cli/index.ts",
44280
- version: "bun scripts/sync-version.ts && git add .",
44274
+ version: "git add .",
44281
44275
  postversion: "git push --follow-tags",
44282
44276
  prepublishOnly: "bun run build"
44283
44277
  },
@@ -71136,8 +71136,8 @@ function buildFallbackAnswer(question, analysisId, cached2, scored, fileContents
71136
71136
  // package.json
71137
71137
  var package_default = {
71138
71138
  name: "codebase-analyzer-mcp",
71139
- version: "2.1.1",
71140
- description: "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
71139
+ version: "2.2.0",
71140
+ description: "Multi-layer codebase analysis MCP server with Gemini AI and progressive disclosure.",
71141
71141
  type: "module",
71142
71142
  main: "dist/mcp/server.js",
71143
71143
  packageManager: "bun@1.3.8",
@@ -71147,13 +71147,7 @@ var package_default = {
71147
71147
  },
71148
71148
  files: [
71149
71149
  "dist/cli",
71150
- "dist/mcp",
71151
- "agents",
71152
- "commands",
71153
- "skills",
71154
- ".claude-plugin",
71155
- "CLAUDE.md",
71156
- "AGENTS.md"
71150
+ "dist/mcp"
71157
71151
  ],
71158
71152
  scripts: {
71159
71153
  build: "bun scripts/build.ts",
@@ -71162,7 +71156,7 @@ var package_default = {
71162
71156
  typecheck: "tsc --noEmit",
71163
71157
  test: "bun test",
71164
71158
  cli: "bun src/cli/index.ts",
71165
- version: "bun scripts/sync-version.ts && git add .",
71159
+ version: "git add .",
71166
71160
  postversion: "git push --follow-tags",
71167
71161
  prepublishOnly: "bun run build"
71168
71162
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codebase-analyzer-mcp",
3
- "version": "2.1.1",
4
- "description": "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
3
+ "version": "2.2.0",
4
+ "description": "Multi-layer codebase analysis MCP server with Gemini AI and progressive disclosure.",
5
5
  "type": "module",
6
6
  "main": "dist/mcp/server.js",
7
7
  "packageManager": "bun@1.3.8",
@@ -11,13 +11,7 @@
11
11
  },
12
12
  "files": [
13
13
  "dist/cli",
14
- "dist/mcp",
15
- "agents",
16
- "commands",
17
- "skills",
18
- ".claude-plugin",
19
- "CLAUDE.md",
20
- "AGENTS.md"
14
+ "dist/mcp"
21
15
  ],
22
16
  "scripts": {
23
17
  "build": "bun scripts/build.ts",
@@ -26,7 +20,7 @@
26
20
  "typecheck": "tsc --noEmit",
27
21
  "test": "bun test",
28
22
  "cli": "bun src/cli/index.ts",
29
- "version": "bun scripts/sync-version.ts && git add .",
23
+ "version": "git add .",
30
24
  "postversion": "git push --follow-tags",
31
25
  "prepublishOnly": "bun run build"
32
26
  },
@@ -1,34 +0,0 @@
1
- {
2
- "name": "codebase-analyzer",
3
- "owner": {
4
- "name": "Jake Correa",
5
- "url": "https://github.com/jaykaycodes"
6
- },
7
- "metadata": {
8
- "description": "Multi-layer codebase analysis tools",
9
- "version": "2.1.1"
10
- },
11
- "plugins": [
12
- {
13
- "name": "codebase-analyzer",
14
- "description": "Multi-layer codebase analysis with Gemini AI. 4 agents, 1 command, 1 skill for architecture analysis, pattern detection, and dataflow tracing.",
15
- "version": "2.1.1",
16
- "author": {
17
- "name": "Jake Correa",
18
- "url": "https://github.com/jaykaycodes"
19
- },
20
- "homepage": "https://github.com/jaykaycodes/codebase-analyzer-mcp",
21
- "tags": [
22
- "codebase-analysis",
23
- "architecture",
24
- "patterns",
25
- "gemini",
26
- "mcp"
27
- ],
28
- "source": {
29
- "source": "github",
30
- "repo": "jaykaycodes/codebase-analyzer-mcp"
31
- }
32
- }
33
- ]
34
- }
@@ -1,30 +0,0 @@
1
- {
2
- "name": "codebase-analyzer",
3
- "version": "2.1.1",
4
- "description": "Multi-layer codebase analysis with Gemini AI. 4 agents, 1 command, 1 skill for architecture analysis, pattern detection, and dataflow tracing.",
5
- "author": {
6
- "name": "Jake Correa",
7
- "url": "https://github.com/jaykaycodes"
8
- },
9
- "homepage": "https://github.com/jaykaycodes/codebase-analyzer-mcp",
10
- "license": "MIT",
11
- "keywords": [
12
- "codebase-analysis",
13
- "architecture",
14
- "patterns",
15
- "gemini",
16
- "mcp",
17
- "progressive-disclosure",
18
- "tree-sitter"
19
- ],
20
- "mcpServers": {
21
- "codebase-analyzer": {
22
- "type": "stdio",
23
- "command": "npx",
24
- "args": [
25
- "-y",
26
- "codebase-analyzer-mcp"
27
- ]
28
- }
29
- }
30
- }
package/AGENTS.md DELETED
@@ -1,112 +0,0 @@
1
- # Agent Instructions
2
-
3
- This repository is both an MCP server and a Claude plugin for multi-layer codebase analysis.
4
-
5
- ## Working Agreement
6
-
7
- - **Branching:** Feature branches for non-trivial changes
8
- - **Safety:** No destructive git commands, no deleting user data
9
- - **Testing:** Run `pnpm build` after changes - TypeScript errors break everything
10
- - **Architecture:** Respect layer separation (surface → structural → semantic)
11
- - **Counts:** When adding agents/commands/skills, update plugin.json description
12
-
13
- ## Repository Structure
14
-
15
- ```
16
- codebase-analyzer-mcp/
17
- ├── .claude-plugin/
18
- │ └── plugin.json # Plugin metadata
19
- ├── agents/
20
- │ ├── analysis/ # Analysis agents
21
- │ └── research/ # Research agents
22
- ├── commands/ # Slash commands
23
- ├── skills/ # Context-loaded skills
24
- ├── src/
25
- │ ├── mcp/ # MCP server + tools
26
- │ ├── cli/ # CLI interface
27
- │ └── core/ # Analysis engine
28
- │ └── layers/ # Surface, structural, semantic
29
- └── docs/ # Documentation
30
- ```
31
-
32
- ## Key Decisions
33
-
34
- | Decision | Rationale |
35
- |----------|-----------|
36
- | Gemini for semantic | Keep Claude context clean |
37
- | Tree-sitter for parsing | Fast AST without LLM |
38
- | Progressive disclosure | Minimize initial context cost |
39
- | Plugin + MCP | Both distribution paths |
40
-
41
- ## Layer Responsibilities
42
-
43
- **Surface Layer** (`src/core/layers/surface.ts`)
44
- - File enumeration, language detection
45
- - Entry points, module identification
46
- - NO LLM calls
47
-
48
- **Structural Layer** (`src/core/layers/structural.ts`)
49
- - Tree-sitter parsing
50
- - Symbol extraction
51
- - Import/export mapping
52
- - NO LLM calls
53
-
54
- **Semantic Layer** (`src/core/layers/semantic.ts`)
55
- - Gemini API calls
56
- - Architecture detection
57
- - Pattern recognition
58
- - EXPENSIVE - opt-in only
59
-
60
- ## Code Patterns
61
-
62
- **Partial failures:** Capture in `warnings[]` or `partialFailures[]`, don't throw
63
-
64
- **Token budget:** Check before expensive operations, warn if exceeded
65
-
66
- **Logging:** Use `logger` from `src/core/logger.ts`
67
-
68
- ## Plugin Component Guidelines
69
-
70
- ### Agents
71
-
72
- - Place in `agents/[category]/` by purpose
73
- - YAML frontmatter: `name`, `description` with examples
74
- - Description explains when to use the agent
75
- - Use haiku model for efficiency
76
-
77
- ### Commands
78
-
79
- - Place in `commands/`
80
- - Set `user-invocable: true`
81
- - Document usage, options, examples
82
- - Show workflow and implementation
83
-
84
- ### Skills
85
-
86
- - Directory in `skills/[name]/`
87
- - SKILL.md is entry point (<500 lines)
88
- - references/ for detailed docs
89
- - Description in third person
90
-
91
- ## Updating Plugin Counts
92
-
93
- After adding/removing components:
94
-
95
- ```bash
96
- # Count components
97
- ls agents/**/*.md | wc -l # agents
98
- ls commands/*.md | wc -l # commands
99
- ls -d skills/*/ | wc -l # skills
100
-
101
- # Update description in .claude-plugin/plugin.json
102
- ```
103
-
104
- Format: `"X agents, Y commands, Z skills"`
105
-
106
- ## Testing Checklist
107
-
108
- - [ ] `pnpm build` succeeds
109
- - [ ] `pnpm cba capabilities` returns JSON
110
- - [ ] `pnpm cba analyze . -d surface -q` works
111
- - [ ] New agent/command/skill follows patterns
112
- - [ ] plugin.json counts match actual files
package/CLAUDE.md DELETED
@@ -1,160 +0,0 @@
1
- # Codebase Analyzer MCP
2
-
3
- Multi-layer codebase analysis with Gemini AI. Both an MCP server and a Claude plugin.
4
-
5
- ## Philosophy
6
-
7
- **Progressive Disclosure**: Start cheap (surface), reveal more on demand. Don't analyze everything upfront.
8
-
9
- **Budget Awareness**: Track tokens. Surface is free, structural is cheap, semantic is expensive.
10
-
11
- **Graceful Degradation**: Partial failures don't break analysis. Capture warnings, continue.
12
-
13
- **Agent-First Design**: Output structured for AI agents - expandable sections, cost estimates, next steps.
14
-
15
- ## Quick Start
16
-
17
- ```bash
18
- pnpm install && pnpm build
19
- ```
20
-
21
- ## Plugin Components
22
-
23
- | Component | Count | Purpose |
24
- |-----------|-------|---------|
25
- | Agents | 4 | Specialized analysis tasks |
26
- | Commands | 1 | User-invocable actions |
27
- | Skills | 1 | Context-loaded guidance |
28
- | MCP Server | 1 | Tool interface for Claude |
29
-
30
- ### Agents
31
-
32
- | Agent | Purpose |
33
- |-------|---------|
34
- | `architecture-analyzer` | Full codebase architecture analysis |
35
- | `pattern-detective` | Design/anti-pattern detection |
36
- | `dataflow-tracer` | Data flow tracing through systems |
37
- | `codebase-explorer` | Quick exploration and Q&A |
38
-
39
- ### Commands
40
-
41
- | Command | Usage |
42
- |---------|-------|
43
- | `/cba:analyze` | Analyze a codebase |
44
-
45
- ### Skills
46
-
47
- | Skill | Purpose |
48
- |-------|---------|
49
- | `cba:codebase-analysis` | How to use the MCP tools |
50
-
51
- ## Architecture
52
-
53
- See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for system design.
54
-
55
- ## Key Paths
56
-
57
- | Path | Purpose |
58
- |------|---------|
59
- | `.claude-plugin/plugin.json` | Plugin metadata |
60
- | `agents/` | Agent definitions |
61
- | `commands/` | Slash commands |
62
- | `skills/` | Context-loaded skills |
63
- | `src/mcp/server.ts` | MCP server entry |
64
- | `src/mcp/tools/` | MCP tool definitions |
65
- | `src/cli/index.ts` | CLI interface |
66
- | `src/core/orchestrator.ts` | Analysis coordination |
67
- | `src/core/layers/` | Analysis layers |
68
-
69
- ## MCP Tools
70
-
71
- | Tool | Purpose | Cost |
72
- |------|---------|------|
73
- | `analyze_repo` | Full analysis with expandable sections | Varies |
74
- | `query_repo` | Ask questions about a codebase | Medium |
75
- | `expand_section` | Drill into specific sections | Low |
76
- | `read_files` | Read source files from cached analysis | None |
77
- | `find_patterns` | Pattern detection | Medium |
78
- | `trace_dataflow` | Data flow tracing | Medium |
79
- | `get_analysis_capabilities` | List capabilities | None |
80
-
81
- ## Analysis Depth
82
-
83
- | Depth | What It Does | LLM Cost |
84
- |-------|--------------|----------|
85
- | `surface` | File enumeration, languages, entry points | ~0 |
86
- | `standard` | + structural analysis with Tree-sitter | Low |
87
- | `deep` | + semantic analysis with Gemini | High |
88
-
89
- ## Adding Components
90
-
91
- ### Adding a New MCP Tool
92
-
93
- 1. Create `src/mcp/tools/your-tool.ts` (schema + execute)
94
- 2. Export from `src/mcp/tools/index.ts`
95
- 3. Register in `src/mcp/server.ts`
96
- 4. Add CLI command in `src/cli/index.ts` (optional)
97
- 5. `pnpm build`
98
-
99
- ### Adding an Agent
100
-
101
- 1. Create `agents/[category]/your-agent.md`
102
- 2. Use YAML frontmatter: name, description
103
- 3. Include examples in description
104
- 4. Update plugin.json description count
105
-
106
- ### Adding a Command
107
-
108
- 1. Create `commands/your-command.md`
109
- 2. Set `user-invocable: true` in frontmatter
110
- 3. Document usage, examples, workflow
111
- 4. Update plugin.json description count
112
-
113
- ### Adding a Skill
114
-
115
- 1. Create `skills/your-skill/SKILL.md`
116
- 2. Add references/ for detailed docs
117
- 3. Keep SKILL.md under 500 lines
118
- 4. Update plugin.json description count
119
-
120
- ## Environment
121
-
122
- ```bash
123
- GEMINI_API_KEY=... # Required for semantic analysis
124
- ```
125
-
126
- ## Releasing
127
-
128
- Uses npm trusted publishing (OIDC) - no NPM_TOKEN secret needed.
129
-
130
- 1. Bump version: `npm version patch` (or minor/major)
131
- 2. Sync version to plugin.json: `bun run version:sync`
132
- 3. Push with tags: `git push && git push --tags`
133
-
134
- CI automatically publishes to npm when version changes on main.
135
-
136
- **Trusted publisher config:** npm package must be linked to `jaykaycodes/codebase-analyzer-mcp` in npm settings (Settings → Publishing access → Add GitHub Actions as publisher).
137
-
138
- **Requirements:** npm >= 11.5.1 (CI updates npm automatically). See [npm trusted publishing docs](https://docs.npmjs.com/trusted-publishers/).
139
-
140
- ## Key Learnings
141
-
142
- _This section captures learnings as we work on this repository._
143
-
144
- ### 2026-01-28: Source name extraction for GitHub URLs
145
-
146
- When analyzing GitHub repos, temp clone directory name (cba-XXXXX) was shown instead of repo name. Fixed by extracting owner/repo from GitHub URLs before resolving to local path and passing `sourceName` through analysis chain.
147
-
148
- **Pattern:** Preserve user-facing identifiers separately from internal paths.
149
-
150
- ### 2026-01-28: Property name consistency between types and usage
151
-
152
- Multiple bugs from accessing wrong property names (l.name vs l.language, totalFiles vs fileCount).
153
-
154
- **Pattern:** When adding new types, grep for all usages of old patterns and update together.
155
-
156
- ### 2026-01-28: Plugin architecture for agentic development
157
-
158
- Adopted compound-engineering patterns: agents for specialized tasks, commands for user actions, skills for context-loaded guidance. Makes the repo self-documenting for Claude.
159
-
160
- **Pattern:** Structure repos as plugins even for MCP servers - the documentation patterns apply.