climcp

package module
v0.0.0-...-1addb75 Latest Latest
Warning

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

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

Documentation

Overview

Package climcp provides functions to convert urfave/cli commands into MCP (Model Context Protocol) tools using the official MCP Go SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandTool

func AddCommandTool(server *mcp.Server, cmd *cli.Command)

AddCommandTool is a convenience function that converts a cli.Command into an MCP tool and registers it on the given server with the command's own Action as the handler.

func CommandToTool

func CommandToTool(cmd *cli.Command) *mcp.Tool

CommandToTool converts a cli.Command into an mcp.Tool with an automatically derived JSON Schema for its input based on the command's flags.

The returned tool uses the command's Name as the tool name and its Usage (or Description) as the tool description.

func CommandToToolHandler

func CommandToToolHandler(cmd *cli.Command) mcp.ToolHandler

CommandToToolHandler converts a cli.Command into an mcp.ToolHandler that, when invoked, constructs a synthetic CLI invocation from the MCP call arguments and runs the command's Action.

func CommandToToolHandlerWithResult

func CommandToToolHandlerWithResult(cmd *cli.Command, action ActionHandlerFunc) mcp.ToolHandler

CommandToToolHandlerWithResult is like CommandToToolHandler but uses an ActionHandlerFunc that returns text output to be sent back via the MCP result.

Types

type ActionHandlerFunc

type ActionHandlerFunc func(ctx context.Context, cmd *cli.Command) (string, error)

ActionHandlerFunc is the signature for a custom action that receives typed arguments extracted from the MCP request and returns a result string.

Jump to

Keyboard shortcuts

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