CodeContext
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CodeContextdetect patterns in my team's repository"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ง CodeContext
AI Coding Context Layer โ Make AI assistants understand your team's codebase patterns
Features โข Quick Start โข Architecture โข API Reference โข Contributing
๐ฏ The Problem
AI coding assistants like Cursor and Copilot are powerful, but they don't understand your team's unique patterns:
Your error handling conventions
Your import style preferences
Your validation approach
Your authentication patterns
Every suggestion requires mental translation to match your codebase.
Related MCP server: code-intel MCP Server
โจ The Solution
CodeContext automatically detects your codebase patterns and injects them as context into AI assistants via the Model Context Protocol (MCP). Now every AI suggestion follows your team's conventions out of the box.
๐ Features
8 Pattern Types Detected
Category | Pattern Types | Detection Method |
Code Style | Error Handling, Imports, Naming, Structure | Rules-based (instant) |
Frameworks | API Format, Validation, Database, Auth | Hybrid (rules + LLM fallback) |
Key Capabilities
๐ AST-Powered Analysis โ Deep code parsing with Babel for accurate pattern detection
๐ค Hybrid Detection โ Rules-based first, LLM (Groq) fallback for complex patterns
โก Real-time Indexing โ Background processing with Redis queue
๐ MCP Protocol โ Native integration with Cursor, Copilot, and more
๐ GitHub OAuth โ Seamless onboarding and repository access
๐ Dashboard โ View detected patterns, confidence scores, and usage analytics
๐๏ธ Architecture
flowchart TB
subgraph Input["๐ฅ Input"]
GH[GitHub Repository]
end
subgraph Core["๐ง CodeContext Engine"]
IDX[Indexing Queue<br/>Redis/Upstash]
AST[AST Parser<br/>Babel]
DET[Pattern Detectors<br/>8 Types]
LLM[LLM Fallback<br/>Groq]
CTX[Context Generator]
end
subgraph Storage["๐พ Storage"]
DB[(PostgreSQL<br/>Supabase)]
end
subgraph Output["๐ค Output"]
MCP[MCP Server]
DASH[Dashboard]
end
subgraph Clients["๐ค AI Clients"]
CUR[Cursor]
COP[Copilot]
OTHER[Other MCP Clients]
end
GH --> IDX
IDX --> AST
AST --> DET
DET --> LLM
DET --> DB
LLM --> DB
DB --> CTX
CTX --> MCP
DB --> DASH
MCP --> CUR
MCP --> COP
MCP --> OTHER๐ฆ Tech Stack
Layer | Technology |
Frontend | Next.js 14 (App Router), TypeScript, Tailwind CSS |
Backend | Next.js API Routes, NextAuth.js |
Database | PostgreSQL (Supabase) |
Queue | Redis (Upstash) |
AST Parsing | @babel/parser, @babel/traverse |
LLM | Groq (llama-3.3-70b-versatile) |
MCP | @modelcontextprotocol/sdk |
๐ Quick Start
Prerequisites
Node.js 18+
PostgreSQL database (we recommend Supabase)
Redis instance (we recommend Upstash)
GitHub OAuth App
Groq API key (free tier: 14,400 req/day)
1. Clone & Install
git clone https://github.com/bhasinagam/ContextBridge.git
cd ContextBridge
npm install2. Configure Environment
cp .env.example .env.localEdit .env.local with your credentials:
Variable | Description | Where to Get |
| PostgreSQL connection string | Supabase โ Settings โ Database |
| Redis REST URL | Upstash โ Redis โ REST API |
| Redis REST token | Same as above |
| Random 32-byte secret | Run: |
| OAuth App client ID | GitHub โ OAuth Apps |
| OAuth App secret | Same as above |
| Groq API key |
3. Set Up Database
Run the schema in your Supabase SQL editor:
-- Contents of src/lib/db/schema.sqlOr use the Supabase dashboard to import src/lib/db/schema.sql.
4. Run Development Server
npm run devOpen http://localhost:3000 to access the dashboard.
๐ MCP Integration
Using with Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"codecontext": {
"url": "http://localhost:3000/api/mcp/context",
"headers": {
"X-API-Key": "your-api-key"
},
"defaultParams": {
"repo_id": "your-repo-id"
}
}
}
}API Usage
curl -X POST http://localhost:3000/api/mcp/context \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"query": "add an API endpoint",
"repo_id": "your-repo-id"
}'๐ Project Structure
src/
โโโ app/ # Next.js App Router
โ โโโ api/ # API Routes
โ โ โโโ auth/ # NextAuth endpoints
โ โ โโโ github/ # GitHub API proxy
โ โ โโโ mcp/ # MCP context & health
โ โ โโโ patterns/ # Pattern queries
โ โ โโโ repos/ # Repository CRUD
โ โ โโโ webhooks/ # GitHub webhooks
โ โโโ dashboard/ # Dashboard pages
โ โโโ onboarding/ # Onboarding flow
โโโ components/ # React components
โ โโโ ui/ # shadcn/ui components
โ โโโ dashboard/ # Dashboard-specific
โโโ lib/ # Core libraries
โโโ db/ # Database client & schema
โโโ github/ # GitHub API client
โโโ indexing/ # AST parser & queue
โโโ mcp/ # MCP server & context generator
โโโ patterns/ # 8 pattern detectors
โโโ utils/ # Types, helpers, Groq client๐ Pattern Types
Rules-Based (No API Calls)
Pattern | What It Detects |
Error Handling | try-catch blocks, wrapper functions (handleError, etc.) |
Import Style | Relative (./path), Absolute (@/, ~/), Barrel exports |
Naming Convention | camelCase, snake_case, PascalCase |
File Structure | App Router, Pages Router, Components directory |
Hybrid (Rules + LLM Fallback)
Pattern | What It Detects |
API Format | Next.js API Routes, response structure patterns |
Validation | Zod, Yup, Joi, Valibot, custom validation |
Database | Prisma, Drizzle, TypeORM, Mongoose, Supabase, Kysely |
Authentication | NextAuth, Clerk, Auth0, Supabase Auth, Firebase |
๐ง Troubleshooting
Ensure your Supabase project is active
Check if the password contains special characters (URL-encode them)
Use port
5432for direct connection,6543for pooled
Verify callback URL is set to
http://localhost:3000/api/auth/callback/githubEnsure
NEXTAUTH_URLmatches your app URL
Check if repository indexing is complete (status: "completed")
Verify there are TypeScript/JavaScript files in the repo
Check Redis queue for pending jobs
Restart Cursor after updating
mcp.jsonCheck API key is valid and not expired
Verify the repo_id matches a indexed repository
๐บ๏ธ Roadmap
Multi-language support โ Python, Go, Rust
Custom pattern definitions โ User-defined pattern rules
Team collaboration โ Shared pattern configs
VS Code extension โ Native VS Code integration
Pattern analytics โ Usage trends and insights
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with โค๏ธ for the AI-assisted coding community
โญ Star this repo if you find it useful!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceA personal AI coding assistant that connects to various development environments and helps automate tasks, provide codebase insights, and improve coding decisions by leveraging the Model Context Protocol.10
- AlicenseNot gradedqualityAmaintenanceProvides LLMs with code intelligence tools like relationship explanation, PR impact analysis, and health reports via the Model Context Protocol.1MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides development standards and best practices context to AI coding assistants, ensuring generated code adheres to team/project conventions.3381MIT
- AlicenseBqualityDmaintenanceProvides IDE-like semantic code retrieval and editing tools for LLMs, enabling precise code understanding and manipulation in large codebases via the Model Context Protocol.25MIT
Related MCP Connectors
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.โฆ
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Adaptive plan/build/review cycles for AI coding assistants, persisted across sessions.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bhasinagam/ContextBridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server