Skip to main content
Glama
JJVvV

SP Database MCP Server

by JJVvV

SP Database MCP Server

一个用于实时获取数据库表结构信息的 Model Context Protocol (MCP) 服务器。通过 MCP 协议,可以让 AI 助手实时获取数据库的表结构信息,解决信息不及时更新的问题。

alt text

功能特性

  • 智能表结构查询:支持两种查询模式

    • 低代码系统 Schema 查询:通过 da_logic_entityda_entity_attribute 表获取详细的业务字段信息

    • 传统数据库元数据查询:直接从数据库系统表获取技术字段信息

  • 🔄 实时获取数据库表结构信息

  • 📊 支持多种数据库类型 (MySQL, PostgreSQL)

  • 🚀 通过 API 接口动态获取最新的表字段信息

  • 🔍 支持表信息查询和字段详情获取

  • 📝 自动生成表结构文档

Related MCP server: Alibaba Cloud DMS MCP Server

安装

从 PyPI 安装(推荐)

# 安装(包含 PostgreSQL 支持)
pip install "sp-database-mcp[postgresql]"

# 或使用 uv
uv add "sp-database-mcp[postgresql]"

# 安装特定数据库支持
pip install sp-database-mcp[mysql]
pip install sp-database-mcp[postgresql]

从源码安装

# 克隆仓库
git clone https://github.com/alexliu/sp-enterprise-mcp.git
cd sp-enterprise-mcp

# 安装依赖
uv sync

# 或使用 pip
pip install -e .

配置

环境变量

# 数据库连接配置
DATABASE_URL="postgresql://user:password@host:port/database"
# 或者
DATABASE_URL="mysql://user:password@host:port/database"

# API 接口配置(如果通过 API 获取)
API_BASE_URL="http://your-api-server.com"

MCP 客户端配置

Claude Desktop 配置(使用 uvx)

{
  "mcpServers": {
    "sp-database-mcp": {
      "command": "uvx",
      "args": ["sp-database-mcp[postgresql]"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@host:port/database"
      }
    }
  }
}

Windsurf 配置

{
  "mcpServers": {
    "sp-database-mcp": {
      "command": "uvx",
      "args": ["sp-database-mcp[postgresql]"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@host:port/database"
      }
    }
  }
}

开发版本配置

如果你想使用本地开发版本,可以使用以下配置:

{
  "mcpServers": {
    "sp-database-mcp-dev": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/sp-database-mcp",
        "run",
        "python",
        "-m",
        "sp_database_mcp.server"
      ],
      "env": {
        "DATABASE_URL": "postgresql://user:password@host:port/database"
      }
    }
  }
}

使用方式

启动 MCP 服务器

uv run sp-database-mcp[postgresql]

使用示例

查询表结构信息

现在支持两种查询模式,系统会自动优先使用低代码系统的 schema 查询:

# 通过 MCP 工具查询表信息
# 输入:请获取 activity_node 表的详细信息

# 输出示例(低代码系统 schema 查询结果):
# activity_node 表结构信息
# 
# **表说明**: 活动
# 
# ## 字段信息
# 
# | 字段名 | 类型 | 可空 | 默认值 | 主键 | 说明 |
# |--------|------|------|--------|------|---------|
# | id | BIGINT | 否 | - | 是 | 主键ID |
# | name | VARCHAR(1000) | 是 | - | 否 | 活动名称 |
# | activity_code | VARCHAR(64) | 是 | - | 否 | 活动编码 |
# | business_object_id | BIGINT | 是 | - | 否 | 业务对象id |
# | ... | ... | ... | ... | ... | ... |

查询模式说明

  1. 低代码系统 Schema 查询(优先)

    • 查询 da_logic_entity 表获取实体基本信息

    • 查询 da_entity_attribute 表获取字段详细信息

    • 提供中文字段名、业务描述、数据类型等丰富信息

    • 支持外键关系解析

  2. 传统数据库元数据查询(回退)

    • 当低代码系统查询失败时自动回退

    • 直接从数据库系统表获取技术字段信息

    • 提供基础的字段类型、约束等信息

