π AI-powered code discovery through natural language - Built entirely around the Model Context Protocol (MCP) for seamless integration with Claude Desktop and other AI clients.
CodeSage - MCP-First Code Discovery - The only code discovery tool built entirely around the Model Context Protocol for seamless AI integration.
Built for the Algolia MCP Server Challenge π
Competing in the Backend Data Optimization and Ultimate User Experience categories with our innovative MCP-first approach to code discovery.
CodeSage - MCP-First Code Discovery transforms GitHub repositories into AI-searchable knowledge bases through the Model Context Protocol. Submit a repository URL, and within minutes your AI assistant can discover functions, understand architecture, and answer complex questions about the codebase through natural language - all via MCP integration.
1. User submits: github.com/facebook/react
2. System processes: GitHub β Parser β Algolia
3. User opens Claude Desktop
4. User asks: "Show me React's rendering lifecycle"
5. Claude uses MCP tools to search and analyze
6. User gets AI-powered code insights
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Frontend βββββΆβ Backend βββββΆβ Algolia β
β (Simple) β β (Processing) β β (Search) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β
βΌ
ββββββββββββββββ βββββββββββββββ
β MCP βββββΆβ Claude β
β Protocol β β Desktop β
ββββββββββββββββ βββββββββββββββ
- Repository Management: Frontend β Backend
- Code Discovery: Claude Desktop β MCP β Backend β Algolia
- No Direct Integration: Frontend never talks to Algolia or MCP
- Built entirely around Model Context Protocol - the only code discovery tool with this architecture
- Works with Claude Desktop and any MCP-compatible AI client
- No direct AI API calls - all intelligence through MCP integration
- Seamless AI Integration - designed specifically for MCP-based AI workflows
- Automatic ingestion from GitHub repository URLs
- Code parsing for functions, classes, imports across multiple languages
- Algolia indexing for fast, semantic code search
- Ask questions like "How does authentication work?"
- AI models search and analyze through MCP tools
- Contextual, conversational code exploration
- Submit repository URLs for processing
- Track processing status (pending β processing β completed)
- Manage repository lifecycle (create, list, delete)
- Python 3.9+ with virtual environment
- Node.js 18+ and npm
- Algolia account (App ID + Admin API Key)
# Setup environment
make setup
# Edit .env with your Algolia credentials
# Start backend + frontend together
make start
# Or start individually:
make start-backend # Backend on :8001
make start-frontend # Frontend on :5173If you prefer to run servers manually without Make commands:
# Navigate to project root
cd /Users/ntanwir/Developer/codesage-algolia-challenge
# Activate virtual environment
source .venv/bin/activate
# Go to backend directory
cd backend
# Start FastAPI server
python -m uvicorn app.main:app --reload --port 8001# Navigate to project root
cd /Users/ntanwir/Developer/codesage-algolia-challenge
# Go to frontend directory
cd frontend
# Install dependencies (first time only)
npm install
# Start React development server
npm run devBackend Server (Terminal 1):
INFO: Uvicorn running on http://127.0.0.1:8001 (Press CTRL+C to quit)
INFO: Started reloader process [xxxxx] using WatchFiles
INFO: Started server process [xxxxx]
INFO: Waiting for application startup.
INFO: Application startup complete.
β
Backend ready: http://localhost:8001
- API Docs:
http://localhost:8001/docs - Health Check:
http://localhost:8001/health
Frontend Server (Terminal 2):
Local: http://localhost:5173/
Network: use --host to expose
press h + enter to show help
β
Frontend ready: http://localhost:5173
# Test backend health (in Terminal 3)
curl http://localhost:8001/health
# Test MCP endpoints
curl http://localhost:8001/api/v1/ai/mcp# For container-based development
make build
make up # Both services via Docker
# Check status
make health
make logsβ Use Development Mode when:
- Actively developing/debugging code
- Need fast reload/hot-swapping
- Working on frontend styling
- Debugging MCP integration
β Use Docker Mode when:
- Testing production-like environment
- Demonstrating to others
- CI/CD pipeline
- Consistent environment across team
Create .env file with your Algolia credentials:
ALGOLIA_APP_ID=your_app_id
ALGOLIA_ADMIN_API_KEY=your_admin_key
SECRET_KEY=your-secret-key-hereOnce your backend is running on :8001, test these endpoints:
# 1. MCP Server Information (NEW!)
curl http://localhost:8001/api/v1/ai/mcp
# 2. MCP Capabilities
curl http://localhost:8001/api/v1/ai/mcp/capabilities
# 3. Available MCP Tools
curl http://localhost:8001/api/v1/ai/mcp/tools
# 4. Tool Call Instructions (if you try GET - shows how to use POST)
curl http://localhost:8001/api/v1/ai/mcp/tools/call
# 5. MCP Resources (with required uri parameter)
curl "http://localhost:8001/api/v1/ai/mcp/resources/read?uri=codesage://repositories"
# 6. Resources without uri (shows usage instructions)
curl http://localhost:8001/api/v1/ai/mcp/resources/read
# 7. Execute Tool (POST request - the correct way)
curl -X POST http://localhost:8001/api/v1/ai/mcp/tools/call \
-H "Content-Type: application/json" \
-d '{"tool_name": "search_code", "arguments": {"query": "function"}}'π‘ Common Errors Fixed:
- β
GET /mcp/tools/callβ β Now shows usage instructions - β
GET /mcp/resources/read(no uri) β β Now shows required parameters - β All endpoints now provide helpful error messages
π‘ Tip: Visit http://localhost:8001/docs for interactive API documentation!
- Submit repository: POST to
/api/v1/repositories/with GitHub URL - Wait for processing: Repository status becomes "completed"
- Connect Claude Desktop: Configure MCP connection to
http://localhost:8001 - Ask questions: Use natural language to explore the codebase
GET /api/v1/repositories/ # List repositories
POST /api/v1/repositories/ # Create repository
GET /api/v1/repositories/{id} # Get repository
DELETE /api/v1/repositories/{id} # Delete repository
GET /api/v1/ai/mcp/capabilities # MCP server capabilities
GET /api/v1/ai/mcp/tools # List MCP tools
POST /api/v1/ai/mcp/tools/call # Execute MCP tool
GET /api/v1/ai/mcp/resources/read # Read MCP resource
search_code- Natural language code search across repositoriesanalyze_repository- Repository overview and architectural insightsexplore_functions- Function discovery and relationship mappingexplain_code- Detailed code explanations and documentationfind_patterns- Pattern detection for security, performance, architecture
- FastAPI - Modern Python web framework
- SQLAlchemy - Database ORM with PostgreSQL/SQLite
- Algolia - Search and indexing engine
- Pydantic - Data validation and settings
- React 18 - Modern UI framework
- TypeScript - Type safety
- TailwindCSS - Utility-first styling
- Vite - Fast development and building
- Model Context Protocol - AI integration standard (our primary differentiator)
- Claude Desktop - Primary AI client with seamless MCP integration
- Tool-based architecture - Extensible AI capabilities through MCP tools
- MCP-First Design - Every feature built around MCP protocol standards
docs/architecture.md- Technical architecture and implementation details.env.example- Environment configuration template
codesage-algolia-challenge/
βββ backend/ # FastAPI MCP Server
β βββ app/
β β βββ api/v1/endpoints/ # API endpoints (repositories, ai, performance)
β β βββ core/ # Configuration and database
β β βββ models/ # SQLAlchemy models
β β βββ schemas/ # Pydantic schemas
β β βββ services/ # Business logic services
β β βββ main.py # FastAPI application
β βββ requirements.txt # Python dependencies
β βββ Dockerfile # Container configuration
βββ frontend/ # React TypeScript UI
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Application pages
β β βββ services/ # API client and WebSocket
β β βββ types/ # TypeScript definitions
β βββ package.json # Node.js dependencies
βββ deployment/ # Infrastructure & deployment
β βββ docker-compose.yml # Development setup
β βββ docker-compose.prod.yml # Production setup
β βββ nginx.conf # Reverse proxy config
β βββ DOCKER.md # Docker documentation
βββ tests/ # Organized test suites
β βββ api/ # API endpoint tests
β βββ mcp/ # MCP protocol tests
β βββ postman/ # Postman collection
βββ docs/ # Technical documentation
βββ README.md # Project overview