MCP Code Conventions Server
Provides AI agents with structured access to project conventions, technology stacks, and architectural patterns to ensure consistency across development teams.
README
MCP Code Conventions Server
A Model Context Protocol (MCP) server that provides AI agents with structured access to project conventions, technology stacks, and architectural patterns. Ensures consistency across development teams by maintaining project standards in easily accessible markdown files.
๐ก Inspiration
This project was inspired by the blog post "เนเธเนเธเธเธฒเธ AI เธเธฐเนเธกเนเธซเธฅเธธเธ style เธญเธตเธเธเนเธญเนเธ เธเนเธฒเธเธตเธกเธกเธต conventions เธเธฒเธ MCP Server" by Jassadakorn.ket (Jul 18, 2025) on tech @TDG.
The Problem
AI-generated code often doesn't follow team conventions, coding standards, or project-specific patterns, leading to:
- Inconsistent Code Style: AI doesn't know your team's preferred patterns
- Architecture Mismatches: Generated code may not align with project structure
- Technology Conflicts: AI might suggest libraries or approaches that don't fit your stack
- Manual Corrections: Developers spend time fixing AI-generated code to match standards
The Solution
This MCP server provides AI agents with direct access to your team's:
- Project Context: Business goals, target users, and feature requirements
- Technology Standards: Approved frameworks, libraries, and tools
- Code Organization: File structure, naming conventions, and architectural patterns
Result: AI agents generate code that follows your team's conventions from the start! ๐ฏ
โก Quick Start
# Using Docker (Recommended)
docker-compose up -d
# Or run locally
uv pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000
Access the API at http://localhost:8000 and docs at http://localhost:8000/docs
๐ Features
- ๐ง Dynamic Tool Configuration: Define tools in
/app/tools.jsonfor easy customization - ๐ Markdown Storage: Human-readable project conventions stored as markdown files
- ๐ Automatic Fallback: Projects inherit from default when specific files don't exist
- ๐ API Key Authentication: Secure access with Bearer token authentication
- ๐ณ Docker Ready: Self-contained deployment with embedded default data
- ๐ค MCP Protocol: Direct integration with AI agents via Model Context Protocol
- ๐ HTTP API: RESTful endpoints for programmatic access
๐ Available Tools
Project Context Tools
- Project Overview: Business description, target users, and main features
- Technology Stack: Frontend, backend, database, infrastructure, and development tools
- Project Structure: Folder organization, naming conventions, and architecture patterns
API Endpoints
GET /{project_id}/project-overview # Get project overview
POST /{project_id}/project-overview # Update project overview
GET /{project_id}/technology-stack # Get technology stack
POST /{project_id}/technology-stack # Update technology stack
GET /{project_id}/project-structure # Get project structure
POST /{project_id}/project-structure # Update project structure
๐ Installation & Setup
Prerequisites
- Python 3.12+
- Docker & Docker Compose (optional)
uvpackage manager
Environment Setup
# Clone repository
git clone <your-repository-url>
cd mcp_code_conventions
# Copy environment file
cp .env.example .env
# Edit .env with your API key
# Install dependencies
uv pip install -r requirements.txt
Docker Deployment (Recommended)
# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
Local Development
# Start FastAPI server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
# Or run MCP server directly
python run_mcp_server.py
๐ง Configuration
Environment Variables
API_KEY=your-secret-api-key # Bearer token for authentication
DATA_DIR=/app/data # Directory for markdown files
DEFAULT_PROJECT_ID=default # Default project identifier
Tool Configuration (/app/tools.json)
{
"project_overview": {
"name": "get_project_overview",
"description": "Call this tool when you need to understand the business context...",
"file": "PROJECT_OVERVIEW.md"
},
"technology_stack": {
"name": "get_technology_stack",
"description": "Call this tool to get an overview of the technologies...",
"file": "TECHNOLOGY_STACK.md"
}
}
๐ก API Usage
Authentication
All endpoints require Bearer token authentication:
curl -H "Authorization: Bearer your-secret-api-key" \
http://localhost:8000/myproject/project-overview
Example API Calls
# Get project overview
curl -H "Authorization: Bearer your-secret-api-key" \
http://localhost:8000/myproject/project-overview
# Update technology stack
curl -X POST \
-H "Authorization: Bearer your-secret-api-key" \
-H "Content-Type: application/json" \
-d '{
"data": {
"frontend": "React 18, TypeScript",
"backend": "Python FastAPI",
"database": "PostgreSQL"
}
}' \
http://localhost:8000/myproject/technology-stack
๐ค AI Agent Integration
Claude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"code-conventions": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-fetch"],
"env": {
"MCP_SERVER_URL": "http://localhost:8000/myproject",
"MCP_API_KEY": "your-secret-api-key"
}
}
}
}
Available MCP Tools
get_project_overview- Understand business context and user needsupdate_project_overview- Update project requirements and objectivesget_technology_stack- Check existing technologies and frameworksupdate_technology_stack- Add new tools and technologiesget_project_structure- Align with file organization and naming conventionsupdate_project_structure- Update architectural patterns
๐ Project Structure
mcp_code_conventions/
โโโ app/
โ โโโ data/ # Markdown data storage
โ โ โโโ default/ # Default project templates
โ โ โโโ PROJECT_OVERVIEW.md
โ โ โโโ TECHNOLOGY_STACK.md
โ โ โโโ PROJECT_STRUCTURE.md
โ โโโ schemas/ # Pydantic validation schemas
โ โโโ tools/ # API endpoint implementations
โ โโโ auth.py # Authentication logic
โ โโโ config.py # Configuration settings
โ โโโ main.py # FastAPI application
โ โโโ mcp_server.py # MCP protocol server
โ โโโ storage.py # File storage operations
โ โโโ tool_loader.py # Dynamic tool configuration
โ โโโ tools.json # Tool definitions
โโโ docker-compose.yml # Container orchestration
โโโ Dockerfile # Container configuration
โโโ requirements.txt # Python dependencies
โโโ run_mcp_server.py # MCP server entry point
๐ Multi-Project Support
Project Inheritance
Projects automatically inherit from the default project when specific files don't exist:
- Project-specific file (
/app/data/myproject/PROJECT_OVERVIEW.md) - Used if exists - Default fallback (
/app/data/default/PROJECT_OVERVIEW.md) - Used as fallback - Generated default - Created if neither exists
Managing Multiple Projects
# Project-specific endpoints
GET /myproject/project-overview # Uses myproject data or falls back to default
GET /webapp/technology-stack # Uses webapp data or falls back to default
GET /api/project-structure # Uses api data or falls back to default
# Default project (inherited by others)
GET /default/project-overview # Always uses default data
๐ ๏ธ Development
Adding New Tools
- Update
/app/tools.jsonwith new tool definition - Create corresponding markdown template in
/app/data/default/ - Restart server to load new configuration
Testing
# Run with development server
uvicorn app.main:app --reload
# Test API endpoints
curl -H "Authorization: Bearer your-secret-api-key" \
http://localhost:8000/health
๐ณ Docker Configuration
Dockerfile Features
- Python 3.12 slim base image
- Uses
uvfor faster package installation - Embeds default project data in image
- No external volume dependencies
- Runs on port 8000
Docker Compose Services
- app: Main FastAPI application
- Environment: API key and data directory configuration
- No volumes: Self-contained with embedded data
๐ API Reference
Health Check
GET /- Server statusGET /health- Health check endpoint
MCP Protocol
POST /mcp- MCP endpoint for default projectPOST /mcp/{project_id}- MCP endpoint for specific project
Tool Endpoints
GET /{project_id}/{tool-name}- Get tool contentPOST /{project_id}/{tool-name}- Update tool contentGET /tool/{custom-tool}- Generic tool access
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Special thanks to Jassadakorn.ket and tech @TDG (Medium) for the inspiring blog post (Jul 18, 2025) that identified the core problem this project solves: ensuring AI-generated code follows team conventions and standards.
๐ค AI Use Disclaimer
This project was developed with assistance from AI tools, specifically Claude (Anthropic).
AI Contributions Include:
- Code Architecture: System design and implementation patterns
- Documentation: README, API documentation, and inline comments
- Configuration: Docker setup, environment configuration, and deployment scripts
- Testing: Test scenarios and validation approaches
- Best Practices: Security implementations, error handling, and code organization
Human Oversight:
- Requirements Definition: Project goals and specifications were human-defined
- Code Review: All AI-generated code has been reviewed and validated
- Testing: Manual testing and validation of functionality
- Deployment: Production deployment decisions and configurations
- Maintenance: Ongoing updates and improvements
Transparency:
We believe in transparent development practices. This disclaimer ensures users understand the collaborative nature of this project between human developers and AI assistance. The code quality, security, and functionality remain the responsibility of the human maintainers.
Quality Assurance:
- All code follows established best practices
- Security measures have been implemented and reviewed
- The system has been tested for reliability and performance
- Documentation accurately reflects the implemented functionality
For questions, issues, or contributions, please use the GitHub repository's issue tracker.
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.