Greptile MCP 服务器 logo

Greptile MCP 服务器

Community
sosacrazy126

A modern, TypeScript-powered MCP (Model Context Protocol) server that provides AI-powered code search and querying capabilities through the Greptile API. Built with the official MCP SDK and designed…

Publishersosacrazy126
Repositorygreptile-mcp
LanguageJavaScript
Forks
4
Stars
8
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Greptile MCP 服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    8 stars and 4 forks from the linked repository.

🚀 Greptile MCP Server - TypeScript Edition

npm version TypeScript MCP Compatible

A modern, TypeScript-powered MCP (Model Context Protocol) server that provides AI-powered code search and querying capabilities through the Greptile API. Built with the official MCP SDK and designed for seamless integration with AI tools like Claude Desktop, Continue, and other MCP-compatible clients.

✨ Features

🔥 Zero-Installation Experience

bash
# Start immediately with npx - no setup required!
npx greptile-mcp-server --api-key=xxx --github-token=yyy

🧠 AI-Powered Code Understanding

  • Natural Language Queries: Ask questions about codebases in plain English
  • Deep Code Analysis: Understand architecture, patterns, and implementation details
  • Cross-Repository Insights: Compare patterns and approaches across multiple codebases
  • Session Continuity: Build understanding progressively through conversation

⚡ Modern Architecture

  • Official MCP SDK: Built with TypeScript MCP SDK for full protocol compliance
  • Streaming Support: Real-time responses with Server-Sent Events
  • Type Safety: Full TypeScript integration with comprehensive type definitions
  • Plugin Architecture: Extensible design for custom tools and integrations

🛠️ Developer Experience

  • NPX Ready: Install and run with a single command
  • Auto-Configuration: Intelligent configuration detection and validation
  • Interactive Setup: Guided setup wizard for first-time users
  • Comprehensive Help: Built-in documentation and usage examples

🚀 Quick Start

Prerequisites

Instant Start

bash
# Start immediately (will prompt for credentials if not set)
npx greptile-mcp-server

# With inline credentials
npx greptile-mcp-server --api-key=your_key --github-token=your_token

# Interactive setup wizard
npx greptile-mcp-server init

# Test connectivity
npx greptile-mcp-server test

Environment Setup

Option 1: .env File (Recommended for local development)

Create a .env file in your project root:

env
GREPTILE_API_KEY=your_greptile_api_key_here
GITHUB_TOKEN=your_github_personal_access_token_here
GREPTILE_BASE_URL=https://api.greptile.com/v2  # Optional

Option 2: System Environment Variables

Linux/macOS (Bash/Zsh):

bash
# Current session
export GREPTILE_API_KEY="your_api_key_here"
export GITHUB_TOKEN="your_github_token_here"

# Permanent (add to ~/.bashrc or ~/.zshrc)
echo 'export GREPTILE_API_KEY="your_api_key_here"' >> ~/.bashrc
echo 'export GITHUB_TOKEN="your_github_token_here"' >> ~/.bashrc
source ~/.bashrc

Windows PowerShell:

powershell
# Current session
$env:GREPTILE_API_KEY="your_api_key_here"
$env:GITHUB_TOKEN="your_github_token_here"

# Permanent
setx GREPTILE_API_KEY "your_api_key_here"
setx GITHUB_TOKEN "your_github_token_here"
# Note: Restart terminal after using setx

Windows Command Prompt:

cmd
# Current session
set GREPTILE_API_KEY=your_api_key_here
set GITHUB_TOKEN=your_github_token_here

# Permanent
setx GREPTILE_API_KEY "your_api_key_here"
setx GITHUB_TOKEN "your_github_token_here"

API Key and Token Setup

Greptile API Key:

  1. Visit Greptile Settings
  2. Generate a new API key
  3. Copy the key to your environment

GitHub Token:

  1. Visit GitHub Settings > Personal Access Tokens
  2. Create a "Fine-grained personal access token" for better security
  3. Grant repo permissions for repositories you want to index
  4. Copy the token to your environment

🔧 MCP Client Integration

Claude Desktop

Add to your claude_desktop_config.json:

json
{
  "mcpServers": {
    "greptile": {
      "command": "npx",
      "args": ["greptile-mcp-server"],
      "env": {
        "GREPTILE_API_KEY": "your_api_key",
        "GITHUB_TOKEN": "your_github_token"
      }
    }
  }
}

Continue IDE Extension

