mcp

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package mcp implements a thin stdio MCP server over the local gadak mirror.

It is the access path for clients without a shell (Claude Desktop and similar). Agents that can run commands should prefer `gadak sql` / `gadak issue` / `gadak search` instead — see docs/MCP.md and contracts/agent.md.

Protocol surface is deliberately small and implemented with the Go stdlib only: initialize, tools/list, tools/call, notifications/initialized, ping.

Index

Constants

View Source
const ProtocolVersion = "2025-03-26"

ProtocolVersion is the MCP protocol version this server speaks. When a client requests a different version we still answer with this one and do not reject the session (MCP version negotiation).

Variables

This section is empty.

Functions

func Logf

func Logf(format string, args ...any)

Logf writes a diagnostic line to stderr. Never use the process logger against stdout while serving MCP — that corrupts the JSON-RPC stream.

Types

type Server

type Server struct {
	DBPath  string
	Profile string
	// Version is the gadak binary version reported in serverInfo.
	Version string
	// contains filtered or unexported fields
}

Server is a stdio MCP session bound to one mirror database.

func New

func New(dbPath, profile, version string) *Server

New constructs a server. The database is opened on first tool call so initialize / tools/list work even when the mirror is missing (the tool then returns a clear isError message).

func (*Server) Serve

func (s *Server) Serve(in io.Reader, out io.Writer) error

Serve reads newline-delimited JSON-RPC messages from in and writes responses to out. Logs must never go to out — callers should leave log output on stderr. Returns when in is exhausted or a fatal I/O error occurs.

type Tool

type Tool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"inputSchema"`
}

Tool is one entry in tools/list.

Jump to

Keyboard shortcuts

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