mcpserver

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 19 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 mcpserver exposes the ka service as an MCP server (PRD §11): a few coarse tools whose input schemas carry the workspace's real vocabulary, compact text results, and actionable errors.

Index

Constants

This section is empty.

Variables

View Source
var NextRenderOptions = render.DetailOptions{MaxTokens: nextTokens, MinBody: 150, Untrusted: true}

NextRenderOptions is how ka_next renders its ticket.

View Source
var Version = "dev"

Version is reported to clients.

Functions

This section is empty.

Types

type Options

type Options struct {
	Actor   string // override the agent actor (default agent/<clientInfo.name>)
	MaxWait time.Duration
	// Presence, when set, records each session's calls (daemon mode).
	Presence *presence.Tracker
}

Options configures the server.

func Env

func Env() Options

Env reads the actor override used by `ka mcp`.

type Proxy

type Proxy struct {
	Endpoint string      // http://127.0.0.1:7711/mcp
	Token    string      // the daemon's local token
	Header   http.Header // extra headers (X-Ka-Actor, X-Ka-Session)
	Client   *http.Client
	// contains filtered or unexported fields
}

Proxy bridges a stdio MCP client to a daemon's Streamable HTTP endpoint (PRD §8.3), so `ka mcp` shares the daemon's index, presence and events. Messages pass through unchanged: the client's initialize reaches the daemon, which derives the agent's actor from clientInfo exactly as the in-process server does.

func (*Proxy) Run

func (p *Proxy) Run(ctx context.Context, in io.Reader, out io.Writer) error

Run copies messages until in reaches EOF or ctx is done, then ends the HTTP session.

type Server

type Server struct {
	MCP *mcp.Server
	// contains filtered or unexported fields
}

Server wraps an MCP server around a service.

func New

func New(svc *engine.Service, opt Options) *Server

New builds the server and registers tools, resources and prompts.

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() http.Handler

HTTPHandler serves MCP over Streamable HTTP (mounted at /mcp by the daemon).

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run serves over stdio until the client disconnects.

func (*Server) RunIO

func (s *Server) RunIO(ctx context.Context, in io.Reader, out io.Writer) error

RunIO serves over the given streams (os.Stdin and os.Stdout use Run).

Jump to

Keyboard shortcuts

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