Semgrep

Semgrep

🚀 Semgrep MCP 服务器

Semgrep MCP 服务器是一个强大的工具,它基于 Semgrep 实现了 MCP 协议相关功能。通过它,用户可以更高效地进行代码扫描等操作,无论是使用 Docker 快速部署,还是手动基于 Python 安装,都能轻松上手。

🚀 快速开始

运行服务器

semgrep-mcp-serve

示例 Python SSE 客户端

from mcp.client.session import ClientSession
from mcp.client.sse import sse_client


async def main():
async with sse_client("http://localhost:8000/sse") as (read_stream, write_stream):
async with ClientSession(read_stream, write_stream) as session:
await session.initialize()
results = await session.call_tool(
"semgrep_scan",
{
"code_files": [
{
"filename": "hello_world.py",
"content": "def hello(): print('Hello, World!')",
}
]
},
)
print(results)


if __name__ == "__main__":
import asyncio
asyncio.run(main())

📦 安装指南

使用 Docker 安装并运行

docker run -it --rm semgrep/mcp:latest

手动安装(基于 Python)

  1. 安装 Python:
    • Windows:
      # 安装 Python 3.x
      choco install python3
      
    • macOS:
      # 使用 Homebrew 安装 Python 3
      brew install python
      
  2. 安装 Semgrep 和 MCP 服务器:
    pip install semgrep mcp-server
    

📚 文档与资源

官方链接

社区与支持

🔧 贡献与开发

提交代码

  1. Fork 仓库并克隆到本地:
    git clone https://github.com/semgrep/mcp-server.git
    cd mcp-server
    git checkout main
    
  2. 创建功能分支并提交代码:
    git checkout -b feature/your-feature-name
    # 进行代码修改
    git add .
    git commit -m "添加新功能"
    git push origin feature/your-feature-name
    

提交 Pull Request

  • GitHub Issues 中创建问题或提出功能请求。
  • 为每个功能或修复创建独立的 Pull Request。

🛠️ 其他工具

👥 社区项目

  • 0 关注
  • 0 收藏,25 浏览
  • system 提出于 2025-09-29 21:09

相似服务问题

相关AI产品