dag-mcp-server

dag-mcp-server

Provides intelligent, version-aware access to npm library documentation. Supports semantic search, API validation, and version comparison to assist developers in using libraries correctly.

Category
访问服务器

README

DAG - Documentation Augmented Generation

MCP Server for Version-Aware Library Documentation and API Retrieval

DAG is a Model Context Protocol (MCP) server that provides intelligent, version-aware access to npm library documentation through semantic search, API validation, and version comparison tools.

Features

  • Semantic Search: Vector-based search across library documentation and source code
  • API Validation: Real-time validation of API usage against indexed signatures
  • Version Comparison: Diff analysis showing added/removed APIs between versions
  • Hybrid Search: Combines vector similarity with keyword matching for accuracy
  • Multi-Ecosystem: Designed for extensibility to Python, Ruby, Java, etc.

Architecture

┌──────────────────────────────────────────────────────────────┐
│                      MCP Server (Stdio)                      │
├──────────────────────────────────────────────────────────────┤
│  Resources                   │  Tools                        │
│  • library-docs/{lib}/{ver}  │  • search_library            │
│  • api-signature/{lib}/{fn}  │  • validate_api              │
│  • library-versions/{lib}    │  • compare_versions          │
├──────────────────────────────────────────────────────────────┤
│              Indexing Pipeline (Orchestrator)                │
│     NPM → Parse AST → Chunk → Embed → Qdrant Store         │
├──────────────────────────────────────────────────────────────┤
│  Services Layer                                              │
│  • NPM Crawler     • AST Parser    • Chunker                │
│  • Embedder        • Qdrant        • Orchestrator           │
└──────────────────────────────────────────────────────────────┘

Packages

This monorepo contains three packages:

1. @vamfi/dag-shared

Core types and interfaces used across the system.

Coverage: 98.01% | Tests: 6/6 passing

2. @vamfi/dag-indexer

Indexing pipeline for npm packages.

Components:

  • NPM Crawler (downloads tarballs, extracts source)
  • AST Parser (tree-sitter for TypeScript/JavaScript)
  • Semantic Chunker (splits code by functions/classes)
  • Embedder (Voyage AI embeddings)
  • Qdrant Service (vector database operations)
  • IndexingOrchestrator (end-to-end pipeline)

Coverage: 98.57% | Tests: 48/48 passing

3. @vamfi/dag-mcp-server

MCP server implementation.

Components:

  • MCP Server (stdio transport)
  • Resource Provider (3 resource types)
  • Tool Provider (3 tools)
  • Health monitoring

Coverage: 58.65% | Tests: 28/28 passing

Installation

Prerequisites

  • Node.js ≥ 18.0.0
  • npm ≥ 9.0.0
  • Qdrant Cloud account (or local Qdrant instance)

Setup

  1. Clone the repository:

    git clone https://github.com/VAMFI/DAG.git
    cd DAG
    
  2. Install dependencies:

    npm install
    
  3. Build all packages:

    npm run build
    
  4. Run tests:

    npm test
    

Configuration

Create a .env file in the project root:

# Qdrant Configuration
QDRANT_URL=https://your-cluster.qdrant.tech
QDRANT_API_KEY=your_api_key_here

# MCP Server Configuration
MCP_SERVER_NAME=dag-mcp-server
MCP_SERVER_VERSION=0.1.0

Usage

Indexing a Library

import { IndexingOrchestrator } from '@vamfi/dag-indexer';
import {
  NPMCrawlerService,
  ASTParserService,
  ChunkerService,
  EmbedderService,
  QdrantService
} from '@vamfi/dag-indexer';

// Initialize services
const crawler = new NPMCrawlerService();
const parser = new ASTParserService();
const chunker = new ChunkerService();
const embedder = new EmbedderService({
  qdrantUrl: process.env.QDRANT_URL,
  apiKey: process.env.QDRANT_API_KEY
});
const qdrant = new QdrantService({
  url: process.env.QDRANT_URL,
  apiKey: process.env.QDRANT_API_KEY
});

// Create orchestrator
const orchestrator = new IndexingOrchestrator(
  crawler,
  parser,
  chunker,
  embedder,
  qdrant
);

// Index a package
const result = await orchestrator.indexPackage('express', '4.18.2');

console.log(`Indexed ${result.chunksIndexed} chunks in ${result.duration}ms`);

Running the MCP Server

# Start the server
npm start --workspace=@vamfi/dag-mcp-server

# Or use the CLI directly
./packages/mcp-server/dist/index.js

Using Resources

Resources provide structured access to documentation:

dag://library-docs/express/4.18.2
dag://api-signature/express/Router
dag://library-versions/express

Using Tools

Tools enable intelligent interaction with documentation:

1. Search Library:

{
  "tool": "search_library",
  "arguments": {
    "query": "how to create middleware",
    "library": "express",
    "version": "4.18.2",
    "limit": 5
  }
}

2. Validate API:

{
  "tool": "validate_api",
  "arguments": {
    "library": "express",
    "apiCall": "app.use(express.json())",
    "version": "4.18.2"
  }
}

3. Compare Versions:

{
  "tool": "compare_versions",
  "arguments": {
    "library": "express",
    "version1": "4.17.0",
    "version2": "4.18.2"
  }
}

MCP Client Integration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "dag": {
      "command": "node",
      "args": ["/path/to/DAG/packages/mcp-server/dist/index.js"],
      "env": {
        "QDRANT_URL": "https://your-cluster.qdrant.tech",
        "QDRANT_API_KEY": "your_api_key"
      }
    }
  }
}

Continue.dev

Add to .continue/config.json:

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "node",
          "args": ["/path/to/DAG/packages/mcp-server/dist/index.js"]
        },
        "env": {
          "QDRANT_URL": "https://your-cluster.qdrant.tech",
          "QDRANT_API_KEY": "your_api_key"
        }
      }
    ]
  }
}

Quality Gates

All quality gates have been passed:

Quality Gate 1: Orchestrator Integration ✓

  • Requirement: Full pipeline integration with comprehensive testing
  • Result: 48/48 tests passing, 98.57% coverage
  • Status: PASSED

Quality Gate 2: Tool Performance ✓

  • Requirement: Search latency < 2 seconds
  • Result: < 100ms average latency
  • Status: PASSED

Quality Gate 3: Complete MVP ✓

  • Requirement: All components integrated, documented, and tested
  • Result: 82/82 tests passing across all packages
  • Status: PASSED

Performance

  • Indexing: ~100-500ms per package (depending on size)
  • Search: < 100ms average latency
  • API Validation: < 50ms average
  • Version Comparison: < 200ms average

Roadmap

  • [ ] Python ecosystem support (PyPI)
  • [ ] Ruby ecosystem support (RubyGems)
  • [ ] Java ecosystem support (Maven)
  • [ ] Real-time package updates
  • [ ] Enhanced caching layer
  • [ ] Multi-tenant support
  • [ ] GraphQL API

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes with conventional commits
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT © VAMFI Inc.

Support

  • GitHub Issues: https://github.com/VAMFI/DAG/issues
  • Documentation: https://vamfi.org/docs/dag
  • Email: support@vamfi.org

Built with ❤️ by VAMFI Inc.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选