Skip to main content
Glama
mcp-community-tools

mcp-community-tools

by sourav267

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:

  1. Open VS Code Settings (Cmd+,)

  2. 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}"}
    }
  ]
}
  1. 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"


Related MCP server: GitHub MCP TypeScript SDK Server

πŸ“š 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:

  1. 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")
  2. Create a Tool:

    # In tools/tools.py
    class MyDataTool:
        def __init__(self, repository):
            self.repository = repository
        def execute(self):
            return self.repository.get_data()
  3. 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


πŸš€ 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.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to interact with GitHub repositories, Confluence documentation, and Databricks Unity Catalog through comprehensive tools for code exploration, documentation retrieval, and data schema management.
      19
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive access to GitHub repositories, issues, pull requests, commits, user profiles, and statistics through 10 tools with natural language query support and advanced search capabilities.
      MIT