mcp

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mcp implements the GoForge MCP server: it exposes the same migration.Engine the CLI uses to AI agents over stdio. Read-only tools run without confirmation; every tool that modifies the database schema requires an explicit confirm:true argument. No tool executes arbitrary SQL, so there is no path for an agent to run DROP DATABASE, TRUNCATE, or any other statement outside of the project's own reviewed migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(engine *migration.Engine, cfg *config.Config, version string) *sdk.Server

NewServer builds the GoForge MCP server bound to engine, using cfg for display metadata (driver name, migrations path).

Types

type Empty

type Empty struct{}

Empty is the input type for tools that take no arguments.

type ListOutput

type ListOutput struct {
	Migrations []MigrationRow `json:"migrations"`
}

ListOutput is the result of goforge_migration_list.

type MigrationRow

type MigrationRow struct {
	Version   uint64 `json:"version"`
	Name      string `json:"name"`
	Applied   bool   `json:"applied"`
	Batch     int    `json:"batch,omitempty"`
	AppliedAt string `json:"applied_at,omitempty"`
	Dirty     bool   `json:"dirty,omitempty"`
}

MigrationRow is the MCP-facing view of one migration's state.

type PendingOutput

type PendingOutput struct {
	Migrations []MigrationRow `json:"migrations"`
}

PendingOutput is the result of goforge_migration_pending.

type PlanInput

type PlanInput struct {
	Direction string `json:"direction,omitempty" jsonschema:"either 'up' or 'down'; defaults to 'up'"`
	Steps     int    `json:"steps,omitempty" jsonschema:"limit how many migrations to include in the plan; 0 means all"`
}

PlanInput selects the direction and scope for goforge_migration_plan.

type PlanOutput

type PlanOutput struct {
	Direction  string         `json:"direction"`
	Migrations []MigrationRow `json:"migrations"`
}

PlanOutput is the result of goforge_migration_plan: what would run, without having modified the database.

type RunInput

type RunInput struct {
	Steps   int  `json:"steps,omitempty" jsonschema:"limit how many migrations to run; 0 means all pending (up) or the last batch (rollback)"`
	Confirm bool `json:"confirm" jsonschema:"must be true; this call runs schema-modifying migrations against the database"`
}

RunInput is shared by goforge_migration_up and goforge_migration_rollback. Confirm must be explicitly set to true: these tools modify the database schema, and GoForge never runs a schema-modifying operation an agent triggered without explicit, per-call confirmation.

type RunOutput

type RunOutput struct {
	Batch      int            `json:"batch,omitempty"`
	Migrations []MigrationRow `json:"migrations"`
}

RunOutput is the result of goforge_migration_up / goforge_migration_rollback.

type StatusOutput

type StatusOutput struct {
	Driver         string `json:"driver"`
	MigrationsPath string `json:"migrations_path"`
	Total          int    `json:"total"`
	Applied        int    `json:"applied"`
	Pending        int    `json:"pending"`
	Dirty          bool   `json:"dirty"`
}

StatusOutput summarizes the migration state for goforge_status.

type ValidateOutput

type ValidateOutput struct {
	Valid bool   `json:"valid"`
	Error string `json:"error,omitempty"`
}

ValidateOutput is the result of goforge_migration_validate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL