Db Metadata Extractor Mcp

io.github.Optisol-Business由 GitHub 账号 Optisol-Business 发布v0.1.6更新于 Oct 24, 2026

Extract database metadata from PostgreSQL, Snowflake, SQL Server, BigQuery, and Oracle.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

本地 MCP 服务器,让助手从 PostgreSQL、Snowflake、SQL Server、BigQuery 和 Oracle 提取表结构元数据并保存为 JSON,再对其查询。

可以做什么
从 PostgreSQL、Snowflake、SQL Server、BigQuery 或 Oracle 提取完整表结构元数据(表、列、主键、索引、约束),可限定某个 schema 或表清单,并保存为本地 JSON 文件及统计摘要。按表名或列名搜索、筛选已提取的元数据文件,支持大 schema 的分页浏览。
适用场景
适合让助手盘点或记录数据库结构、比较和浏览表与列定义,或在不依赖云服务的情况下生成本地 JSON 元数据快照。
运行要求
以 Python 包(Python 3.8+)或 Docker 镜像在本地通过 stdio 运行;需按数据库安装驱动,如 psycopg2-binary、snowflake-connector-python、pyodbc/pymssql、google-cloud-bigquery 或 oracledb。需要能访问目标数据库的网络,以及具备 SELECT、USAGE、CONNECT 权限的数据库用户;BigQuery 需 base64 编码的服务账号密钥。
安装前请注意
数据库凭据(用户名、密码、Snowflake 账号/仓库/角色、BigQuery 服务账号密钥)通过工具参数或环境变量传入,会出现在助手对话和配置文件中。数据库用户应设为只读;提取会把 JSON 文件写入你指定的路径。README 还提供 HTTP 传输方式,会使服务器暴露到本机之外。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Db Metadata Extractor Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-name: io.github.Optisol-Business/db-metadata-extractor-mcp

Database Metadata Extractor MCP Server

A Model Context Protocol (MCP) server that extracts and queries database schema metadata from PostgreSQL, Snowflake, SQL Server, BigQuery, and Oracle databases.

Features

  • ✅ Multi-database support: PostgreSQL, Snowflake, SQL Server (MSSQL), BigQuery, Oracle
  • ✅ Complete schema extraction: Tables, columns, primary keys, indexes, constraints
  • ✅ Local JSON output: Saves metadata directly to local folder (no cloud required)
  • ✅ Query interface: Search and filter metadata by table/column names
  • ✅ Pagination support: Browse large schemas efficiently
  • ✅ VS Code integration: Works with VS Code Agent Mode
  • ✅ CLI customizable: Transport options (stdio, HTTP)

Installation

From PyPI

bash
pip install db-metadata-extractor-mcp

From Source

bash
git clone https://github.com/Optisol-Business/db-metadata-extractor-mcp.gitcd db-metadata-extractor-mcppip install -e .

Quick Start

1. Start the MCP Server

bash
db-metadata-extractor-mcp

The server starts in stdio mode by default and listens for MCP client connections.

2. Configure in Claude Desktop

Add to ~/.config/Claude/claude_desktop_config.json (macOS/Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{  "mcpServers": {    "db-metadata-extractor": {      "command": "db-metadata-extractor-mcp",      "args": [],      "env": {}    }  }}

Restart Claude Desktop.

3. Use in Claude

Tell Claude:

Extract metadata from my PostgreSQL database and save it to /tmp/output

Claude will use the server's tools to extract and query your database schema.

Tools

extract_metadata

Extracts complete schema metadata from a database.

Parameters:

  • db_type (required): postgresql, snowflake, sqlserver, bigquery, oracle
  • output_path (required): Local directory for JSON output
  • database_name: Database/schema name
  • host: Database host (not needed for BigQuery/Snowflake)
  • port: Database port
  • username: Database user
  • password: Database password
  • schema_name: Specific schema (optional)
  • tables: Array of table names to extract (optional)
  • account: Snowflake account ID
  • warehouse: Snowflake warehouse
  • role_name: Snowflake role
  • project_id: BigQuery project ID
  • service_account_key: BigQuery service account JSON (base64 encoded)

Returns:

  • File path where metadata was saved
  • Summary statistics (table count, column count, etc.)

query_metadata

Query previously extracted metadata.

Parameters:

  • filepath (required): Path to metadata JSON file
  • table_name: Filter by table name (substring match)
  • field_name: Filter by column name (substring match)
  • page: Page number (default: 1)
  • page_size: Results per page (default: 20)

Returns:

  • Paginated table results matching filters

Examples

PostgreSQL

bash
# Via Claude"Extract all tables from my dev PostgreSQL database at localhost:5432"

Parameters Claude will use:

json
{  "db_type": "postgresql",  "host": "localhost",  "port": 5432,  "database_name": "dev_db",  "username": "postgres",  "password": "your_password",  "output_path": "/tmp/db_metadata"}

Snowflake

bash
"Extract schema from Snowflake account XYZ123"

Parameters:

json
{  "db_type": "snowflake",  "account": "XYZ123",  "username": "your_user",  "password": "your_password",  "warehouse": "COMPUTE_WH",  "role_name": "ANALYST",  "database_name": "PRODUCTION",  "output_path": "C:/metadata"}

BigQuery

bash
"Extract metadata from BigQuery project my-project-123"

Parameters:

json
{  "db_type": "bigquery",  "project_id": "my-project-123",  "service_account_key": "base64_encoded_json_key",  "output_path": "/tmp/bq_metadata"}

Advanced Usage

Custom Transport

Start with HTTP transport:

bash
db-metadata-extractor-mcp --transport streamable-http --port 3000

Environment Variables

bash
# Set database credentials via envexport DB_HOST=localhostexport DB_USER=postgresexport DB_PASSWORD=secret
db-metadata-extractor-mcp

Output Format

The extracted metadata is saved as a JSON file with structure:

json
{  "source": {    "db_type": "postgresql",    "extracted_at": "2026-04-09T14:30:00",    "host": "localhost"  },  "schemas": [    {      "schema_name": "public",      "tables": [        {          "table_name": "users",          "columns": [            {              "column_name": "id",              "data_type": "int",              "is_nullable": false,              "is_primary_key": true            },            {              "column_name": "email",              "data_type": "varchar",              "is_nullable": false            }          ],          "indexes": [            {              "index_name": "users_email_idx",              "columns": ["email"]            }          ]        }      ]    }  ]}

Requirements

  • Python 3.8+
  • For PostgreSQL: psycopg2-binary
  • For Snowflake: snowflake-connector-python
  • For SQL Server: pyodbc, pymssql
  • For BigQuery: google-cloud-bigquery
  • For Oracle: oracledb

Troubleshooting

Connection Errors

Problem: "Unable to connect to database"

Solution: Verify credentials and network access:

bash
# Test PostgreSQL connectionpsql -h localhost -U postgres -c "SELECT 1"
# Test Snowflakesnowsql -a XYZ123 -u your_user

Permission Errors

Problem: "Access denied" or "insufficient permissions"

Solution: Ensure database user has:

  • SELECT on tables
  • USAGE on schemas
  • CONNECT on databases

Large Schema Timeouts

Problem: Extraction times out on large databases

Solution: Extract specific schema/tables:

json
{  "schema_name": "public",  "tables": ["users", "orders"]  // Specify subset}

License

MIT License - See LICENSE file

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create feature branch
  3. Submit pull request

Support

Links

来源:README.md,提交 34ce92c

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.6最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。