Add to your Continue configuration:

json
{
  "contextProviders": [
    {
      "name": "greptile-mcp",
      "type": "mcp",
      "serverName": "greptile",
      "command": ["npx", "greptile-mcp-server"]
    }
  ]
}

Other MCP Clients

The server uses standard MCP protocol and works with any MCP-compatible client:

bash
# Generic MCP client connection
your-mcp-client connect --command "npx greptile-mcp-server"

🛠️ Available Tools

1. greptile_help

Get comprehensive documentation and usage examples.

json
{
  "name": "greptile_help"
}

2. index_repository

Index a repository to make it searchable.

json
{
  "name": "index_repository",
  "arguments": {
    "remote": "github",
    "repository": "microsoft/vscode",
    "branch": "main",
    "reload": true
  }
}

3. query_repository

Query repositories with natural language.

json
{
  "name": "query_repository",
  "arguments": {
    "query": "How is authentication implemented in this codebase?",
    "repositories": [
      {
        "remote": "github",
        "repository": "microsoft/vscode", 
        "branch": "main"
      }
    ],
    "stream": false,
    "session_id": "optional-session-id"
  }
}

4. get_repository_info

Get information about indexed repositories.

json
{
  "name": "get_repository_info",
  "arguments": {
    "remote": "github",
    "repository": "microsoft/vscode",
    "branch": "main"
  }
}

📖 Usage Examples

Basic Workflow

bash
# 1. Start the server
npx greptile-mcp-server

# 2. In your MCP client, index a repository
{
  "tool": "index_repository",
  "arguments": {
    "remote": "github",
    "repository": "microsoft/vscode",
    "branch": "main"
  }
}

# 3. Query the codebase
{
  "tool": "query_repository", 
  "arguments": {
    "query": "How does VS Code handle file watching?",
    "repositories": [{"remote": "github", "repository": "microsoft/vscode", "branch": "main"}]
  }
}

Advanced Session-Based Exploration

javascript
// Start with architecture overview
const session = "exploration-session-1";

// Query 1: High-level understanding
{
  "tool": "query_repository",
  "arguments": {
    "query": "What is the overall architecture of this codebase?",
    "session_id": session,
    "repositories": [...]
  }
}

// Query 2: Deep dive (builds on previous context)
{
  "tool": "query_repository", 
  "arguments": {
    "query": "How do the main components we just discussed interact with each other?",
    "session_id": session  // Same session for continuity
  }
}

// Query 3: Implementation details
{
  "tool": "query_repository",
  "arguments": {
    "query": "Show me the specific implementation of the component interaction patterns",
    "session_id": session
  }
}

🔀 Migration from Python Version

The TypeScript version maintains full compatibility with the Python implementation while adding significant improvements:

What's New

  • ✅ Official MCP SDK: Standards-compliant implementation
  • ✅ NPX Distribution: Zero-installation experience
  • ✅ Better Performance: V8 engine advantages for I/O operations
  • ✅ Type Safety: Full TypeScript integration
  • ✅ Modern Tooling: ESLint, Prettier, comprehensive testing
  • ✅ Enhanced CLI: Interactive setup and better UX

Migration Steps

bash
# Old Python usage
python -m src.main

# New TypeScript usage  
npx greptile-mcp-server

# Same MCP tools and API compatibility
# No changes needed in MCP client configurations

🚨 Troubleshooting

Testing Your Setup

Always test your configuration after setup:

bash
npx greptile-mcp-server test

Common Issues

❌ "Environment variables missing"

Problem: Server can't find your API keys Solutions:

  • Restart your terminal after setting permanent environment variables
  • Verify environment variables are set:
    bash
    # Linux/macOS
    echo $GREPTILE_API_KEY
    echo $GITHUB_TOKEN
    
    # Windows PowerShell
    echo $env:GREPTILE_API_KEY
    echo $env:GITHUB_TOKEN
  • Try using inline credentials:
    bash
    GREPTILE_API_KEY="your_key" GITHUB_TOKEN="your_token" npx greptile-mcp-server

❌ "GitHub token validation failed"

Problem: GitHub token is invalid or has insufficient permissions Solutions:

  • Ensure your token has repo permissions
  • Generate a new token at GitHub Settings
  • For better security, use "Fine-grained personal access tokens"
  • Check token hasn't expired

❌ "Greptile API authentication failed"

