一键导入
use-gfs-mcp
GFS MCP Server for AI agent integration. Provides Model Context Protocol tools for database version control with automatic schema versioning.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
GFS MCP Server for AI agent integration. Provides Model Context Protocol tools for database version control with automatic schema versioning.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | use-gfs-mcp |
| description | GFS MCP Server for AI agent integration. Provides Model Context Protocol tools for database version control with automatic schema versioning. |
GFS provides an MCP (Model Context Protocol) server for AI agent integration, enabling programmatic access to database version control operations including commits, branches, time travel, and schema versioning.
The MCP server requires the GFS CLI to be installed on the host system.
Add GFS to your MCP client configuration (e.g., Claude Desktop, custom MCP client). The MCP server runs as: gfs mcp
Configuration requires:
gfs binary["mcp"]GFS_REPO_PATH environment variableThe server starts automatically when configured in your MCP client. It provides access to all GFS operations through MCP tools.
The MCP server exposes 13 tools for database version control operations. All tools accept an optional path parameter to specify repository location.
Use the status tool to check repository state, current branch, HEAD commit, and database container status.
GFS supports Git-style revision notation in all tools that accept commit references (checkout, show_schema, diff_schema, log):
HEAD - Current commitmain - Branch tip (any branch name)abc123def456... - Full commit hash (64 characters)Reference ancestor commits using ~ notation:
HEAD~1 - Parent of HEAD (previous commit)HEAD~5 - 5th ancestor of HEADmain~3 - 3 commits before main branch tipabc123~2 - 2nd parent of commit abc123HEAD~ - Same as HEAD~1 (defaults to 1)// Checkout previous commit
checkout({ revision: "HEAD~1" })
// Compare schema with 5 commits ago
diff_schema({ commit1: "HEAD~5", commit2: "HEAD" })
// View schema from 3 commits back
show_schema({ commit: "main~3" })
// Show ancestor schema
show_schema({ commit: "abc123def456...~2" })
// View log from ancestor to current
log({ from: "HEAD~10", until: "HEAD" })
CRITICAL: Always use the commit tool before database mutations. This enables rollback if issues occur.
Commits automatically capture database schema at commit time, providing complete versioning of both data and structure.
Tool: list_providers
Lists all supported database providers, versions, and available features. No parameters required.
Returns: Array of providers with supported versions and feature lists.
Tool: init
Creates a new GFS repository with specified database provider and version.
Parameters:
database_provider (required) - Provider name (postgres, mysql)database_version (required) - Version string (e.g., "17", "8.0")path (optional) - Repository locationReturns: Repository path and initialization status.
Tool: status
Gets repository and database container status including current branch, HEAD commit, and connection information.
Parameters:
path (optional) - Repository locationReturns: Branch name, commit hash, container state, connection info if running.
Tool: commit
Creates snapshot of database state, automatically capturing schema at commit time.
Parameters:
message (required) - Commit messagepath (optional) - Repository locationauthor (optional) - Author nameauthor_email (optional) - Author emailReturns: Commit hash.
Automatic Schema Versioning: Every commit captures database schema including structured metadata and native DDL.
Tool: log
Views commit history with optional filtering.
Parameters:
path (optional) - Repository locationmax_count (optional) - Limit number of commitsfrom (optional) - Starting revisionuntil (optional) - Ending revisionReturns: Array of commits with metadata, timestamps, authors, and references.
Tool: checkout
Switches to existing branch, specific commit, or creates new branch.
Parameters:
revision (required) - Branch name or commit hashpath (optional) - Repository locationcreate_branch (optional) - Create new branch if trueReturns: Success status and checked out revision.
Tip: For branch listing and creation without switching, use the CLI with --json:
# List branches programmatically
gfs branch
# Create branch from checkpoint without switching
gfs branch release/v1.0 <commit_hash>
# Delete a branch
gfs branch -d old-feature
Tool: compute
Manages database container lifecycle.
Parameters:
action (required) - Operation: status, start, stop, restart, pause, unpause, logspath (optional) - Repository locationtail (optional, logs only) - Number of lines to showsince (optional, logs only) - Timestamp filterReturns: Status information or log output based on action.
Actions:
Tool: query
Executes SQL queries against the database or returns connection information.
Parameters:
query (optional) - SQL query to execute (omit for connection info)path (optional) - Repository locationdatabase (optional) - Override database nameReturns: Query results or connection information if no query provided.
Tool: extract_schema
Extracts schema from running database, returning structured metadata.
Parameters:
path (optional) - Repository locationReturns: Complete schema metadata including schemas, tables, columns, constraints, and relationships as structured JSON.
Use case: Understand current database structure before making changes or writing queries.
Tool: show_schema
Views database schema as it existed at any commit in history.
Parameters:
commit (required) - Commit hash or reference (HEAD, main, branch name)path (optional) - Repository locationmetadata_only (optional) - Return only JSON metadataddl_only (optional) - Return only SQL DDLReturns: Schema object with hash, metadata, and/or DDL based on flags.
Output includes:
Use case: View schema at any point in history, document database structure, audit schema changes.
Tool: diff_schema
Tracks schema evolution by comparing schemas between two commits.
Parameters:
commit1 (required) - First commit hash or referencecommit2 (required) - Second commit hash or referencepath (optional) - Repository locationBoth commit1 and commit2 accept rev~n notation for ancestor references (e.g., HEAD~5, main~3).
Returns: Schema comparison with hashes, table/column count changes, and difference summary.
Comparison includes:
Use case: Review schema changes before merging branches, track schema evolution, identify breaking changes.
Tool: export_database
Exports database data to file.
Parameters:
format (required) - Export format (sql, custom)path (optional) - Repository locationoutput_dir (optional) - Output directory pathReturns: Export file path and status.
Supported formats:
Tool: import_database
Imports data from file into database.
Parameters:
file_path (required) - Path to import filepath (optional) - Repository locationformat (optional) - Data format (sql, csv, json, custom)Returns: Import status.
Supported formats: SQL, CSV, JSON, custom (database-specific formats).
Track schema changes alongside code changes for complete version control.
Workflow:
status to verify repository and container stateshow_schema to view current schema structurecheckout with create_branch to create feature branchquery toolcommit to capture changes (schema automatically versioned)diff_schema to compare with main branchMonitor how database schema changes over time.
Workflow:
log to view commit historyshow_schema on different commits to see schema at each pointdiff_schema to compare schemas across time periodsRestore database to earlier state when issues occur.
Workflow:
log to find target commitshow_schema to verify schema at that commitcheckout to switch to specific commitstatus to verify statequery to validate datacheckout with create_branch if state is correctPlan database migrations by comparing schemas.
Workflow:
show_schema on production commitshow_schema on feature branchdiff_schema to identify all schema changesGenerate documentation from schema history.
Workflow:
log to get list of releases or major versionsshow_schema with metadata_only for each versiondiff_schema between versions to identify breaking changesUse compute with action status to check container state. If stopped, use action start to start container. Use action logs to view error messages if container fails to start.
Use status tool to get connection information. Ensure container is running via compute status. Verify ports are available (PostgreSQL: 5432, MySQL: 3306).
Ensure path parameter points to directory with .gfs folder, or set GFS_REPO_PATH environment variable in MCP server configuration.
If show_schema returns error about missing schema, the commit was created before schema versioning was enabled. Use extract_schema to capture current schema, then create new commit.
Check that GFS CLI is installed on MCP server host. Verify Docker is running for database operations. Review error messages in tool response for specific issues.
--jsonWhen MCP tools are unavailable or you need operations not yet exposed as MCP tools (e.g., branch management, graph log), use the GFS CLI with --json for structured output:
# Structured commit output
gfs --json commit -m "checkpoint before migration"
# → {"hash":"b57732d8...","branch":"main","message":"checkpoint before migration"}
# Structured checkout output
gfs --json checkout -b feature/migration
# → {"hash":"b57732d8...","branch":"feature/migration","new_branch":true}
# Repository status (JSON)
gfs --json status
# Branch listing (JSON)
gfs --json branch
# Branch topology graph
gfs log --graph --all
Exit codes for conditional logic:
gfs status → 0 (compute running) or 1 (compute down)gfs schema diff → 0 (no changes), 1 (changes), 2 (breaking)--json for CLI fallback - When MCP tools aren't available, CLI with --json gives structured outputGFS_REPO_PATH - Default repository path for MCP serverpath parameter omittedEvery commit operation automatically:
show_schemaSchema storage:
Schema metadata includes:
Schema DDL includes: