mcpserver

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mcpserver exposes waggle's stored traces, metrics, and logs to an MCP client (e.g. Claude). It is a thin adapter: every tool maps onto an existing store.Store read method or the internal/query builder, so there is no query logic here that the HTTP API doesn't already have.

Two transports share one set of tool handlers:

  • HTTPHandler returns a Streamable-HTTP handler to mount on the running server's UI mux (the data is already live in-process).
  • RunStdio serves the same tools over stdio for the `waggle mcp` subcommand, pointed at a database file directly.

All tools are read-only — the write paths on store.Store (WriteBatch, Clear, Retain) are never bound.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server wraps the SDK server so callers never touch the SDK directly.

func New

func New(st store.Store, log *slog.Logger) *Server

New builds an MCP server with every waggle tool registered against st.

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() http.Handler

HTTPHandler returns a Streamable-HTTP handler serving this server. Mount it at a fixed path (waggle uses /mcp). Every request is served by the same server instance, which is safe: the store's reader pool handles concurrency.

func (*Server) RunStdio

func (s *Server) RunStdio(ctx context.Context) error

RunStdio serves the tools over stdin/stdout until the context is cancelled or stdin closes. Protocol traffic uses stdout, so all logging must go to stderr (the caller's slog handler does).

Jump to

Keyboard shortcuts

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