Problem: Greptile API key is invalid or expired Solutions:

  • Get a new API key from Greptile Settings
  • Verify the key is correctly copied (no extra spaces)
  • Check if your API key has expired

❌ "Cannot find module" or import errors

Problem: NPX cache issues or incomplete installation Solutions:

  • Clear NPX cache: npx clear-npx-cache
  • Force fresh install: npx greptile-mcp-server@latest
  • Check Node.js version (requires Node 18+)

❌ MCP client connection issues

Problem: Claude Desktop or other MCP client can't connect Solutions:

  • Verify MCP server configuration syntax
  • Check Claude Desktop logs for detailed error messages
  • Ensure environment variables are accessible to the MCP client
  • Try running the server manually first to verify it works

Getting Help

  • Run npx greptile-mcp-server init for interactive setup
  • Run npx greptile-mcp-server test for detailed diagnostics
  • Check the Greptile Documentation for API-specific issues
  • Visit MCP Documentation for client integration help

❓ Frequently Asked Questions

Q: Do I need to install anything locally to use this?

A: No! The server runs via NPX with zero installation required. Just run npx greptile-mcp-server and it will download and run automatically.

Q: Can I use this with any MCP-compatible client?

A: Yes! This server implements the standard Model Context Protocol and works with Claude Desktop, MCP CLI tools, and any other MCP-compatible client.

Q: How do I index private repositories?

A: Ensure your GitHub token has repo permissions for private repositories. The token needs access to read the repositories you want to index.

Q: What's the difference between .env files and environment variables?

A:

  • .env files are great for local development - they only work in the directory where the file exists
  • Environment variables are system-wide and work everywhere, making them better for global usage with npx

Q: How much does it cost to use Greptile?

A: Greptile pricing depends on your usage. Check Greptile's pricing page for current rates. This MCP server itself is free and open-source.

Q: Can I use this with multiple repositories?

A: Yes! You can index multiple repositories and query across all of them. Use the index_repository tool for each repository you want to add.

Q: How long does it take to index a repository?

A: Indexing time varies by repository size. Small repos (< 1000 files) typically take 1-2 minutes, while larger repos may take 10-15 minutes. You can check status with the get_repository_info tool.

Q: Is my code data secure?

A: Your code is processed by Greptile's API according to their security and privacy policies. Check Greptile's security documentation for details about data handling and retention.

Q: Can I run this on Windows?

A: Yes! The server works on Windows, macOS, and Linux. Use the platform-specific environment variable setup instructions above.

Q: Why do I get "command not found" errors?

A: This usually means:

  • NPX is not installed (install Node.js which includes NPX)
  • Your PATH doesn't include Node.js binaries
  • There's a typo in the command (it's npx greptile-mcp-server not npx @greptile/mcp-server)

🏗️ Development

Local Development

bash
# Clone and setup
git clone https://github.com/greptile/mcp-server.git
cd mcp-server
npm install

# Development with hot reload
npm run dev

# Build for production
npm run build

# Run tests
npm test

# Type checking
npm run typecheck

# Linting and formatting
npm run lint
npm run format

Project Structure

src/
├── cli.ts              # NPX CLI interface
├── server.ts           # Core MCP server implementation  
├── index.ts            # Module exports
├── clients/
│   └── greptile.ts     # Greptile API client
├── types/
│   └── index.ts        # TypeScript type definitions
└── utils/
    └── index.ts        # Utility functions

tests/
├── unit/               # Unit tests
└── integration/        # Integration tests

Build Configuration

  • TypeScript: ES2022 target with strict mode
  • Build Tool: tsup for dual ESM/CJS output
  • Testing: Mocha + Chai with TypeScript support
  • Code Quality: ESLint + Prettier with TypeScript rules

🔧 Configuration Options

CLI Arguments

bash
npx greptile-mcp-server \
  --api-key="your_key" \
  --github-token="your_token" \
  --base-url="https://api.greptile.com/v2" \
  --repositories='[{"remote":"github","repository":"owner/repo","branch":"main"}]' \
  --stream=true \
  --timeout=60000 \
  --verbose

Environment Variables

VariableDescriptionDefault
GREPTILE_API_KEYGreptile API keyRequired
GITHUB_TOKENGitHub personal access tokenRequired
GREPTILE_BASE_URLAPI base URLhttps://api.greptile.com/v2

Configuration File (Optional)

Create greptile.config.js:

