npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

microgrids-dbdoc-mcp

v1.0.2

Published

Pure Node database documentation generation MCP service | Powered by Bangdao Inc.

Readme

microgrids-dbdoc-mcp

纯 Node 实现的数据库设计文档生成 MCP 服务。

服务通过 MCP 工具接收数据库连接和文档输出参数,直接连接 PostgreSQL 或 MySQL 读取表、字段、主键和索引元数据,支持输出 Markdown、HTML、Word。

Powered by Bangdao Inc.


MCP 配置

先构建:

cd microgrids-common-dbdoc/doc/mcp/microgrids-dbdoc-mcp
npm install && npm run build

在 Cursor MCP 配置(~/.cursor/mcp.json)中添加:

{
  "mcpServers": {
    "microgrids-dbdoc-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/microgrids-dbdoc-mcp/dist/index.js"],
      "env": {
        "DBDOC_DATABASE_TYPE": "POSTGRESQL",
        "DBDOC_HOST": "your_db_host",
        "DBDOC_PORT": "5432",
        "DBDOC_DATABASE": "microgrids_service",
        "DBDOC_USERNAME": "postgres",
        "DBDOC_PASSWORD": "your_db_password",
        "DBDOC_SCHEMA": "public",
        "DBDOC_OUTPUT_DIR": "/path/to/output",
        "DBDOC_FILE_TYPE": "MD"
      }
    }
  }
}

优先级:工具调用参数高于环境变量,高于代码默认值。


工具说明

generate_database_documentation

生成数据库设计文档。

未通过环境变量配置时,调用工具至少需要传入:

  • host: 数据库服务器地址。
  • database: 数据库名称。
  • username: 数据库用户名。
  • password: 数据库密码。

常用可选参数:

  • database_type: 数据库类型,支持 POSTGRESQLMYSQL,默认 POSTGRESQL
  • port: 数据库端口,PostgreSQL 默认 5432,MySQL 默认 3306
  • schema: PostgreSQL schema,默认 public
  • output_dir: 文档输出目录,默认 MCP 当前工作目录。
  • file_name: 输出文件名,不含扩展名,默认 {database}_数据库设计文档
  • file_type: 输出类型,支持 MDHTMLWORD,默认 MD
  • version: 文档版本号,默认 1.0.0
  • description: 文档描述,默认 数据库设计文档

表过滤参数:

  • ignore_table_names
  • ignore_table_prefixes
  • ignore_table_suffixes
  • designated_table_names
  • designated_table_prefixes
  • designated_table_suffixes

示例调用参数:

{
  "database_type": "POSTGRESQL",
  "host": "127.0.0.1",
  "port": 5432,
  "database": "microgrids_service",
  "username": "postgres",
  "password": "password",
  "schema": "public",
  "output_dir": "doc/dbdoc",
  "file_type": "MD",
  "description": "微电网数据库设计文档"
}

成功返回示例:

{
  "status": "success",
  "databaseType": "POSTGRESQL",
  "database": "microgrids_service",
  "schema": "public",
  "fileType": "MD",
  "outputDir": "/path/to/output",
  "outputPath": "/path/to/output/microgrids_service_数据库设计文档.md",
  "outputExists": true,
  "tableCount": 42,
  "generateTime": "实际生成时间"
}

工作流程

MCP 工具参数
       |
       |-- 连接 PostgreSQL / MySQL
       |-- 查询表、字段、主键、索引元数据
       |-- 渲染 Markdown / HTML / Word 文档
       |
       v
输出数据库设计文档

环境要求

  • Node.js >= 18.0.0
  • npm >= 8.0.0
  • 数据库网络可访问