MetaGraph-MCP

MetaGraph-MCP

Enables enterprise AI agents to query governed data lineage, PII-aware schema documentation, and semantic metadata from SQL logs via MCP, with role-based access and vector search.

Category
访问服务器

README

🚀 MetaGraph-MCP

Autonomous Governance & Active Metadata Context Engine for Enterprise AI Agents

License: MIT Node.js Docker MCP Protocol

MetaGraph-MCP is a production-grade, active metadata ingestion and lineage engine built for enterprise AI context delivery. It parses SQL AST query execution logs into directed lineage graphs (DAGs), auto-documents datasets using autonomous LLM agents with PII detection, indexes semantic metadata into a standalone Qdrant Vector Database, and exposes governed context to AI agents via the Model Context Protocol (MCP).


🏗️ System Architecture

The system processes raw SQL and DDL metadata through an AST parser, enriches it with autonomous metadata and PII classification, stores semantic embeddings in Qdrant, and exposes governed context through MCP and REST APIs.

Cosine Similarity

$$ \operatorname{CosineSimilarity}(A,B)

\frac{\mathbf{A}\cdot\mathbf{B}} {|\mathbf{A}|,|\mathbf{B}|} $$

[ Raw SQL Logs / DDL Files ]
              │
              ▼
      [ AST Parser Engine ]
              │
              ▼
 [ Directed Lineage Graph (DAG) ]
              │
              ▼
     [ Scribe Metadata Agent ]
              │
              ▼
   [ PII Classifier & Confidence ]
              │
              ▼
      [ Qdrant Vector DB ]
        (RAG Embeddings)
              │
       ┌──────┴──────┐
       ▼             ▼
[ Governed MCP ]  [ Express REST API
     Server        & Swagger UI ]
       │             │
       ▼             ▼
[ Claude Desktop / Cursor ]   [ Enterprise AI Agents
                                & Humans ]

✨ Core Features

  • AST-Based Lineage Ingestion: Parses raw SQL query logs and DDL statements using node-sql-parser to construct an in-memory Directed Acyclic Graph (DAG) mapping upstream/downstream dependencies.
  • Autonomous Metadata Agent (Scribe): Leverages LLMs to generate column descriptions, flag sensitive PII data fields (is_pii: true), and output confidence ratings (0.0 → 1.0).
  • Vector RAG Engine (Qdrant): Embeds table definitions and column descriptions using text-embedding-004 and stores them in a Qdrant vector collection for fast natural-language semantic catalog search.
  • Governed MCP Server: Implements the official @modelcontextprotocol/sdk over stdio with built-in RBAC rules, including PII redaction for non-ADMIN agents.
  • CLI & OpenAPI Tools: Includes a command-line interface (atlan-context) for local SQL batch ingestion and interactive Swagger documentation at /docs.

📁 Directory Structure

atlan-context-mcp/
├── .env.example
├── Dockerfile
├── docker-compose.yml
├── package.json
├── README.md
└── src/
    ├── config/
    │   └── env.js                 # Environment variables & configuration
    ├── core/
    │   ├── ast-parser.js          # SQL AST parsing & dependency extraction
    │   ├── lineage-dag.js         # Directed Graph data structure
    │   ├── metadata-store.js      # Persistent metadata state storage
    │   └── vector-store.js        # Qdrant Vector Store integration
    ├── agents/
    │   └── scribe-agent.js        # Autonomous documentation & PII classifier
    ├── mcp/
    │   ├── server.js              # Model Context Protocol Stdio Server
    │   └── tools/
    │       ├── get-lineage.js
    │       ├── get-governed-schema.js
    │       └── search-metadata.js # Semantic vector search (RAG)
    ├── server/
    │   └── app.js                 # Express REST API & Swagger UI (/docs)
    └── cli/
        └── index.js               # CLI runner (`atlan-context ingest`)

⚡ Getting Started

1. Prerequisites

  • Node.js >= 20.x
  • Docker & Docker Compose
  • Google Gemini API Key

2. Environment Setup

Create a .env file in the root directory:

GEMINI_API_KEY=your_gemini_api_key_here
PORT=3000
QDRANT_URL=http://localhost:6333
DOTENV_CONFIG_QUIET=true

3. Spin Up Infrastructure

Start the application and the Qdrant vector database container:

docker-compose up --build -d

4. Ingest Sample Data via CLI

Register table schema definitions:

node src/cli/index.js schema raw_orders order_id customer_email amount
node src/cli/index.js schema stg_orders order_id user_id amount

Ingest raw SQL transform queries:

node src/cli/index.js ingest ./sample.sql

5. Access Dashboards & Developer Documentation

  • Swagger API Documentation: http://localhost:3000/docs
  • REST Dashboard: http://localhost:3000
  • Qdrant Vector Dashboard: http://localhost:6333/dashboard

🛠️ MCP Protocol Integration

To connect this server to Claude Desktop or Cursor, add the following configuration to your MCP settings file (claude_desktop_config.json):

{
  "mcpServers": {
    "atlan-context": {
      "command": "node",
      "args": ["/path/to/atlan-context-mcp/src/mcp/server.js"],
      "env": {
        "GEMINI_API_KEY": "your_gemini_api_key_here",
        "QDRANT_URL": "http://localhost:6333"
      }
    }
  }
}

Exposed MCP Tools

Tool Name Parameters Description
get_table_lineage tableName Returns upstream dependency DAG for a target data asset.
get_governed_schema tableName, userRole Returns table documentation with role-based PII masking.
search_business_glossary query, topK Executes semantic vector RAG search over indexed metadata.

📜 License

This project is licensed under the MIT License.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选