Back to MCP directory
publicPublicdnsLocal runtime

anthropic-mcp-code-analyzer

一个基于Claude的代码分析工具,用于分析开源项目并生成智能合并策略

article

README

🚀 人本智能MCP代码分析器

人本智能MCP代码分析器是一款强大的MCP服务器,可助力分析开源项目,并实现与现有代码库的无缝集成。该工具借助Claude对代码模式、架构及文档进行深度剖析,进而提供智能合并策略。

🚀 快速开始

本工具的使用流程较为简单,按照以下步骤操作即可快速上手:

  1. 克隆仓库:
git clone https://github.com/kivo360/anthropic-mcp-code-analyzer.git
cd anthropic-mcp-code-analyzer
  1. 安装依赖项:
npm install
  1. 设置环境变量:
export ANTHROPIC_API_KEY=your_api_key
export PORT=3000  # 可选,默认为3000
  1. 启动服务器:
npm start
  1. 分析仓库并获取合并策略:
curl -X POST http://localhost:3000/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "sourceRepo": "https://github.com/user/source-repo.git",
    "targetRepo": "https://github.com/user/target-repo.git"
  }'

服务器将返回以下内容:

  • 源仓库分析
  • 目标仓库分析
  • 推荐的合并策略
  • 可能的冲突及解决方案

✨ 主要特性

  • 仓库分析及代码模式检测
  • 文档提取与处理
  • 使用Claude生成智能合并策略
  • 基于AST的代码分析
  • 依赖跟踪
  • 架构模式检测

📦 安装指南

  1. 克隆仓库:
git clone https://github.com/kivo360/anthropic-mcp-code-analyzer.git
cd anthropic-mcp-code-analyzer
  1. 安装依赖项:
npm install
  1. 设置环境变量:
export ANTHROPIC_API_KEY=your_api_key
export PORT=3000  # 可选,默认为3000

💻 使用示例

基础用法

# 启动服务器
npm start

# 分析仓库并获取合并策略
curl -X POST http://localhost:3000/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "sourceRepo": "https://github.com/user/source-repo.git",
    "targetRepo": "https://github.com/user/target-repo.git"
  }'

📚 详细文档

API接口

POST /analyze

分析源和目标仓库,并生成合并策略。

请求正文:

{
  "sourceRepo": "string",
  "targetRepo": "string"
}

GET /health

用于验证服务器状态的健康检查端点。

🔧 技术细节

工作原理

  1. 仓库分析

    • 克隆源和目标仓库
    • 使用AST解析分析代码结构
    • 提取模式和依赖关系
    • 处理文档内容
  2. 模式检测

    • 识别常见编码模式
    • 映射依赖项和关系
    • 分析架构决策
  3. 合并策略生成

    • 使用Claude分析兼容性
    • 生成分步集成计划
    • 识别潜在冲突
    • 建议重构步骤
  4. 文档处理

    • 提取并分析文档
    • 在代码库之间映射知识
    • 为决策提供上下文信息

🤝 贡献指南

欢迎贡献!请随意提交Pull Request。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client