项目结构

sp-database-mcp/
├── sp_database_mcp/
│       ├── __init__.py
│       ├── server.py          # MCP 服务器主文件
│       ├── database.py        # 数据库连接和查询
│       ├── api_client.py      # API 客户端
│       └── models.py          # 数据模型
├── tests/
├── .env.example
├── pyproject.toml
└── README.md

开发

# 安装开发依赖
uv sync --dev

# 运行测试
uv run pytest

# 代码格式化
uv run black .
uv run isort .

# 类型检查
uv run mypy .

Available Tools

4 tools
get_table_documentationC

获取表的详细文档说明

ParametersJSON Schema
NameRequiredDescriptionDefault
table_nameYes表名

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a read-only operation ('获取' - get) but doesn't specify whether this requires authentication, what format the documentation returns (e.g., text, structured data), if there are rate limits, or error conditions. The description is too vague to adequately inform the agent about behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese ('获取表的详细文档说明') that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple tool, though it could be more front-loaded with critical details given the lack of annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It doesn't explain what 'detailed documentation' entails (e.g., schema, comments, usage examples), how it differs from sibling tools, or behavioral aspects like error handling. The agent lacks sufficient context to use this tool effectively compared to alternatives.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage with 'table_name' clearly documented as '表名' (table name). The description doesn't add any parameter-specific details beyond what the schema provides, such as examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate, as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取表的详细文档说明' (Get detailed documentation for a table) states a clear purpose with a verb ('获取' - get) and resource ('表的详细文档说明' - table's detailed documentation). However, it doesn't differentiate from sibling tools like 'get_table_info' or 'search_tables', leaving ambiguity about what specifically distinguishes this documentation retrieval from general table information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_table_info' or 'search_tables'. It doesn't mention prerequisites, exclusions, or specific contexts where this tool is preferred, leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_table_infoA

获取指定数据库表的结构信息,包括字段定义、类型、注释等。支持两种查询方式:1) 低代码系统schema查询(通过da_logic_entity和da_entity_attribute表);2) 传统数据库元数据查询。优先使用低代码系统方式获取更详细的字段信息。

ParametersJSON Schema
NameRequiredDescriptionDefault
table_nameYes要查询的表名
sourceNo数据源类型:database(直连数据库)、api(通过API)、auto(自动选择)auto

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It successfully describes key behavioral traits: the tool retrieves (not modifies) information, supports two distinct query approaches with different characteristics, and has a preference hierarchy (优先使用低代码系统方式 - 'prefer using the low-code system approach'). It doesn't mention error conditions, performance characteristics, or authentication requirements, but provides substantial operational context beyond basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured in two sentences: the first states the core purpose and what information is retrieved, the second explains the two query approaches and their relative merits. Every phrase adds value, with no redundant information or unnecessary elaboration. The information is appropriately front-loaded with the main purpose first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 2 parameters, 100% schema coverage, no annotations, and no output schema, the description provides good contextual completeness. It explains the tool's purpose, what information it retrieves, and the operational approaches. The main gap is the lack of information about return format or output structure, which would be helpful given no output schema exists. However, it covers most other important aspects well.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema already documents both parameters thoroughly. The description adds some context by implying that 'table_name' is used for both query approaches and that 'source' parameter relates to the described data source types, but doesn't provide additional semantic meaning beyond what's in the schema descriptions. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('获取' meaning 'retrieve') and resources ('数据库表的结构信息' meaning 'database table structure information'), explicitly listing what information is included (字段定义、类型、注释 - field definitions, types, comments). It distinguishes from siblings by focusing on structural metadata rather than documentation (get_table_documentation), listing (list_all_tables), or searching (search_tables).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool by explaining the two query approaches (low-code system schema vs traditional database metadata) and stating a preference for the low-code approach to get more detailed field information. However, it doesn't explicitly mention when NOT to use it or name specific alternatives among the sibling tools, which prevents a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_all_tablesC

