Sponsored by Deepsite.site

Greptile MCP Server

Created By
sosacrazy1269 months ago
Greptile MCP Server - Multi-Context Protocol Server for Greptile
Content

Greptile MCP Server

A WebSocket-based server that enables real-time code search and indexing capabilities across multiple repositories. It acts as a middleware between clients and the Greptile API, providing enhanced functionality for managing multiple search contexts and streaming results.

Features

  • 🔌 WebSocket Server: Real-time communication with connection management and heartbeat mechanism
  • 👥 Agent Management: Create and manage agent instances for different repositories
  • 🔍 Repository Integration: Support repository indexing through Greptile API
  • 🔎 Query Processing: Process and validate search queries with streaming results
  • 🔐 Security: Secure WebSocket connections with API key authentication
  • ⚙️ Configuration: Environment-based configuration with custom API endpoints
  • 📊 Monitoring: Comprehensive logging system with performance metrics
  • 📚 Client SDK: WebSocket client implementation with connection management

Installation

# Clone the repository
git clone https://github.com/yourusername/greptile-mcp.git

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# Start the server
npm start

Environment Variables

# Server Configuration
PORT=3000
HOST=0.0.0.0
NODE_ENV=production

# Greptile API Configuration
GREPTILE_API_KEY=your-api-key
GITHUB_TOKEN=your-github-token
GREPTILE_BASE_URL=https://api.greptile.com/v2

# Authentication Configuration
AUTH_ENABLED=false
API_KEY=your-api-key-here
TOKEN_HEADER_NAME=X-API-Key

# Rate Limiting Configuration
RATE_LIMIT_ENABLED=true
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100

# Logging Configuration
LOG_LEVEL=info
LOG_FORMAT=combined

Usage

Creating an Agent

curl -X POST http://localhost:3000/api/agents \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Demo Agent",
    "description": "Testing agent",
    "repositoryUrl": "https://github.com/facebook/react",
    "branch": "main"
  }'

WebSocket Connection

import WebSocket from 'ws';

const ws = new WebSocket('ws://localhost:3000');
const agentId = 'your-agent-id';

ws.on('open', () => {
  // Register the connection
  ws.send(JSON.stringify({
    type: 'register',
    agentId: agentId
  }));
});

ws.on('message', (data) => {
  const message = JSON.parse(data.toString());
  console.log('Received:', message);
});

Querying Code

// After registration
ws.send(JSON.stringify({
  type: 'query',
  query: 'Find function main',
  options: {
    stream: true,
    maxResults: 5,
    includeContext: true
  }
}));

Development

# Run in development mode
npm run dev

# Run tests
npm test

# Run linting
npm run lint

# Build for production
npm run build

Testing

The project includes comprehensive tests:

# Run all tests
npm test

# Run specific test file
npm test -- tests/server.test.js

# Run with coverage
npm run test:coverage

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Greptile API for providing the core search functionality
  • ws for the WebSocket implementation
  • All contributors who have helped with the project
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
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.
DeepChatYour AI Partner on Desktop
CursorThe AI Code Editor
ChatWiseThe second fastest AI chatbot™
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
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"
Amap Maps高德地图官方 MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
WindsurfThe new purpose-built IDE to harness magic
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.
Serper MCP ServerA Serper MCP Server
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.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs