代码关联论文服务

CodeScholar是一个上下文感知的学术研究MCP服务器,通过混合向量和文本搜索技术分析代码库并将其链接到相关学术论文。

  • by Bbadhub
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Bbadhub/CodeScholar

使用说明

代码学者

上下文感知学术研究MCP服务器。使用混合向量+文本搜索分析代码库并将其链接到相关学术论文。

特性

  • 7 MCP工具:搜索路径、获取路径、查找相关论文、获取库状态、分析代码、查找路径、链接路径
  • 混合搜索:Vectra矢量数据库(本地,无Docker)+文本关键字匹配
  • 代码分析:基于AST的Python、JS、TypeScript概念提取
  • 适用性评分:4分量加权评分(概念重叠、文本相关性、新近度、引用)
  • 外部发现:在arXiv和Semantic Scholar上搜索新论文

快速开始

# Install Node.js dependencies
npm install

# Install Python dependencies
pip install -r requirements.txt

# Place your unified_library.json in data/
mkdir data
cp /path/to/unified_library.json data/

# Build vector search index (optional, requires OPENAI_API_KEY for embeddings)
node build-vectra-index.js

# Start the MCP server
npm start

MCP配置

添加到您的克劳德代码 .mcp.json:

{
  "mcpServers": {
    "codescholar": {
      "command": "node",
      "args": ["/path/to/CodeScholar/server.js"],
      "env": {
        "OPENAI_API_KEY": "your-key-here"
      }
    }
  }
}

建筑

CodeScholar/
├── server.js                 # MCP server (7 tools)
├── build-vectra-index.js     # One-time index builder
├── config.json               # Server configuration
├── data/                     # Paper library (gitignored)
│   └── unified_library.json
├── vectra-index/             # Vector search index (gitignored)
├── scripts/
│   ├── query_generator.py        # Smart query generation
│   ├── applicability_scorer.py   # Paper relevance scoring
│   ├── generate_embeddings.py    # OpenAI embedding generation
│   ├── analyzers/
│   │   └── concept_extractor.py  # AST-based code analysis
│   ├── sources/
│   │   ├── arxiv_source.py       # arXiv API integration
│   │   └── semantic_scholar_source.py
│   └── tests/                    # Test suites (135 tests)
└── requirements.txt

搜索模式

模式 要求 性能
仅文本 仅 unified_library.json 快速、基于关键字
混合 +Vectra索引+OPENAI_API_KEY 最佳结果,语义+关键字

许可证

麻省理工学院