A complete AI agent system with custom Model Context Protocol (MCP) tools for GitHub repository analysis. Built with LangGraph, Gemini AI, FastMCP, and React.
An AI agent that can:
- π Analyze GitHub repositories - Get stars, forks, issues, activity stats
- π¦ Scan dependencies - Discover dependencies across Python, Node.js, Go, Rust, Ruby, Java
- π¬ Stream responses - Real-time AI responses through a web interface
- π§ Use custom tools - Extensible MCP architecture for adding new capabilities
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Browser (localhost:5173) β
β React + TypeScript Frontend β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β UI Backend (localhost:5003) β
β Fastify + Node.js Proxy β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent (localhost:8081) β
β LangGraph + Gemini AI + LangChain β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Server (localhost:5001) β
β FastMCP + Custom Tools β
β β’ GitHub Stats Tool β’ GitHub Dependencies Tool β
β β’ Multiply Tool β’ Code Review Tool β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β
GitHub Public API
- Python 3.11+ for MCP server and agent
- Node.js 18+ for UI
- Gemini API key from https://ai.google.dev/
cd template-mcp-server
# Install dependencies
pip install -e .
# Start the server
python -m template_mcp_server.src.main
# Server runs on http://localhost:5001cd template-agent
# Create .env file
cat > .env << EOF
GEMINI_API_KEY="your-gemini-api-key-here"
MCP_SERVER_HOST=http://localhost:5001/mcp/
MCP_TRANSPORT_PROTOCOL=streamable_http
AGENT_HOST=http://127.0.0.1:8081
AGENT_PORT=8081
EOF
# Install dependencies
pip install -e .
# Start the agent
python -m template_agent.src.main
# Agent runs on http://127.0.0.1:8081cd template-ui
# Create .env file
cat > .env << EOF
AGENT_HOST=http://127.0.0.1:8081
PORT=5003
AUTH_ENABLED=false
COOKIE_SIGN=super-secret-cookie-signing-key-minimum-32-chars-long
EOF
# Install dependencies
npm install
# Start both frontend and backend
npm run dev
# UI opens at http://localhost:5173Open http://localhost:5173 and ask:
- "What are the stats for facebook/react?"
- "What are the dependencies for langchain-ai/langgraph?"
- "What is 25 times 17?"
Hackathon/
βββ template-mcp-server/ # Custom MCP tools server
β βββ template_mcp_server/
β β βββ src/
β β βββ tools/
β β β βββ github_stats_tool.py β Custom
β β β βββ github_dependencies_tool.py β Custom
β β βββ mcp.py # Tool registration
β β βββ settings.py # Configuration
β βββ HACKATHON_SETUP.md # Detailed MCP docs
β
βββ template-agent/ # AI Agent with LangGraph
β βββ template_agent/
β β βββ src/
β β βββ core/
β β β βββ agent.py # Agent initialization
β β β βββ manager.py # Conversation management
β β βββ routes/
β β βββ stream.py # Streaming endpoint
β βββ .env # Config (create this)
β βββ HACKATHON_SETUP.md # Detailed agent docs
β
βββ template-ui/ # Web interface
β βββ src/
β β βββ frontend/ # React app
β β βββ server/ # Fastify backend
β β βββ controllers/
β β βββ v1/
β β βββ agent.ts # Proxy to agent
β βββ index.html # Frontend entry
β βββ .env # Config (create this)
β βββ HACKATHON_SETUP.md # Detailed UI docs
β
βββ README.md # This file
- Tool:
get_github_repo_stats - Input:
owner/repo(e.g.,microsoft/vscode) - Output: Stars, forks, issues, PRs, languages, dates, URLs
- File:
template-mcp-server/template_mcp_server/src/tools/github_stats_tool.py
- Tool:
get_github_dependencies - Input:
owner/repo - Output: Dependencies by ecosystem (Python, Node.js, Go, Rust, Ruby, Java)
- File:
template-mcp-server/template_mcp_server/src/tools/github_dependencies_tool.py
- β Real-time streaming - See AI responses as they're generated
- β Tool use visualization - Watch the agent decide which tools to use
- β Custom MCP tools - Easily add new capabilities
- β Conversation history - Maintains context across messages
- β HTML rendering - Agent can return styled HTML responses
- β Error handling - Graceful fallbacks and error messages
- FastMCP - MCP protocol implementation
- Python 3.11 - Runtime
- Pydantic - Configuration management
- LangGraph - Agent orchestration
- LangChain - LLM framework
- Google Gemini - AI model (gemini-2.5-flash)
- Uvicorn - ASGI server
- React 18 - Frontend framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Fastify - Backend API server
- TailwindCSS - Styling
No configuration needed - uses defaults from settings.py
GEMINI_API_KEY="your-key-here" # Required
MCP_SERVER_HOST=http://localhost:5001/mcp/ # MCP endpoint
MCP_TRANSPORT_PROTOCOL=streamable_http # Must match server
AGENT_HOST=http://127.0.0.1:8081 # Agent endpoint
AGENT_PORT=8081 # Agent portAGENT_HOST=http://127.0.0.1:8081 # Agent endpoint
PORT=5003 # Backend port
AUTH_ENABLED=false # For development
COOKIE_SIGN=your-secret-key-here # Cookie signing- Check if port 5001 is available:
lsof -i :5001 - Verify Python 3.11+:
python --version - Check logs in terminal output
- Verify Gemini API key is set in
.env - Check MCP server is running on port 5001
- Check if port 8081 is available:
lsof -i :8081 - View logs:
tail -f agent.log
- Check if ports 5003 and 5173 are available
- Verify Node.js 18+:
node --version - Check agent is running on port 8081
- View backend logs:
tail -f server.log
- You've hit Gemini's free tier limit (250 requests/day)
- Wait for quota reset or upgrade to paid plan
- Get new API key from different Google account
- Verify all services are running
- Check browser console for CORS errors
- Ensure
.envfiles have correct ports - Try restarting the UI backend
# MCP Server (stdout)
cd template-mcp-server && python -m template_mcp_server.src.main
# Agent
tail -f template-agent/agent.log
# UI Backend
tail -f template-ui/server.log
# UI Frontend
Check browser console (F12)# MCP Server
curl http://localhost:5001/
# Agent
curl http://127.0.0.1:8081/
# UI Backend
curl http://localhost:5003/
# UI Frontend
curl http://localhost:5173/User: "Compare the stats for facebook/react and vuejs/vue"
Agent:
- Calls
get_github_repo_stats("facebook/react") - Calls
get_github_repo_stats("vuejs/vue") - Synthesizes comparison with Gemini
- Returns styled HTML comparison
User: "What dependencies does langchain-ai/langgraph use?"
Agent:
- Calls
get_github_dependencies("langchain-ai/langgraph") - Parses
pyproject.toml - Returns organized list by category
User: "Get stats for microsoft/vscode and check its dependencies"
Agent:
- Calls
get_github_repo_stats("microsoft/vscode") - Calls
get_github_dependencies("microsoft/vscode") - Combines results into comprehensive report
| Service | Port | URL |
|---|---|---|
| MCP Server | 5001 | http://localhost:5001 |
| Agent | 8081 | http://127.0.0.1:8081 |
| UI Backend | 5003 | http://localhost:5003 |
| UI Frontend | 5173 | http://localhost:5173 |
- MCP Protocol: How to build custom tools that AI agents can discover and use
- LangGraph: Agent orchestration with tool calling
- Streaming: Real-time response streaming through multiple proxy layers
- Tool Design: Structuring tool inputs/outputs for optimal AI use
- Full Stack AI: Connecting frontend β backend β agent β MCP tools β external APIs
See individual project LICENSE files.
Built during Red Hat Hackathon π