列出所有数据库表

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceNo数据源类型auto

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action ('列出所有' - list all) but doesn't disclose behavioral traits such as whether it's read-only, if it requires authentication, rate limits, or what the output format might be. For a tool with no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese ('列出所有数据库表'), which is appropriately sized and front-loaded with the core action. There's no wasted text, making it concise, though it could benefit from slight elaboration for better clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'all' entails (e.g., scope, pagination), behavioral aspects, or return values. For a tool that likely returns a list of tables, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with one parameter 'source' fully documented in the schema (including enum values and default). The description adds no additional meaning beyond the schema, so it meets the baseline of 3 where the schema does the heavy lifting. No compensation is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '列出所有数据库表' (List all database tables) clearly states the verb and resource, making the purpose understandable. However, it doesn't differentiate from sibling tools like 'search_tables' or 'get_table_info', which likely have overlapping functionality. The description is adequate but lacks specificity about scope or filtering.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'search_tables' or 'get_table_info'. The description implies a comprehensive listing, but without explicit context or exclusions, the agent must infer usage. This leaves ambiguity in tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_tablesC

根据关键词搜索数据库表

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes搜索关键词
sourceNo数据源类型auto

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but only states the basic action. It doesn't mention whether this is a read-only operation, what permissions might be required, how results are returned (format, pagination), or any rate limits. The description is minimal and lacks important behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that directly states the tool's purpose without any wasted words. It's appropriately sized for a simple search tool and front-loaded with the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with no annotations and no output schema, the description is insufficient. It doesn't explain what constitutes a 'match' (partial/full text?), what fields are searched, the format of returned results, or error conditions. Given the complexity of search operations and lack of structured metadata, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional meaning about parameters beyond what's in the schema (keyword for search, source with enum values). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'search database tables by keyword' (根据关键词搜索数据库表), which is a specific verb+resource combination. However, it doesn't distinguish this from sibling tools like 'list_all_tables' or 'get_table_info', which might also involve table retrieval but with different approaches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_all_tables' or 'get_table_info'. It doesn't mention any prerequisites, exclusions, or comparative contexts that would help an agent choose between these sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updates
    • First observedget_table_documentation
    • First observedget_table_info
    • First observedlist_all_tables
    • First observedsearch_tables

TDQS

B3.4/5.0
Disambiguation4/5

The tools are mostly distinct with clear purposes: list_all_tables enumerates all tables, search_tables finds tables by keyword, get_table_info retrieves structural details, and get_table_documentation provides documentation. However, get_table_info and get_table_documentation could be slightly ambiguous as both relate to table details, but their descriptions differentiate them well (structure vs. documentation).

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern using snake_case: get_table_documentation, get_table_info, list_all_tables, and search_tables. The naming is predictable and readable throughout the set.

Tool Count5/5

With 4 tools, the count is well-scoped for a database documentation server. Each tool serves a distinct function in exploring and understanding database tables, and there are no unnecessary or redundant tools.

Completeness4/5

The toolset covers core exploration needs: listing, searching, and retrieving table information and documentation. Minor gaps exist, such as no tools for updating or managing tables (e.g., create or modify operations), but this is reasonable for a read-only documentation server focused on querying metadata.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables Large Language Models to access and interact with database connections, including viewing schemas and performing CRUD operations on connected databases.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides AI assistants with comprehensive access to SQL databases, enabling schema inspection, query execution, and database operations with enterprise-grade security.
    35
    7
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides AI models with structured access to external data and services, acting as a bridge between AI assistants and applications, databases, and APIs in a standardized, secure way.
    2
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JJVvV/sp-enterprise-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server