mcp

package
v0.1.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hit

type Hit struct {
	Value     string    `json:"value"`
	Timestamp time.Time `json:"timestamp"`
	Score     float64   `json:"score"`
}

Hit is one recalled fact as the query endpoint serializes it (Hit.MarshalJSON in internal/query): the stored value, its write time, and its raw score. Scores are float64 regardless of the daemon's precision — that is what JSON numbers decode to, and the bridge never does arithmetic on them.

type MCPServer

type MCPServer struct {
	Config *config.ConfigSet
	Server *mcp.Server
	// contains filtered or unexported fields
}

MCPServer is the stdio MCP bridge to a running fraise daemon. It is a thin adapter over the HTTP query API — not a second engine — so it reads the same config the daemon does and derives the daemon's address from it: `fraise mcp -config x` finds whatever `fraise -config x` serves.

func New

func New(c *config.ConfigSet) *MCPServer

New builds the bridge and registers its two tools. Registration goes through the SDK's typed AddTool: it unmarshals and validates arguments against the input schema before a handler runs, marshals the typed output into structured content and validates it against the output schema, and turns a handler error into an in-band tool error the model can read.

func (*MCPServer) Start

func (s *MCPServer) Start(ctx context.Context) error

Start serves MCP over stdio until ctx is cancelled. Stdout belongs to the protocol from here on — nothing on this path may print to it.

type RecallInput

type RecallInput struct {
	Query      string               `json:"query"`
	Parameters map[string][]float64 `json:"parameters,omitempty"`
}

RecallInput is the recall tool's argument payload, forwarded verbatim as the /api/v1/q request body (HandleQueryRequest): the raw FQL query plus any out-of-band vector bindings its vec:$name placeholders reference.

type RecallOutput

type RecallOutput struct {
	Results  Result   `json:"results"`
	Warnings []string `json:"warnings,omitempty"`
}

RecallOutput is the recall tool's result payload, the /api/v1/q response body verbatim: the results envelope plus any parse warnings the server attached — the query still ran and the results beside them stand.

type RememberInput

type RememberInput struct {
	Query      string               `json:"query"`
	Parameters map[string][]float64 `json:"parameters,omitempty"`
}

RememberInput is the remember tool's argument payload, forwarded verbatim as the /api/v1/q request body, exactly as RecallInput is.

type RememberOutput

type RememberOutput struct {
	Results  Result   `json:"results"`
	Warnings []string `json:"warnings,omitempty"`
}

RememberOutput is the remember tool's result payload: the same response envelope as a recall, with the result always empty — the acknowledgement is the response itself, and warnings ride beside it when the parse had something to say.

type Result

type Result struct {
	Count int   `json:"count"`
	Hits  []Hit `json:"hits"`
}

Result is the results envelope of a query response: the hit count and the ranked hits, best first. A write's result is always empty (count 0).

Jump to

Keyboard shortcuts

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