Greptile MCP 服务器 标志

Greptile MCP 服务器

社区
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…

发布者sosacrazy126
代码仓库greptile-mcp
语言JavaScript
复刻数
4
星标数
8
可用工具
0
传输类型stdio, streamable-http
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Greptile MCP 服务器 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 8 个星标和 4 个复刻。

🚀 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

安装

TypingMind
前提条件:

Node.js 18+

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

将 Greptile MCP 服务器 MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Greptile MCP 服务器 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 您可以在自己的设备上本地运行 MCP,也可以通过 URL 连接远程 MCP 服务器。

方式 1:使用本地连接器

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 Greptile MCP 服务器 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Greptile MCP 服务器 MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "sosacrazy126-greptile-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "greptile-mcp-server"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Greptile MCP 服务器 MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Greptile MCP 服务器 MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Greptile MCP 服务器 帮我完成这项任务吗?
Greptile MCP 服务器
当然,我看过了。
以下是我使用 Greptile MCP 服务器 得到的结果。

方式 2:添加 MCP 服务器 URL

如果 Greptile MCP 服务器 已托管在远程服务器上,或您的团队希望让多个用户共用一个连接器,请选择此方式。

1

打开 MCP 连接器

在 TypingMind 中,前往“插件”,打开“MCP 连接器”,然后选择“添加 URL”。

  1. 在您的浏览器中打开 TypingMind。
  2. 进入“插件”。
  3. 打开“MCP 连接器”。
  4. 点击“添加 URL”。
TypingMind 的“添加自定义 MCP 服务器 URL”表单
2

粘贴服务器 URL

在“服务器 URL”字段中输入 您的服务器 URL。根据服务器要求,添加连接名称、描述、图标、自定义 HTTP 请求头或 OAuth 客户端设置。

  1. 将 您的服务器 URL 粘贴到“服务器 URL”字段中。
  2. 为 Greptile MCP 服务器 输入连接名称。
  3. 您可以添加描述和图标,以便更容易识别此连接。
  4. 如果服务器需要身份验证,请添加自定义 HTTP 请求头或 OAuth 客户端信息。
3

创建连接

点击“创建连接”,然后返回插件列表,确认新的 MCP 连接处于可用状态。

  1. 点击“创建连接”。
  2. 返回 MCP 连接器列表。
  3. 确认列表中的 Greptile MCP 服务器 连接显示为可用状态。
  4. 如果连接未立即出现,请刷新插件列表。
4

切换模型,无需重新连接

使用您偏好的模型开始聊天,在“插件”中启用 Greptile MCP 服务器 工具,并根据需要随时切换到其他模型。该 MCP 连接在 TypingMind 工作区中仍然可用。

  1. 在 TypingMind 中开始新聊天。
  2. 选择您想使用的 AI 模型。
  3. 在“插件”中启用 Greptile MCP 服务器 工具。
  4. 需要时,请让模型使用该工具。
  5. 切换到其他 AI 模型,继续使用同一个 MCP 连接。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Greptile MCP 服务器 帮我完成这项任务吗?
Greptile MCP 服务器
当然,我看过了。
以下是我使用 Greptile MCP 服务器 得到的结果。

常见问题

Greptile MCP 服务器 MCP 服务器有什么用途?

Greptile MCP 服务器 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Greptile MCP 服务器 MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 Greptile MCP 服务器。

为什么在 TypingMind 中使用 Greptile MCP 服务器 MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 Greptile MCP 服务器 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Greptile MCP 服务器 MCP 连接到 TypingMind?

在 TypingMind 中,您可以使用本地 MCP 连接器或添加远程 MCP 服务器的 URL 来连接 Greptile MCP 服务器。当服务器需要访问您设备上的文件、应用或私有资源时,请使用本地连接器;如果 MCP 服务器部署在远端,请使用服务器 URL。

Greptile MCP 服务器 MCP 在 TypingMind 中提供哪些工具?

Greptile MCP 服务器 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Greptile MCP 服务器 MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 Greptile MCP 服务器 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