mcp

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package mcp exposes memini over the Model Context Protocol. It is a thin adapter over the same service.Service the REST API uses, served over stdio and Streamable HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPHandler

func HTTPHandler(svc *service.Service, nsHeader, defaultNS, homeHeader, apiKey string) http.Handler

HTTPHandler returns an http.Handler serving MCP over Streamable HTTP. The tenant namespace is taken from nsHeader when present, else defaultNS; tool calls may still override it per-call. The caller's personal namespace is taken from homeHeader when present — canonicalized exactly like REST's homeMiddleware so both transports resolve the same client input to the same namespace key — else "" (no home leg — unlike the namespace header there is no default and no per-call override). An invalid nsHeader or homeHeader value is rejected with 400 (matching the REST API) rather than silently falling back to the default tenant. When apiKey is non-empty, requests must present it as a bearer token — required for any remote (non-localhost) deployment.

func NewServer

func NewServer(svc *service.Service, defaultNS, home string) *mcpsdk.Server

NewServer builds an MCP server exposing memini's memory tools. defaultNS is used whenever a tool call omits the namespace argument. home is the caller's personal namespace (X-Memini-Home / MEMINI_HOME), merged read-only into every recall/briefing/answer/remember; "" means no home leg. There is no per-call override — home is a transport-level default, fixed for the life of this server instance.

func RunStdio

func RunStdio(ctx context.Context, svc *service.Service, defaultNS, home string) error

RunStdio serves the MCP server over stdio, blocking until ctx is cancelled or the client disconnects. Used by `memini mcp` for local agent integrations. home is resolved by the caller from MEMINI_HOME (there are no headers on stdio); "" means no home leg.

Types

This section is empty.

Jump to

Keyboard shortcuts

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