MCP Server for Smithery Integration

MCP Server for Smithery Integration

By sosacrazy126 GitHub

MCP Server for integrating Greptile API with Smithery Framework, featuring rate limiting and API abstraction

mcp-server greptile-api
Overview

What is MCP Server for Smithery Integration?

The MCP Server for Smithery Integration is a FastAPI-based server that connects the Greptile API with the Smithery Framework, enabling AI agents to understand and interact with codebases effectively.

How to use MCP Server?

To use the MCP Server, set up a local environment, configure your Greptile API key in the environment variables, and run the server using Uvicorn.

Key features of MCP Server?

  • Standardized MCP-compliant endpoints for seamless integration.
  • Robust rate limiting to manage API requests.
  • Authentication and security mechanisms to protect data.
  • Error handling and data transformation for consistent responses.

Use cases of MCP Server?

  1. Integrating AI agents with codebases for enhanced comprehension.
  2. Managing API requests efficiently with rate limiting.
  3. Providing a secure interface for AI interactions with external APIs.

FAQ from MCP Server?

  • What is the purpose of the MCP Server?

The MCP Server acts as an intermediary between Smithery's AI agents and the Greptile API, facilitating interaction and comprehension of codebases.

  • How do I run the MCP Server locally?

You can run the server by setting up a virtual environment, installing the required packages, configuring your API key, and starting the server with Uvicorn.

  • Is there a limit on API requests?

Yes, the server implements rate limiting to control the number of requests and ensure fair usage.

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

No tools information available.

-

mcp-server v2ex
View Details

my-mcp-server(without auth)

mcp-server cloudflare
View Details
mcp-server
mcp-server by iyerrama29

MCP demo

mcp-server demo
View Details
Next MCP server
Next MCP server by Collaborne

-

mcp-server NEXT
View Details
MCP-Server
MCP-Server by fmpoliveira

-

mcp-server meteostat
View Details

Mirror of

mcp-server timelock-encryption
View Details

-

mcp-server minio
View Details