server

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server implements the MCP (Model Context Protocol) server for database operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPServer

type MCPServer struct {
	// contains filtered or unexported fields
}

MCPServer represents the MCP server instance that handles database queries.

func NewMCPServer

func NewMCPServer(name, version string) *MCPServer

NewMCPServer creates a new MCP server instance with the specified name and version. It automatically registers the query_database tool for executing SQL queries.

func (*MCPServer) AddCustomTool added in v0.2.0

func (ms *MCPServer) AddCustomTool(name, description, sourceName, query string, parameters []string) error

AddCustomTool registers a custom tool with a predefined query.

func (*MCPServer) AddSource

func (ms *MCPServer) AddSource(name string, src core.Source, readOnly bool)

AddSource registers a database source with the given name. This makes the source available for query execution via the MCP protocol.

func (*MCPServer) ConfigureSecurity added in v0.2.0

func (ms *MCPServer) ConfigureSecurity(maxRowLimit int, enablePIIMasking bool, piiPatterns []security.MaskPattern, allowedKeywords, blockedKeywords []string) error

ConfigureSecurity initializes security components with config values.

func (*MCPServer) GetSchemaContext added in v0.2.0

func (ms *MCPServer) GetSchemaContext() string

GetSchemaContext returns the pre-built schema context for use in AI prompts.

func (*MCPServer) LoadSchemas added in v0.2.0

func (ms *MCPServer) LoadSchemas(ctx context.Context) error

LoadSchemas loads database schemas from all sources and builds the context prompt. This should be called after all sources are added and connected.

func (*MCPServer) StartStdio

func (ms *MCPServer) StartStdio() error

StartStdio starts the MCP server using stdio transport. This is the standard transport for Claude Desktop integration.

Jump to

Keyboard shortcuts

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