mcpserver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package mcpserver exposes selected LedgerForge operations through the Model Context Protocol. It is intentionally transport-agnostic; cmd/ledgerforge-mcp runs it over standard input and output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Version     string
	AllowWrites bool
	APIKey      string
}

Options configures the MCP server.

type Server

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

Server owns the MCP protocol server and the LedgerForge service it exposes.

func New

func New(service Service, options Options) *Server

New creates a LedgerForge MCP server. Write tools are omitted unless AllowWrites is explicitly enabled.

func (*Server) Protocol

func (s *Server) Protocol() *mcp.Server

Protocol returns the configured MCP protocol server.

type Service

type Service interface {
	GetLedgerByID(id string) (*model.Ledger, error)
	GetAllLedgers(limit, offset int) ([]model.Ledger, error)
	GetBalanceByID(ctx context.Context, id string, include []string, withQueued bool) (*model.Balance, error)
	GetAllBalances(ctx context.Context, limit, offset int) ([]model.Balance, error)
	GetBalanceAtTime(ctx context.Context, balanceID string, targetTime time.Time, fromSource bool) (*model.Balance, error)
	GetBalanceByIndicator(ctx context.Context, indicator, currency string) (*model.Balance, error)
	GetTransaction(ctx context.Context, id string) (*model.Transaction, error)
	GetTransactionByRef(ctx context.Context, reference string) (model.Transaction, error)
	GetAllTransactions(limit, offset int) ([]model.Transaction, error)
	GetBalanceLineage(ctx context.Context, balanceID string) (*ledgerforge.BalanceLineage, error)
	GetTransactionLineage(ctx context.Context, transactionID string) (*ledgerforge.TransactionLineage, error)
	CreateLedger(ledger model.Ledger) (model.Ledger, error)
	CreateBalance(ctx context.Context, balance model.Balance) (model.Balance, error)
	QueueTransaction(ctx context.Context, transaction *model.Transaction) (*model.Transaction, error)
	CommitInflightTransaction(ctx context.Context, transactionID string, amount *big.Int) (*model.Transaction, error)
	VoidInflightTransaction(ctx context.Context, transactionID string) (*model.Transaction, error)
	RefundTransaction(ctx context.Context, transactionID string, skipQueue bool) (*model.Transaction, error)
	CreateBulkTransactions(ctx context.Context, request *model.BulkTransactionRequest) (*model.BulkTransactionResult, error)
}

Service is the LedgerForge capability surface available to MCP tools. Keeping this narrow makes the transport independently testable and prevents tools from reaching persistence internals directly.

Jump to

Keyboard shortcuts

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