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 ¶
- func Dispatch(ctx context.Context, tk *agent.Toolkit, body []byte) []byte
- type Extension
- func (e *Extension) Dependencies() []string
- func (e *Extension) Description() string
- func (e *Extension) Name() string
- func (e *Extension) Register(app forge.App) error
- func (e *Extension) Start(_ context.Context) error
- func (e *Extension) Stop(_ context.Context) error
- func (e *Extension) Version() string
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dispatch ¶
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 ¶
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 (*Extension) Description ¶
func (*Extension) Register ¶
Register registers the MCP controller and watch SSE controller; the toolkit resolves lazily (built in Start).
type Option ¶
type Option func(*config)
Option configures the MCP extension.
func WithBasePath ¶
WithBasePath sets the MCP POST endpoint path (default "/api/v1/agent/mcp").
func WithConfig ¶
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 ¶
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).