mcpclient

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package mcpclient connects to outbound MCP servers for RocketCode code mode.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry holds configured MCP server specs for a workspace.

func New

func New(workspace string, servers map[string]ServerConfig) (*Registry, error)

New builds a registry. servers is copied; later mutation is ignored.

func (*Registry) Has

func (r *Registry) Has(name string) bool

Has reports whether name is a configured server.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns configured server names in sorted order.

func (*Registry) Open

func (r *Registry) Open() *Session

Open starts a session that connects servers lazily and closes them on Close.

type ServerConfig

type ServerConfig struct {
	Command string
	Args    []string
	Env     map[string]string
	Cwd     string
	URL     string
	Headers map[string]string
}

ServerConfig describes one outbound MCP server transport.

type Session

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

Session is one execute tool-call lifetime.

func (*Session) CallTool

func (s *Session) CallTool(ctx context.Context, server, tool string, args map[string]any) (string, error)

CallTool invokes tool on server and flattens the result to a string.

func (*Session) Close

func (s *Session) Close() error

Close ends all connections opened by this session. It is idempotent.

func (*Session) ListTools

func (s *Session) ListTools(ctx context.Context, server string) ([]ToolInfo, error)

ListTools returns the full tool catalog for server.

type ToolInfo

type ToolInfo struct {
	Server      string
	Name        string
	Description string
	InputSchema map[string]any
}

ToolInfo is one tool from a server's catalog.

Jump to

Keyboard shortcuts

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