mcpserver

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var McpCmd = &cli.Command{
	Name:  "mcp",
	Usage: "Serve the knot MCP server over stdio, proxying a remote knot server",
	Description: `Runs knot as a local MCP server on stdio, forwarding tool calls to a remote knot server's /mcp endpoint over HTTP.

Intended for MCP hosts that launch the server as a subprocess and only speak stdio, e.g. Claude Desktop:

    {"mcpServers": {"knot": {"command": "knot", "args": ["mcp", "--alias", "default"]}}}

This sidesteps the host's HTTPS-only rule for remote servers: the subprocess talks plain HTTP to the knot server, and authentication comes from the connection config rather than the host's — the API token never appears in the host's configuration.

The connection is resolved like other client commands: an explicit --server/--token pair, else inside a space the agent socket, else the --alias section written by 'knot connect'.

Stdout is the MCP protocol; all diagnostics go to stderr.`,
	MaxArgs: cli.NoArgs,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "server",
			Aliases: []string{"s"},
			Usage:   "The address of the remote knot server.",
			EnvVars: []string{config.CONFIG_ENV_PREFIX + "_SERVER"},
		},
		&cli.StringFlag{
			Name:    "token",
			Aliases: []string{"t"},
			Usage:   "API token for the remote knot server.",
			EnvVars: []string{config.CONFIG_ENV_PREFIX + "_TOKEN"},
		},
		&cli.StringFlag{
			Name:         "alias",
			Aliases:      []string{"a"},
			Usage:        "The configured server alias to talk to.",
			DefaultValue: "default",
		},
		&cli.BoolFlag{
			Name:         "tls-skip-verify",
			Usage:        "Skip TLS verification when talking to the server.",
			ConfigPath:   []string{"tls.skip_verify"},
			EnvVars:      []string{config.CONFIG_ENV_PREFIX + "_TLS_SKIP_VERIFY"},
			DefaultValue: true,
		},
		&cli.BoolFlag{
			Name:  "show-all",
			Usage: "Also expose discoverable tools, not just native ones.",
		},
	},
	Run: func(ctx context.Context, cmd *cli.Command) error {

		if err := serveMCP(ctx, cmd); err != nil {
			fmt.Fprintln(os.Stderr, "Error:", err)
			os.Exit(1)
		}
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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