sessionmcptools

package
v0.4.38 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package sessionmcptools serves any agentkit.ToolProvider to an external ACP agent as a loopback streamable-http MCP server.

agent/acp-remote's sessionMcp slot takes a capacp.SessionMCPProvider, but the tools a host wants to expose usually already exist as a ToolProvider (tool/openapi, tool/mcp, a static tool list, ...). This plugin is the general bridge between the two, so a host does not need one bespoke MCP server per tool source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, deps Deps) (capacp.SessionMCPProvider, error)

New registers acp/session-mcp-tools: streamable-http MCP over any ToolProvider.

Types

type Config

type Config struct {
	// APIToken enables a loopback Bearer check. Empty disables it (local only).
	APIToken string `json:"apiToken,omitempty"`
	// ServerName is the MCP server name announced to the agent.
	ServerName string `json:"serverName,omitempty"`
	// Headers are static extra headers for the ACP session/new spec.
	Headers map[string]string `json:"headers,omitempty"`
	// Bind maps turn-context fields to session headers and restores them on
	// inbound tool calls, preserving the session, user, workspace and route.
	Bind map[string]HeaderBind `json:"bind,omitempty"`
}

Config configures the loopback MCP endpoint.

type Deps

type Deps struct {
	Provider  agentkit.ToolProvider `json:"provider"`
	Workspace workspace.Service     `json:"workspace,omitempty"`
}

Deps wires the tool source and the workspace used to resolve paths.

type HeaderBind

type HeaderBind struct {
	From string `json:"from"`
	In   string `json:"in"`
	Name string `json:"name"`
}

HeaderBind mirrors the header-bind shape hosts already use: From is a ctx: source, In is the transport slot, Name the wire name.

type Provider

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

Provider implements capacp.SessionMCPProvider over the supplied ToolProvider.

func (*Provider) Close

func (p *Provider) Close() error

Close stops the loopback server.

func (*Provider) Refresh

func (p *Provider) Refresh(ctx context.Context) error

Refresh re-reads the provider's tools into the MCP registry. Call it after a runtime change (an OpenAPI reload, an MCP client discovery); it is safe to call concurrently with in-flight calls.

func (*Provider) SessionMCPServers

func (p *Provider) SessionMCPServers(ctx context.Context) ([]capacp.SessionMCPServer, error)

SessionMCPServers implements capacp.SessionMCPProvider.

Jump to

Keyboard shortcuts

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