Mcp Datahub

io.github.txn2由 GitHub 帳號 txn2 發布v1.15.1更新於 Oct 24, 2026

MCP server for DataHub data catalogs. Discover datasets, explore lineage, and access metadata.

概覽

AI 產生的概覽

將 AI 助理連接到 DataHub 中繼資料目錄,可搜尋資料集、檢視結構定義、追溯血緣並管理目錄實體。

可以做什麼
  • 搜尋目錄中的資料集、儀表板與管線,並瀏覽標籤、網域與資料產品
  • 依 URN 讀取實體中繼資料、資料集結構定義、詞彙表詞條、資料產品詳情及相關 SQL 查詢
  • 追溯上下游血緣,支援欄位層級血緣
  • 建立、更新與刪除標籤、網域、詞彙表詞條、資料產品、文件、事件、資料契約等目錄實體(寫入工具預設關閉)
  • 列出已設定的 DataHub 連線,並在多伺服器情境中指定目標連線
適用情境
適合需要助理回答組織資料資產相關問題的情境,例如找到正確的資料表、了解其結構定義與負責人,或查看有哪些下游依賴它。也適合希望助理不只讀取、還能維護目錄中繼資料的團隊。
執行需求
以本機程序執行,可透過 macOS/Windows 安裝包、Homebrew 或 Go 安裝。需要可連線的 DataHub GraphQL 端點與 API 權杖,透過 DATAHUB_URL 與 DATAHUB_TOKEN(或 YAML/JSON 設定檔)提供。需 DataHub 1.3.x 以上,文件功能需 1.4.x。多實例可用 DATAHUB_ADDITIONAL_SERVERS。
安裝前請注意
權杖可存取整個目錄,透過環境變數或設定檔傳入,請勿放入共用設定。寫入工具預設關閉,除非設定 DATAHUB_WRITE_ENABLED;啟用後助理可建立、更新與刪除目錄實體,刪除具破壞性。目錄中繼資料會傳送到所設定的 DataHub 伺服器。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Datahub,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[txn2/mcp-datahub]

[GitHub license] [Go Reference] [Go Report Card] [codecov] [OpenSSF Scorecard] [SLSA 3]

An MCP server and composable Go library that connects AI assistants to DataHub metadata catalogs. Search datasets, explore schemas, trace lineage, and access glossary terms and domains.

mcp-datahub.txn2.com | Installation | Library Docs

MCP Data Platform Ecosystem

mcp-datahub is part of a broader suite of open-source MCP servers designed to work together as a composable data platform. Each component can run standalone or be combined to give AI assistants unified access to storage, query engines, and metadata catalogs.

Two Ways to Use

1. Standalone MCP Server

Install and connect to Claude Desktop, Cursor, or any MCP client:

Claude Desktop (Easiest) - Download the .mcpb bundle from releases and double-click to install:

  • macOS Apple Silicon: mcp-datahub_X.X.X_darwin_arm64.mcpb
  • macOS Intel: mcp-datahub_X.X.X_darwin_amd64.mcpb
  • Windows: mcp-datahub_X.X.X_windows_amd64.mcpb

Other Installation Methods:

bash
# Homebrew (macOS)brew install txn2/tap/mcp-datahub
# Go installgo install github.com/txn2/mcp-datahub/cmd/mcp-datahub@latest

Manual Claude Desktop Configuration (if not using MCPB):

json
{  "mcpServers": {    "datahub": {      "command": "/opt/homebrew/bin/mcp-datahub",      "env": {        "DATAHUB_URL": "https://datahub.example.com",        "DATAHUB_TOKEN": "your_token"      }    }  }}
Multi-Server Configuration

Connect to multiple DataHub instances simultaneously:

bash
# Primary serverexport DATAHUB_URL=https://prod.datahub.example.com/api/graphqlexport DATAHUB_TOKEN=prod-tokenexport DATAHUB_CONNECTION_NAME=prod
# Additional servers (JSON)export DATAHUB_ADDITIONAL_SERVERS='{"staging":{"url":"https://staging.datahub.example.com/api/graphql","token":"staging-token"}}'

Use datahub_list_connections to discover available connections, then pass the connection parameter to any tool.

2. Composable Go Library

Import into your own MCP server for custom authentication, tenant isolation, and audit logging:

go
import (    "github.com/txn2/mcp-datahub/pkg/client"    "github.com/txn2/mcp-datahub/pkg/tools")
// Create client and register tools with your MCP serverdatahubClient, _ := client.NewFromEnv()defer datahubClient.Close()
toolkit := tools.NewToolkit(datahubClient, tools.Config{})toolkit.RegisterAll(yourMCPServer)
Customizing Tool Descriptions

