mcp-server-sqlseed

v0.2.7
mcp-server-sqlseed Checked 1 hour ago Published 18 days ago

Offline MCP tools for sqlseed rule-driven YAML configuration and test data generation

Model Context Protocol tools for sqlseed: derive a YAML configuration from database schema, then generate test data. Both tools use offline Core rules and require no LLM. These instructions target version 0.2.7. Check Releases for publication status; use the source installation below to test an unpublished candidate. Use a Python 3.10+ virtual environment: Core 0.2.4 and older lack the shared diagnostic interfaces required by this version. For development, install Core and the required local plugins together from the repository root:

Summary extracted from the README.

mcp-server-sqlseed

English | 中文

Model Context Protocol tools for sqlseed: derive a YAML configuration from database schema, then generate test data. Both tools use offline Core rules and require no LLM.

Installation

These instructions target version 0.2.7. Check Releases for publication status; use the source installation below to test an unpublished candidate. Use a Python 3.10+ virtual environment:

python -m pip install "mcp-server-sqlseed==0.2.7"

Core 0.2.4 and older lack the shared diagnostic interfaces required by this version. For development, install Core and the required local plugins together from the repository root:

python -m pip install -e . -e ./plugins/mcp-server-sqlseed

MCP client configuration

Use the executable from the environment where the package is installed:

{
  "mcpServers": {
    "sqlseed": {
      "command": "mcp-server-sqlseed"
    }
  }
}

If the client does not inherit that environment's PATH, use the executable's absolute path. The server runs over stdio. python -m mcp_server_sqlseed is also supported.

Tools

Tool Input and result
sqlseed_generate_yaml Takes db_path and table_name; returns a rule-driven YAML string
sqlseed_execute_fill Takes db_path, table_name, count=1000, optional yaml_config, and enrich=False; returns the table, committed count, elapsed time, and errors

The db_path argument accepts an existing SQLite .db/.sqlite/.sqlite3 file or a database URL. For PostgreSQL, install the Core postgres extra. Tables must already exist. The schema mapper chooses generators deterministically; no model request is made by either tool. Both tools use the required Faker provider with the en_US locale, matching the generated template; Mimesis is not required.

When yaml_config is supplied, it must be a YAML mapping containing the requested table. Empty documents, unknown tables, and configurations for a different table fail before generation. The UTF-8 size limit is 256 KiB. Tool arguments select the database, table, row count, and enrichment; YAML contributes only the matching table's column rules, seed, and clear_before setting. Top-level YAML provider and locale settings do not change this server's engine or locale.

Shared YAML aliases are supported. Cyclic aliases anywhere in the supplied document return an error before clearing or inserting rows, including when clear_before is true. This validation does not precede opening the database connection. The check is owned by MCP and does not rely on private Core loader helpers.

A typical client workflow is:

  1. Call sqlseed_generate_yaml for an existing table.
  2. Review the YAML and desired row count.
  3. Call sqlseed_execute_fill and check its errors and committed count.

Earlier committed batches can remain after a later batch fails. The YAML tool returns # Error: ... for handled errors; the fill tool returns an error field for handled request failures. Check these in addition to MCP transport success.

Separate AI MCP server

This package exposes exactly the two tools above. Schema resources and a standalone schema-inspection tool are not provided. For LLM analysis, install the separate AI MCP extra:

python -m pip install "sqlseed-ai[mcp]==0.2.7"
mcp-server-sqlseed-ai

For a source checkout, use python -m pip install -e . -e ./plugins/sqlseed-cli -e "./plugins/sqlseed-ai[mcp]". Its YAML tool is sqlseed_ai_generate_yaml; its executable is mcp-server-sqlseed-ai. The old mcp-server-sqlseed[ai] installation does not describe the current package layout.

Requirements

These metadata requirements apply to version 0.2.7 and its source candidates. Use local Core and plugins together when developing from source.

  • Python >=3.10
  • sqlseed>=0.2.5.dev0,<0.3
  • mcp>=1.0,<2

See the user guide, migration guide, and server source.

License: AGPL-3.0-or-later. The distribution includes the full LICENSE text.