mcp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mcp provides MCP (Model Context Protocol) client implementation. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Server info after initialization
	ServerName    string
	ServerVersion string
	Tools         []Tool
	// contains filtered or unexported fields
}

Client is an MCP client using stdio transport

func NewClient

func NewClient(command string, args []string, env map[string]string, cwd string) (*Client, error)

NewClient creates a new MCP client

func (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, name string, args map[string]interface{}) (string, error)

CallTool calls an MCP tool

func (*Client) Close

func (c *Client) Close() error

Close shuts down the MCP client

func (*Client) Initialize

func (c *Client) Initialize(ctx context.Context) error

Initialize performs the MCP initialization handshake

type Tool

type Tool struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	InputSchema json.RawMessage `json:"inputSchema,omitempty"`
}

Tool represents an MCP tool

Jump to

Keyboard shortcuts

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