mcp

package
v0.0.0-...-a330768 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0 modules, 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

Overview

Package mcp wires the curated weknora tool set to an modelcontextprotocol/go-sdk server. RunStdio is the entry point invoked by `weknora mcp serve`.

Design notes:

  • Tool surface is hand-curated rather than auto-derived from the cobra tree (which would expose auth/link/completion/destructive verbs that don't belong on an agent-callable surface).
  • Long-running tools (chat / session_ask) accumulate the LLM SSE stream server-side and return a single CallToolResult - MCP spec 2025-06-18 does not define streamed tool-result content, so the accumulate-and-return pattern is the canonical path.
  • Handlers receive ctx for cancellation; mid-LLM-stream cancellation propagates to the SDK via context, which closes the SSE connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunStdio

func RunStdio(ctx context.Context, svc ServiceClient) error

RunStdio constructs the MCP server, registers the curated 10 tools, and blocks reading JSON-RPC from stdin until the client disconnects or ctx is cancelled. Returns the underlying transport error (if any); the cobra RunE caller maps it through the usual cmdutil exit-code path.

Types

type ServiceClient

type ServiceClient interface {
	// contains filtered or unexported methods
}

ServiceClient bundles the SDK methods the tool registry needs. *sdk.Client satisfies it; tests substitute a fake to exercise the tool handlers in-process without standing up a real WeKnora server.

Embedding the full SDK Client would couple every tool test to every SDK method; declaring the narrow surface here keeps the seam tight.

Jump to

Keyboard shortcuts

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