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.
Click to show internal directories.
Click to hide internal directories.