agentmcp

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package agentmcp exposes the fabriq agent toolkit over MCP (JSON-RPC 2.0).

Package agentmcp exposes the fabriq agent toolkit as a Forge extension over MCP (JSON-RPC 2.0). The Dispatch function (dispatch.go) is Forge-free; only the Extension and controller in this file touch Forge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(ctx context.Context, tk *agent.Toolkit, body []byte) []byte

Dispatch handles one MCP JSON-RPC request against the toolkit and returns the response bytes. Transport errors (parse/method/params) become JSON-RPC error objects; tool execution errors become MCP results with isError=true. Note: JSON-RPC notifications (requests without an "id") and the jsonrpc version field are not specially validated — this is the documented minimal single-request scope.

Types

type Extension

type Extension struct {
	forge.BaseExtension
	// contains filtered or unexported fields
}

Extension exposes the agent toolkit over MCP as a Forge extension. It depends on the "fabriq" extension and builds its toolkit in Start.

func NewMCP

func NewMCP(fab *forgeext.Extension, opts ...Option) *Extension

NewMCP builds the MCP extension wired to a started fabriq Extension. The endpoint is auth-agnostic: the host MUST attach authentication via WithRouteOptions (e.g. a bearer-token middleware), otherwise recall, writes, and graph_traverse are exposed to any caller the router admits.

func (*Extension) Dependencies

func (e *Extension) Dependencies() []string

func (*Extension) Description

func (e *Extension) Description() string

func (*Extension) Name

func (e *Extension) Name() string

func (*Extension) Register

func (e *Extension) Register(app forge.App) error

Register registers the MCP controller and watch SSE controller; the toolkit resolves lazily (built in Start).

func (*Extension) Start

func (e *Extension) Start(_ context.Context) error

Start builds the toolkit over the started fabriq facade.

func (*Extension) Stop

func (e *Extension) Stop(_ context.Context) error

Stop stops the extension.

func (*Extension) Version

func (e *Extension) Version() string

type Option

type Option func(*config)

Option configures the MCP extension.

func WithBasePath

func WithBasePath(p string) Option

WithBasePath sets the MCP POST endpoint path (default "/api/v1/agent/mcp").

func WithConfig

func WithConfig(cfg agent.Config) Option

WithConfig sets the full toolkit Config. Apply WithConfig BEFORE WithWritePolicy: a later WithConfig call replaces c.Toolkit entirely, clobbering any earlier WithWritePolicy; a later WithWritePolicy only sets c.Toolkit.Write.

func WithEmbedder

func WithEmbedder(e agent.Embedder) Option

WithEmbedder supplies the embedding model for semantic recall.

func WithRouteOptions

func WithRouteOptions(opts ...forge.RouteOption) Option

WithRouteOptions forwards forge route options (auth middleware, OpenAPI) to the MCP route — fabriq stays auth-agnostic.

func WithWritePolicy

func WithWritePolicy(p agent.WritePolicy) Option

WithWritePolicy sets the agent write allowlist (empty = no writes).

Jump to

Keyboard shortcuts

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