CodeSense MCP
Provides semantic code intelligence to help users search, navigate, and analyze entire codebases using plain English. It enables Claude to perform architectural overviews, bug detection, and refactor suggestions through local semantic search and keyword indexing.
README
π§ CodeSense MCP
Semantic code intelligence for Claude β search, understand, and analyze any codebase using plain English.
π€ The Problem
You open a new codebase and ask Claude:
"Where is the user authentication handled?"
Claude has no idea. It hasn't seen your code.
You could paste files manually β but that's slow, hits context limits, and doesn't scale.
CodeSense MCP solves this. Point it at your project once, and Claude can search, navigate and reason about your entire codebase without you doing anything else.
β¨ What It Does
| Tool | What you can ask Claude |
|---|---|
index_codebase |
"Index my project at ~/projects/myapp" |
search_code |
"Find where JWT tokens are validated" |
explain_architecture |
"Give me an overview of how this project is structured" |
find_bugs |
"Scan for common bug patterns and hardcoded secrets" |
find_dead_code |
"Find functions that are defined but never used" |
suggest_refactor |
"What should I refactor in src/utils.py?" |
get_file_summary |
"Tell me about the models/user.py file" |
list_indexed_files |
"List all Python files in the project" |
π Quick Start
1. Install
# Lightweight (keyword search, no extra deps)
pip install codesense-mcp
# Full semantic search (recommended β uses local embeddings, no API key needed)
pip install "codesense-mcp[semantic]"
2. Add to Claude Desktop
Open your Claude Desktop config:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add this:
{
"mcpServers": {
"codesense": {
"command": "uvx",
"args": ["codesense-mcp"]
}
}
}
Restart Claude Desktop. That's it. β
π¬ Example Conversations
Find authentication logic:
You: "Search my codebase for where passwords are hashed" Claude: Searches and returns the exact functions with file paths and line context.
Understand a new project:
You: "Explain the architecture of ~/projects/django-app" Claude: Returns a structured breakdown of modules, entry points, key classes, and language distribution.
Security audit:
You: "Scan for hardcoded secrets and empty except blocks" Claude: Lists every file and line with potential issues.
Refactor guidance:
You: "What should I refactor in services/payment.py?" Claude: Flags long functions, deep nesting, magic numbers, and missing docstrings with line numbers.
ποΈ Architecture
codesense-mcp/
βββ codesense_mcp/
β βββ __init__.py
β βββ server.py β All tools live here (FastMCP)
βββ tests/
β βββ test_server.py
βββ pyproject.toml
βββ README.md
Search modes:
| Mode | When | How |
|---|---|---|
| π§ Semantic | [semantic] installed |
HuggingFace all-MiniLM-L6-v2 + ChromaDB (local, no API key) |
| π Keyword | Fallback | Token-overlap scoring across indexed chunks |
Supported languages: Python Β· JavaScript Β· TypeScript Β· PHP Β· Ruby Β· Go Β· Java Β· C# Β· C/C++ Β· Rust Β· Swift
π Bug Detection Patterns
CodeSense scans for:
- π΄ Hardcoded secrets / credentials
- β οΈ Bare
except:clauses - β οΈ Mutable default arguments
- β οΈ Empty except blocks
- π‘ Leftover
print()debug statements - π TODO / FIXME / HACK comments
- π‘ Missing type annotations
π§ Refactor Analysis
For each file, CodeSense checks:
- π Functions longer than 50 lines
- πͺ Nesting depth greater than 4 levels
- π’ Magic numbers (unnamed constants)
- π¦ Files larger than 300 lines
- β»οΈ Duplicated code patterns
- π Missing docstrings
π οΈ Development
git clone https://github.com/attaelahi/codesense-mcp
cd codesense-mcp
uv venv && source .venv/bin/activate
uv pip install -e ".[semantic]"
# Test the server directly
python -m codesense_mcp.server
# Run with MCP Inspector
npx @modelcontextprotocol/inspector python -m codesense_mcp.server
πΊοΈ Roadmap
- [ ] Git diff analysis β "What changed in the last 10 commits?"
- [ ] Dependency graph visualization
- [ ] Cross-file call graph tracing
- [ ] Laravel/PHP-specific analysis (routes, controllers, models)
- [ ] CI/CD integration (GitHub Actions)
- [ ] Persistent index (survive restarts)
- [ ] Remote codebase support (GitHub URLs)
π€ Contributing
PRs welcome! See CONTRIBUTING.md.
If you find this useful, a β star goes a long way.
π License
MIT Β© Atta Elahi
π Built With
- Model Context Protocol β Anthropic's open standard for tool use
- FastMCP β Pythonic MCP server framework
- LangChain β Chunking & retrieval pipeline
- ChromaDB β Local vector store
- HuggingFace Sentence Transformers β Local embeddings (no API key!)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.