Documentation
¶
Overview ¶
Package mcpapi exposes the MCP adapter for DeltaScope. input: audit_sql MCP requests, shared DeltaScope public audit API, and resolved run-context metadata output: structured MCP audit_sql responses, partial parser-error results, and compact finding summaries with offline existence caveats and resolved catalog-aware metadata audits pos: MCP audit tool adapter between tool invocations and the shared audit engine note: if this file changes, update this header and module README.md.
Package mcpapi exposes the MCP adapter for DeltaScope. input: audit tool connection parameters, local connection config files, password lookup sources, and optional database/catalog selection output: normalized metadata-aware connection settings for MCP audit requests with database and schema preserved separately pos: MCP connection resolution layer between tool inputs and metadata provider wiring note: if this file changes, update this header and module README.md.
Package mcpapi exposes the MCP adapter for DeltaScope. input: MCP success payload types that need explicit output-schema publication output: resolved JSON Schema objects for official DeltaScope MCP tool outputs pos: schema publication helpers for MCP tool registration metadata note: if this file changes, update this header and module README.md.
Package mcpapi exposes the MCP adapter for DeltaScope. input: shipped rule catalog entries and DeltaScope capability metadata for MCP rule tools output: full describe_rule bodies, compact list_rules rows plus text catalog, and get_capabilities summaries including query_access unavailability, the public connection.connect_timeout capability, and offline existence context_fields pos: MCP rule-discovery helpers above the domain rule catalog note: if this file changes, update this header and module README.md.
Package mcpapi exposes the MCP adapter for DeltaScope. input: MCP server construction inputs, DeltaScope version metadata, and tool registration definitions output: ready-to-run MCP server instances that expose the official DeltaScope tool surface pos: interface adapter between the Go MCP SDK and DeltaScope audit/rule capabilities note: if this file changes, update this header and module README.md.
Package mcpapi exposes the MCP adapter for DeltaScope. input: adapter and audit errors plus partial audit results arising during MCP tool execution; connection-open errors classified by connresolve output: stable MCP tool error payloads with machine-readable codes, messages, and partial results when available pos: shared error-shaping helpers for MCP tool handlers note: if this file changes, update this header and module README.md.
Index ¶
Constants ¶
const DefaultConnectionsPath = "~/.config/deltascope/connections.yaml"
DefaultConnectionsPath is the default local path used to resolve MCP connection_ref names.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuditContext ¶
type AuditContext struct {
Mode string `json:"mode,omitempty"`
Dialect string `json:"dialect,omitempty"`
DialectSource string `json:"dialect_source,omitempty"`
Schema string `json:"schema,omitempty"`
SchemaSource string `json:"schema_source,omitempty"`
MetadataSource MetadataSource `json:"metadata_source,omitempty"`
Note string `json:"note,omitempty"`
Unproven []string `json:"unproven,omitempty"`
}
AuditContext describes how one MCP audit_sql result was produced.
type AuditSQLParams ¶
type AuditSQLParams struct {
SQL string `json:"sql"`
Dialect string `json:"dialect,omitempty"`
ConfigPath string `json:"config_path,omitempty"`
ConnectionRef string `json:"connection_ref,omitempty"`
Connection *ConnectionInput `json:"connection,omitempty"`
}
AuditSQLParams describes the MCP-facing audit_sql request contract.
type AuditSQLResult ¶
type AuditSQLResult struct {
publicapi.Result
Context AuditContext `json:"context"`
}
AuditSQLResult preserves the public DeltaScope result body and adds MCP context.
type Config ¶
type Config struct {
Version string
ConnectionsPath string
Logger *slog.Logger // Optional structured logger. Defaults to stderr JSON if nil.
MetadataConnectTimeout time.Duration
}
Config configures the DeltaScope MCP server bootstrap.
type ConnectionInput ¶
type ConnectionInput = ifaceconn.ConnectionInput
type MetadataSource ¶
type MetadataSource string
MetadataSource identifies how one metadata-aware audit connection was selected.
const ( // MetadataSourceNone indicates the request stayed offline. MetadataSourceNone MetadataSource = "none" // MetadataSourceConnectionRef indicates the request used a named connection reference. MetadataSourceConnectionRef MetadataSource = "connection_ref" // MetadataSourceDirect indicates the request used direct inline connection settings. MetadataSourceDirect MetadataSource = "direct" )
type ResolveConnectionOptions ¶
type ResolveConnectionOptions struct {
ConnectionsPath string
LookupEnv func(string) (string, bool)
ReadFile func(string) ([]byte, error)
}
ResolveConnectionOptions configures connection resolution dependencies.
type ResolvedConnection ¶
type ResolvedConnection struct {
Enabled bool
Source MetadataSource
RefName string
RefPath string
Host string
Port int
Socket string
User string
Database string
Schema string
Dialect string
Password string
ConnectTimeout string
}
ResolvedConnection is the normalized metadata-aware connection used by MCP audit flows.
func ResolveAuditConnection ¶
func ResolveAuditConnection(params AuditSQLParams, options ResolveConnectionOptions) (ResolvedConnection, error)
ResolveAuditConnection validates and normalizes the MCP audit_sql connection inputs.