Override tool descriptions to match your deployment:

go
toolkit := tools.NewToolkit(datahubClient, tools.Config{},    tools.WithDescriptions(map[tools.ToolName]string{        tools.ToolSearch: "Search our internal data catalog for datasets and dashboards",    }),)
Customizing Tool Annotations

Override MCP tool annotations (behavior hints for AI clients):

go
toolkit := tools.NewToolkit(datahubClient, tools.Config{},    tools.WithAnnotations(map[tools.ToolName]*mcp.ToolAnnotations{        tools.ToolSearch: {ReadOnlyHint: true, OpenWorldHint: boolPtr(true)},    }),)

All 12 tools ship with default annotations: read tools are marked ReadOnlyHint: true; datahub_create is non-destructive and non-idempotent; datahub_update is non-destructive and idempotent; datahub_delete is destructive and idempotent.

Extensions (Logging, Metrics, Error Hints)

Enable optional middleware via the extensions package:

go
import "github.com/txn2/mcp-datahub/pkg/extensions"
// Load from environment variables (MCP_DATAHUB_EXT_*)cfg := extensions.FromEnv()opts := extensions.BuildToolkitOptions(cfg)toolkit := tools.NewToolkit(datahubClient, toolsCfg, opts...)
// Or load from a YAML/JSON config fileserverCfg, _ := extensions.LoadConfig("config.yaml")

See the library documentation for middleware, selective tool registration, and enterprise patterns.

Combining with mcp-trino

Build a unified data platform MCP server by combining DataHub metadata with Trino query execution:

go
import (    datahubClient "github.com/txn2/mcp-datahub/pkg/client"    datahubTools "github.com/txn2/mcp-datahub/pkg/tools"    trinoClient "github.com/txn2/mcp-trino/pkg/client"    trinoTools "github.com/txn2/mcp-trino/pkg/tools")
// Add DataHub tools (search, lineage, schema, glossary)dh, _ := datahubClient.NewFromEnv()datahubTools.NewToolkit(dh, datahubTools.Config{}).RegisterAll(server)
// Add Trino tools (query execution, catalog browsing)tr, _ := trinoClient.NewFromEnv()trinoTools.NewToolkit(tr, trinoTools.Config{}).RegisterAll(server)
// AI assistants can now:// - Search DataHub for tables -> Get schema -> Query via Trino// - Explore lineage -> Understand data flow -> Run validation queries

See txn2/mcp-trino for the companion library.

Bidirectional Integration with QueryProvider

The library supports bidirectional context injection. While mcp-trino can pull semantic context from DataHub, mcp-datahub can receive query execution context back from a query engine:

go
import (    datahubTools "github.com/txn2/mcp-datahub/pkg/tools"    "github.com/txn2/mcp-datahub/pkg/integration")
// QueryProvider enables query engines to inject context into DataHub toolstype myQueryProvider struct {    trinoClient *trino.Client}
func (p *myQueryProvider) Name() string { return "trino" }
func (p *myQueryProvider) ResolveTable(ctx context.Context, urn string) (*integration.TableIdentifier, error) {    // Map DataHub URN to Trino table (catalog.schema.table)    return &integration.TableIdentifier{        Catalog: "hive", Schema: "production", Table: "users",    }, nil}
func (p *myQueryProvider) GetTableAvailability(ctx context.Context, urn string) (*integration.TableAvailability, error) {    // Check if table is queryable    return &integration.TableAvailability{Available: true}, nil}
func (p *myQueryProvider) GetQueryExamples(ctx context.Context, urn string) ([]integration.QueryExample, error) {    // Return sample queries for this entity    return []integration.QueryExample{        {Name: "sample", SQL: "SELECT * FROM hive.production.users LIMIT 10"},    }, nil}
// Wire it uptoolkit := datahubTools.NewToolkit(datahubClient, config,    datahubTools.WithQueryProvider(&myQueryProvider{trinoClient: trino}),)

When a QueryProvider is configured, tool responses are enriched:

  • Search results: Include query_context with table availability
  • Entity details: Include query_table, query_examples, query_availability
  • Schema: Include query_table for immediate SQL usage
  • Lineage: Include execution_context mapping URNs to tables

Integration Middleware

Enterprise features like access control and audit logging are enabled through middleware adapters:

go
import (    datahubTools "github.com/txn2/mcp-datahub/pkg/tools"    "github.com/txn2/mcp-datahub/pkg/integration")
// Access control - filter entities by user permissionstype myAccessFilter struct{}func (f *myAccessFilter) CanAccess(ctx context.Context, urn string) (bool, error) { /* ... */ }func (f *myAccessFilter) FilterURNs(ctx context.Context, urns []string) ([]string, error) { /* ... */ }
// Audit logging - track all tool invocationstype myAuditLogger struct{}func (l *myAuditLogger) LogToolCall(ctx context.Context, tool string, params map[string]any, userID string) error { /* ... */ }
// Wire up with multiple integration optionstoolkit := datahubTools.NewToolkit(datahubClient, config,    datahubTools.WithAccessFilter(&myAccessFilter{}),    datahubTools.WithAuditLogger(&myAuditLogger{}, func(ctx context.Context) string {        return ctx.Value("user_id").(string)    }),    datahubTools.WithURNResolver(&myURNResolver{}),      // Map external IDs to URNs    datahubTools.WithMetadataEnricher(&myEnricher{}),    // Add custom metadata)

See the library documentation for complete integration patterns.

Available Tools

Read Tools (always available)

ToolDescription
datahub_searchSearch for datasets, dashboards, pipelines by query and entity type
datahub_get_entityGet entity metadata by URN (description, owners, tags, domain)
datahub_get_schemaGet dataset schema with field types and descriptions
datahub_get_lineageGet upstream/downstream lineage (supports level=column for column-level)
datahub_get_queriesGet SQL queries associated with a dataset
datahub_browseBrowse catalog: list tags, domains, or data products
datahub_get_glossary_termGet glossary term definition and properties
datahub_get_data_productGet data product details (owners, domain, properties)
datahub_list_connectionsList configured DataHub server connections (multi-server mode)

Write Tools (require DATAHUB_WRITE_ENABLED=true)

3 CRUD tools using the what discriminator pattern — 37 operations total:

ToolOperationsDescription
datahub_create10Create tags, domains, glossary terms, data products, documents, applications, queries, incidents, structured properties, data contracts
datahub_update19Update descriptions (including tag/glossaryTerm descriptions), tags, glossary terms, links, owners, domains, structured properties, custom properties, incidents, queries, documents, data contracts
datahub_delete8Delete queries, tags, domains, glossary entities, data products, applications, documents, structured properties

Write tools are disabled by default for safety.

DataHub Version Compatibility

Minimum: DataHub 1.3.x. Full feature set: DataHub 1.4.x.

DataHub VersionFeatures
1.3.x+ (minimum)All read tools, all write operations except documents (tags, domains, glossary, data products, queries, owners, links, descriptions, incidents, applications, structured properties incl. delete, data contracts)
1.4.x+ (full)+ Documents (create/update/delete)

The client gracefully handles version differences — read queries return empty results (not errors) when a feature is unavailable on older versions.

See the tools reference for detailed documentation.

Configuration

VariableDescriptionDefault
DATAHUB_URLDataHub GraphQL API URL(required)
DATAHUB_TOKENAPI token(required)
DATAHUB_TIMEOUTRequest timeout (seconds)30
DATAHUB_DEFAULT_LIMITDefault search limit10
DATAHUB_MAX_LIMITMaximum limit100
DATAHUB_CONNECTION_NAMEDisplay name for primary connectiondatahub
DATAHUB_ADDITIONAL_SERVERSJSON map of additional servers(optional)
DATAHUB_WRITE_ENABLEDEnable write operations (true or 1)false
DATAHUB_DEBUGEnable debug logging (1 or true)false

Extensions

VariableDescriptionDefault
MCP_DATAHUB_EXT_LOGGINGEnable structured logging of tool callsfalse
MCP_DATAHUB_EXT_METRICSEnable metrics collectionfalse
MCP_DATAHUB_EXT_METADATAEnable metadata enrichment on resultsfalse
MCP_DATAHUB_EXT_ERRORSEnable error hint enrichmenttrue

Config File

As an alternative to environment variables, configure via YAML or JSON:

yaml
datahub:  url: https://datahub.example.com  token: "${DATAHUB_TOKEN}"  timeout: "30s"  write_enabled: true
toolkit:  default_limit: 20  descriptions:    datahub_search: "Custom search description for your deployment"
extensions:  logging: true  errors: true

Load with extensions.LoadConfig("config.yaml"). Environment variables override file values for sensitive fields. Token values support $VAR / ${VAR} expansion.

See configuration reference for all options.

Development

bash
make build     # Build binarymake test      # Run tests with race detectionmake lint      # Run golangci-lintmake security  # Run gosec and govulncheckmake coverage  # Generate coverage reportmake verify    # Run tidy, lint, and testmake help      # Show all targets

Related Projects

Contributing

See CONTRIBUTING.md for guidelines.

License

Apache License 2.0


Open source by Craig Johnston, sponsored by Deasil Works, Inc.

來源:README.md,提交 8b66462

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.15.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分