javascript
export default {
  apiKey: process.env.GREPTILE_API_KEY,
  githubToken: process.env.GITHUB_TOKEN,
  repositories: [
    { remote: 'github', repository: 'owner/repo', branch: 'main' }
  ],
  features: {
    streaming: true,
    orchestration: true,
    flowEnhancement: true
  }
};

🚀 Deployment

Smithery Cloud Deployment

Deploy instantly to Smithery with zero configuration:

Deploy to Smithery

bash
# Install Smithery CLI
npm install -g smithery

# Deploy from repository
smithery deploy

# Or deploy with custom configuration
smithery deploy --config smithery.yaml

# Monitor deployment
smithery status
smithery logs

Docker Deployment

bash
# Build Docker image
docker build -t greptile-mcp .

# Run with environment variables
docker run -e GREPTILE_API_KEY=your_key \
           -e GITHUB_TOKEN=your_token \
           -p 8080:8080 \
           greptile-mcp

# Or build Smithery-optimized image
npm run smithery:build

Environment Variables for Deployment

bash
# Required
GREPTILE_API_KEY=your_greptile_api_key
GITHUB_TOKEN=your_github_token

# Optional
GREPTILE_BASE_URL=https://api.greptile.com/v2
TRANSPORT=stdio
HOST=0.0.0.0
PORT=8080

Cloud Platforms

  • Smithery: One-click deployment with smithery deploy
  • Railway: Connect GitHub repo, set environment variables
  • Render: Use npm start as start command
  • Heroku: Standard Node.js deployment
  • DigitalOcean App Platform: Docker or buildpack deployment

🚦 Performance & Benchmarks

Startup Performance

  • Cold Start: < 2 seconds
  • Memory Usage: ~50MB base footprint
  • Concurrent Requests: Handles 100+ concurrent MCP tool calls

API Performance

  • Query Response: Typically 1-3 seconds
  • Streaming: Real-time chunk delivery
  • Repository Indexing: Varies by repository size (usually 30s-5min)

Compared to Python Version

  • 40% Faster Startup - V8 vs Python runtime
  • 60% Smaller Container - Node.js vs Python base images
  • 30% Better Memory Efficiency - V8 garbage collection
  • Native Streaming - Better SSE performance

🛡️ Security & Best Practices

Token Security

  • Environment Variables: Store tokens in environment, not code
  • Minimal Permissions: Use GitHub tokens with only required repo permissions
  • Token Rotation: Regularly rotate API keys and tokens
  • Local Storage: Never commit tokens to version control

Network Security

  • HTTPS Only: All API communications use HTTPS
  • Request Validation: Input validation and sanitization
  • Rate Limiting: Built-in retry logic with exponential backoff
  • Error Handling: Comprehensive error handling without token exposure

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Run the test suite (npm test)
  5. Ensure code quality (npm run lint)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

📄 License

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

🙏 Acknowledgments

  • Anthropic for the Model Context Protocol specification
  • Greptile for the powerful code analysis API
  • TypeScript Community for excellent tooling and ecosystem
  • MCP Community for protocol development and feedback

📞 Support


Built with ❤️ by the Greptile team • Powered by TypeScript and the Model Context Protocol

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "sosacrazy126-greptile-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "greptile-mcp-server"
      ]
    }
  }
}

Use Greptile MCP 服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Greptile MCP 服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Greptile MCP 服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Greptile MCP 服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "sosacrazy126-greptile-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "greptile-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Greptile MCP 服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Greptile MCP 服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Greptile MCP 服务器 to help me with this task?
Greptile MCP 服务器
Sure. I read it.
Here is what I found using Greptile MCP 服务器.

Option 2: Add an MCP server URL

Use this when Greptile MCP 服务器 is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for Greptile MCP 服务器.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Greptile MCP 服务器 connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Greptile MCP 服务器 tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Greptile MCP 服务器 tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Greptile MCP 服务器 to help me with this task?
Greptile MCP 服务器
Sure. I read it.
Here is what I found using Greptile MCP 服务器.

Frequently asked questions

What is the Greptile MCP 服务器 MCP server used for?

Greptile MCP 服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Greptile MCP 服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Greptile MCP 服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Greptile MCP 服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Greptile MCP 服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Greptile MCP 服务器 MCP to TypingMind?

Greptile MCP 服务器 can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Greptile MCP 服务器 MCP provide in TypingMind?

Greptile MCP 服务器 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Greptile MCP 服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Greptile MCP 服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