Sponsored by Deepsite.site

MCP Server for Smithery Integration

Created By
sosacrazy1268 months ago
MCP Server for integrating Greptile API with Smithery Framework, featuring rate limiting and API abstraction
Content

MCP Server for Smithery Integration

This project implements a FastAPI-based MCP (Model Context Protocol) server that integrates the Greptile API with the Smithery Framework, enabling AI agents to comprehend and interact with codebases.

Project Overview

The MCP Server acts as a critical intermediary between Smithery's AI agents and the Greptile API, providing:

  • Standardized MCP-compliant endpoints
  • Robust rate limiting
  • Authentication and security mechanisms
  • Error handling and data transformation
  • Consistent response formatting

Rate Limiter Implementation

The rate limiter implementation is defined in app/core/rate_limit.py and has the following components:

Core Components

  1. RateLimitStorage (ABC): Abstract base class for storage backends

    • Defines interface with increment, reset, and get_count methods
    • Allows for different storage implementations
  2. InMemoryRateLimitStorage: Default implementation

    • Stores counters in memory using Python dictionaries
    • Tracks both counts and window expiry times
    • Not suitable for distributed environments
  3. RateLimiter: Main service class

    • Configurable via environment variables
    • Provides check_rate_limit and reset_rate_limit methods
    • Returns detailed limit information
  4. FastAPI Integration:

    • Middleware implementation (RateLimitMiddleware)
    • Dependency function (rate_limiter())
    • Standard rate limit headers

Configuration Options

# Settings for rate limiting
RATE_LIMIT_ENABLED: bool = True
RATE_LIMIT_REQUESTS: int = 60
RATE_LIMIT_PERIOD_SECONDS: int = 60

Limitations & Future Enhancements

  1. Scalability: Current implementation uses in-memory storage, which doesn't scale across multiple instances. Future implementation should use Redis or similar distributed cache.

  2. External API Awareness: Should track Greptile API quotas and adapt rate limits accordingly.

  3. Per-Service Limits: Implement separate rate limits for different services and endpoints.

  4. Advanced Strategies: Consider implementing token bucket or sliding window algorithms for more sophisticated rate limiting.

Integration with Smithery

This MCP server follows the requirements for integration with the Smithery Framework by:

  1. Providing standardized endpoints that map to Greptile functionality
  2. Implementing proper authentication and security mechanisms
  3. Transforming data between Greptile API format and MCP format
  4. Abstracting complex logic into a standardized interface

Development

To run the server locally:

# Set up environment
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env with your Greptile API key

# Run server
uvicorn app.main:app --reload

License

MIT License

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Serper MCP ServerA Serper MCP Server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs