mcp-community-tools
Enables querying community chatter data and world country information through tools like get_top_10_highest_comments and fetch_countries, designed for integration with GitHub Copilot.
README
MCP Community Tools - Model Context Protocol Server
A professional-grade MCP (Model Context Protocol) server that provides tools for querying community and world databases. Designed with clean architecture patterns and ready for integration with GitHub Copilot.
๐ฏ Quick Start
1. Connect to GitHub Copilot (3 steps)
See QUICK_START.md for instant setup.
TL;DR:
- Open VS Code Settings (Cmd+,)
- Add this to
settings.json:
{
"github.copilot.mcp": [
{
"name": "mcp-community-tools",
"command": "${workspaceFolder}/.venv/bin/python3",
"args": ["${workspaceFolder}/hello_mcp.py"],
"env": {"PYTHONPATH": "${workspaceFolder}"}
}
]
}
- Restart VS Code
2. Ask Copilot
Now you can ask Copilot to use your tools:
- "Get the top 10 highest comments"
- "Show me 5 countries from Europe"
- "Generate a random name"
๐ Available Tools
| Tool | Description | Example |
|---|---|---|
get_random_name() |
Generate a random name | get_random_name() |
get_top_10_highest_comments() |
Get top 10 users by message count | Returns: Top 10 chatters |
fetch_countries() |
Query countries by region and limit | fetch_countries(region="Asia", limit=5) |
๐๏ธ Project Structure
mcp-course/
โโโ hello_mcp.py # Main entry point (50 lines - clean!)
โโโ setup-copilot.sh # Auto-generate config helper
โโโ QUICK_START.md # 3-step Copilot integration
โโโ SETUP_COPILOT.md # Detailed setup guide
โโโ ARCHITECTURE.md # Design patterns & structure
โโโ INTEGRATION_DIAGRAM.md # Visual flow diagrams
โโโ REFACTORING_SUMMARY.md # Before/after comparison
โ
โโโ db_connection/
โ โโโ connection.py # Database Connection Factory
โ
โโโ repositories/
โ โโโ base_repository.py # Abstract Base Class
โ โโโ chatters_repository.py # Community data queries
โ โโโ countries_repository.py # World data queries
โ
โโโ tools/
โ โโโ tools.py # Tool implementations (DI)
โ
โโโ db/
โโโ community.db # Chatters data (251 records)
โโโ world.db # Countries data (250 records)
โจ Key Features
๐ฏ Clean Architecture
- Repository Pattern: Database access abstraction
- Dependency Injection: Loose coupling between layers
- Factory Pattern: Centralized connection management
- SOLID Principles: All five principles applied
๐ก๏ธ Professional Code
- โ Type hints throughout
- โ Comprehensive error handling
- โ Well-documented with docstrings
- โ Easy to test and extend
๐ Ready for Production
- โ Works with GitHub Copilot
- โ Works with Claude Desktop
- โ Works with any MCP-compatible client
- โ Secure local execution
๐ Documentation
| Document | Purpose |
|---|---|
| QUICK_START.md | Get Copilot working in 3 steps |
| SETUP_COPILOT.md | Detailed setup & troubleshooting |
| ARCHITECTURE.md | Design patterns & principles |
| INTEGRATION_DIAGRAM.md | Visual flows and connections |
| REFACTORING_SUMMARY.md | Before/after code comparison |
๐ Running Locally
Prerequisites
- Python 3.11+
- Virtual environment (
venv)
Setup
# Clone and enter directory
cd /Users/souravkumar/WebstormProjects/mcp-course
# Activate virtual environment
source .venv/bin/activate
# Install dependencies (if needed)
pip install -r requirements.txt
Run Server
python3 hello_mcp.py
Output should show:
Server started on stdio
๐ Integration Options
Option 1: GitHub Copilot in VS Code โ RECOMMENDED
See QUICK_START.md
Option 2: Claude Desktop App
See SETUP_COPILOT.md - Claude Desktop section
Option 3: Manual Testing
# Terminal 1: Start server
python3 hello_mcp.py
# Terminal 2: Test tools
curl -X POST http://localhost:3000/call \
-H "Content-Type: application/json" \
-d '{"tool": "get_top_10_highest_comments"}'
๐พ Databases
community.db
SELECT * FROM chatters;
-- id, name, messages, last_message_at
251 community members with activity tracking
world.db
SELECT * FROM countries;
-- id, name, iso2, iso3, capital, region, subregion, currency, currency_symbol, phonecode, emoji
250 countries with detailed information
๐ ๏ธ Example Usage with Copilot
Example 1: Get Top Commenters
You: "Who are the top 10 most active community members?"
Copilot:
โ Calls: get_top_10_highest_comments()
โ Returns: Top 10 users with message counts
โ Shows: Their last activity timestamps
Example 2: Find Countries
You: "Show me all European countries and their capitals"
Copilot:
โ Calls: fetch_countries(region="Europe")
โ Returns: All 50 European countries
โ Shows: Capital, currency, phone code, flag emoji
Example 3: Generate Names
You: "Give me 5 random names"
Copilot:
โ Calls: get_random_name() (5 times)
โ Returns: 5 random names from the list
๐๏ธ Architecture at a Glance
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub Copilot / Claude โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Protocol (JSON-RPC)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ hello_mcp.py (Tool Registration) โ
โ โโ @mcp.tool() decorators โ
โ โโ Dependency injection setup โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ tools/tools.py (Business Logic) โ
โ โโ TopCommentsTool โ
โ โโ CountriesTool โ
โ โโ RandomNameTool โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ repositories/ (Data Access) โ
โ โโ ChattersRepository โ
โ โโ CountriesRepository โ
โ โโ BaseRepository (Abstract) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ db_connection/ (Connection Factory) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ db/ (SQLite Databases) โ
โ โโ community.db โ
โ โโ world.db โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ SOLID Principles Applied
โ
Single Responsibility: Each class has one reason to change
โ
Open/Closed: Open for extension, closed for modification
โ
Liskov Substitution: Repositories are interchangeable
โ
Interface Segregation: Minimal required interfaces
โ
Dependency Inversion: Depend on abstractions, not concretions
๐ Security
- โ Local Execution: Runs on your machine only
- โ No Data Upload: All data stays local
- โ No Authentication: Local database access
- โ Read-Only: Tools only query, don't modify data
๐งช Testing
Run Tests (when available)
pytest tests/
Manual Testing
from repositories.chatters_repository import ChattersRepository
from db_connection.connection import DatabaseConnection
conn = DatabaseConnection.get_connection("community.db")
repo = ChattersRepository(conn)
results = repo.get_top_highest_comments(10)
print(results)
repo.close()
๐ค Contributing
To add a new tool:
-
Create a Repository (if needed):
# repositories/my_data_repository.py class MyDataRepository(BaseRepository): def get_data(self): return self.execute_query("SELECT * FROM my_table") -
Create a Tool:
# In tools/tools.py class MyDataTool: def __init__(self, repository): self.repository = repository def execute(self): return self.repository.get_data() -
Register in hello_mcp.py:
@mcp.tool() def my_data_tool() -> list[dict]: conn = DatabaseConnection.get_connection("my_db.db") repo = MyDataRepository(conn) tool = MyDataTool(repo) return tool.execute()
๐ Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| "Tool not found" in Copilot | Restart VS Code completely (Cmd+Q) |
| "ModuleNotFoundError" | Check PYTHONPATH in config |
| Connection timeout | Verify hello_mcp.py runs without errors |
| Tools not available | Wait 10 seconds after restart for extension load |
For detailed troubleshooting, see SETUP_COPILOT.md
๐ License
MIT License - Feel free to use, modify, and distribute.
๐ Learning Resources
โ Quick Checklist
- [ ] Read QUICK_START.md
- [ ] Copy configuration to
settings.json - [ ] Restart VS Code
- [ ] Test with Copilot
- [ ] Read ARCHITECTURE.md to understand design
- [ ] Check INTEGRATION_DIAGRAM.md for visuals
๐ You're Ready!
Your MCP server is production-ready. Enjoy using it with GitHub Copilot! ๐
Questions? Check the documentation files or the troubleshooting section above.
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.
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.
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.
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.