http

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package http provides an HTTP implementation of the MCP transport.

This package implements the Transport interface using HTTP, suitable for applications requiring JSON-RPC communication.

Index

Constants

View Source
const DefaultShutdownTimeout = 10 * time.Second

DefaultShutdownTimeout is the default timeout for graceful shutdown

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncMessageHandler

type AsyncMessageHandler func(message []byte)

AsyncMessageHandler is a function that handles asynchronous JSON-RPC notifications

type Transport

type Transport struct {
	transport.BaseTransport
	// contains filtered or unexported fields
}

Transport implements the transport.Transport interface for HTTP

func NewTransport

func NewTransport(addr string) *Transport

NewTransport creates a new HTTP transport

func (*Transport) Initialize

func (t *Transport) Initialize() error

Initialize initializes the transport

func (*Transport) Receive

func (t *Transport) Receive() ([]byte, error)

Receive is not directly applicable for HTTP transport (HTTP is request/response based)

func (*Transport) RegisterAsyncHandler

func (t *Transport) RegisterAsyncHandler(method string, handler AsyncMessageHandler)

RegisterAsyncHandler registers a handler for asynchronous message processing

func (*Transport) Send

func (t *Transport) Send(message []byte) error

Send sends a JSON-RPC request to a specified endpoint

func (*Transport) Start

func (t *Transport) Start() error

Start starts the transport

func (*Transport) Stop

func (t *Transport) Stop() error

Stop stops the transport

Jump to

Keyboard shortcuts

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