g

grep-mcp-npx

vicopro/grep-mcp-npx
Hosted
0 Stars 359 次浏览 秋早川原Vico 更新于 2026-08-23

核心功能 🔍 GitHub代码搜索: 通过grep.app API搜索数百万GitHub仓库 🎯 高级过滤: 支持编程语言、仓库名、文件路径过滤 📡 MCP协议兼容: 完全符合Model Context Protocol规范 🛠️ 多传输模式: stdio传输完全可用,SSE接口预留 技术优势 类型安全: 完整TypeScript类型系统,编译时错误检查 模块化: 清晰的代码组织和职责分离 可扩展: 易于添加新功能和工具 高性能: 优化的HTTP客户端和结果处理 错误处理: 完善的异常处理和用户友好的错误信息

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "grep-mcp": {
      "args": [
        "-y",
        "grep-mcp"
      ],
      "command": "npx"
    }
  }
}

可用工具 (2 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

grep_query 4 个参数 需填 1 项

Search GitHub code using grep.app API. This tool enables AI assistants to search through GitHub repositories for specific code patterns using grep.app's powerful search index. It returns formatted results with repository information, file paths, and code snippets.

必填参数:query

gitee_query 4 个参数 需填 1 项

Search Gitee code using Gitee search API. This tool enables AI assistants to search through Gitee repositories for specific code patterns using Gitee's search functionality. It returns formatted results with repository information, file paths, and code snippets.

必填参数:query

服务介绍

🎉 项目重构总结

本项目是从原Python版本的grep-mcp完全重构而来的TypeScript实现,提供了完整的功能对等性和更好的类型安全性。

📋 重构概述

项目名称: grep-mcp
版本: 1.1.0
描述: TypeScript实现的Grep MCP服务器,支持GitHub和Gitee代码搜索功能
协议: 遵循Model Context Protocol (MCP)标准

✅ 重构完成情况

🏗️ 核心架构重构

  • 从Python FastMCP → TypeScript MCP SDK: 完全迁移到官方TypeScript SDK
  • 模块化设计: 采用清晰的分层架构,分离关注点
  • 类型安全: 完整的TypeScript类型定义,确保编译时类型检查
  • 错误处理: 统一的错误处理机制和异常管理

🔧 功能实现对等性

功能模块 Python原版 TypeScript新版 状态
MCP服务器核心 ✅ FastMCP ✅ @modelcontextprotocol/sdk ✅ 完成
grep.app API集成 ✅ httpx ✅ axios ✅ 完成
HTML清理 ✅ BeautifulSoup ✅ 自定义实现 ✅ 完成
代码格式化 ✅ Pygments ✅ 语法检测+格式化 ✅ 完成
参数验证 ✅ Pydantic ✅ 自定义验证器 ✅ 完成
传输模式 ✅ stdio/SSE ✅ stdio(SSE预留) ✅ 完成

📦 npm包配置完整性

  • ✅ package.json配置完整
  • ✅ 构建脚本配置正确
  • ✅ 文件包含列表设置
  • ✅ 版本和依赖管理
  • ✅ 可执行文件配置

Features

  • 🔍 GitHub Code Search: Search across millions of GitHub repositories using grep.app's powerful search index
  • 🎯 Advanced Filtering: Filter by programming language, repository, and file paths
  • 🚀 TypeScript Implementation: Full TypeScript support with comprehensive type definitions
  • 📡 MCP Protocol: Implements the Model Context Protocol for seamless AI assistant integration
  • 🛠️ Multiple Transport Modes: Supports stdio transport (SSE support planned)
  • 🎨 Formatted Results: Clean, readable search results with syntax highlighting information
  • Fast & Reliable: Built on grep.app's optimized search infrastructure

🚀 技术特性

核心功能

  • 🔍 GitHub代码搜索: 通过grep.app API搜索数百万GitHub仓库
  • 🎯 高级过滤: 支持编程语言、仓库名、文件路径过滤
  • 📡 MCP协议兼容: 完全符合Model Context Protocol规范
  • 🛠️ 多传输模式: stdio传输完全可用,SSE接口预留

技术优势

  • 类型安全: 完整TypeScript类型系统,编译时错误检查
  • 模块化: 清晰的代码组织和职责分离
  • 可扩展: 易于添加新功能和工具
  • 高性能: 优化的HTTP客户端和结果处理
  • 错误处理: 完善的异常处理和用户友好的错误信息

Installation

bash
npm install -g grep-mcp

相关 MCP 服务