Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dist/
internal-docs/
internal-docs.zip
.codebase-intelligence.json
.idea
122 changes: 121 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,119 @@
## Props to PatrickSys for his work on the original codebase-context MCP. I needed to extend it for React/NextJS
https://github.com/PatrickSys/codebase-context

# Codebase Context (ReactJS/NextJS/+)

This branch extends the original `codebase-context` MCP server with **React** and **Next.js** analyzers (while keeping Angular support) so agents can produce higher-signal, framework-aware answers across mixed codebases.

**What’s new in this fork**
- **Ecosystem detection**: package.json-driven detection of Angular / React / Next.js and common libraries (forms, validation, data, state, styling).
- **React analyzer**: detects components (function + class), built-in/custom hooks, Context usage, memoization, and Suspense patterns.
- **Next.js analyzer**: detects App Router vs Pages Router, route kinds (`page`/`layout`/`route`/`api`), route paths, `"use client"`, and metadata exports.
- **Quieter startup by default**: set `CODEBASE_CONTEXT_DEBUG=1` only when you want startup/index logs.

## Quick Start (GitHub branch)

### Claude Desktop / VS Code / Cursor

Add this to your MCP client config:

```json
{
"mcpServers": {
"codebase-context-react-nextjs": {
"command": "npx",
"args": [
"-y",
"github:aolin480/codebase-context-react-nextjs#feature/reactjs-nextjs-analyzers",
"/path/to/your/project"
]
}
}
}
```

### Warp

Add this to your Warp MCP configuration:

```json
{
"codebase-context-react-nextjs": {
"command": "npx",
"args": [
"-y",
"github:aolin480/codebase-context-react-nextjs#feature/reactjs-nextjs-analyzers",
"/path/to/your/project"
]
}
}
```

### Codex

Add this to your Codex MCP configuration:

```toml
[mcp_servers.codebase-context-react-nextjs]
command = "npx"
args = [
"-y",
"github:aolin480/codebase-context-react-nextjs#feature/reactjs-nextjs-analyzers",
"/path/to/your/project"
]
```

### Gemini

Add this to your Gemini MCP configuration:

```json
{
"codebase-context-react-nextjs": {
"command": "npx",
"args": [
"-y",
"github:aolin480/codebase-context-react-nextjs#feature/reactjs-nextjs-analyzers",
"/path/to/your/project"
]
}
}
```

### OpenCode

Add this to your OpenCode MCP configuration:

```json
{
"mcp": {
"codebase-context-react-nextjs": {
"type": "local",
"command": [
"npx",
"-y",
"github:aolin480/codebase-context-react-nextjs#feature/reactjs-nextjs-analyzers",
"/path/to/your/project"
],
"enabled": true
}
}
}
```

## Smoke Tests

From this repo root:

```bash
npm run smoke:build
npm run smoke
npm run smoke:nextjs
npm run smoke:react
```

---

# codebase-context

**AI coding agents don't know your codebase. This MCP fixes that.**
Expand All @@ -12,7 +128,11 @@ Add this to your MCP client config (Claude Desktop, VS Code, Cursor, etc.).
"mcpServers": {
"codebase-context": {
"command": "npx",
"args": ["codebase-context", "/path/to/your/project"]
"args": [
"-y",
"github:aolin480/codebase-context-react-nextjs#feature/reactjs-nextjs-analyzers",
"/path/to/your/project"
]
}
}
```
Expand Down
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
"import": "./dist/analyzers/angular/index.js",
"types": "./dist/analyzers/angular/index.d.ts"
},
"./analyzers/react": {
"import": "./dist/analyzers/react/index.js",
"types": "./dist/analyzers/react/index.d.ts"
},
"./analyzers/nextjs": {
"import": "./dist/analyzers/nextjs/index.js",
"types": "./dist/analyzers/nextjs/index.d.ts"
},
"./analyzers/generic": {
"import": "./dist/analyzers/generic/index.js",
"types": "./dist/analyzers/generic/index.d.ts"
Expand Down Expand Up @@ -75,7 +83,12 @@
"prepublishOnly": "npm run build",
"start": "node dist/index.js",
"dev": "ts-node src/index.ts",
"watch": "tsc -w"
"test": "vitest run",
"watch": "tsc -w",
"smoke": "vitest run tests/nextjs-analyzer.test.ts tests/react-analyzer.test.ts",
"smoke:nextjs": "vitest run tests/nextjs-analyzer.test.ts",
"smoke:react": "vitest run tests/react-analyzer.test.ts",
"smoke:build": "npm run build && npm run smoke"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^0.6.0",
Expand All @@ -95,4 +108,4 @@
"ts-node": "^10.9.2",
"vitest": "^1.3.0"
}
}
}
Loading