client

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: Apache-2.0 Imports: 4 Imported by: 12

Documentation

Overview

Package client declares the interfaces that make up the *client side* of the Model Context Protocol (MCP).

The core element is Operations, a collection of strongly-typed methods that mirror the JSON-RPC requests defined by the MCP specification (e.g. roots listing, sampling, user interaction, etc.). Implementations embed or implement Operations to gain compile-time safety when calling an MCP server.

In addition, the Handler interface extends Operations with the ability to receive asynchronous JSON-RPC notifications via the OnNotification hook.

The package contains *interfaces only* and purposefully holds no concrete implementation so that different transports (HTTP, stdio, WebSockets, …) can provide their own clients while sharing the same contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler added in v0.4.0

type Handler interface {
	Operations
	OnNotification(ctx context.Context, notification *jsonrpc.Notification)
}

Handler extends Operations with support for JSON-RPC notifications.

Jump to

Keyboard shortcuts

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