mcp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 18 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 serves Workly's tools to coding agents over the Model Context Protocol, at /mcp.

It implements the part of the protocol a tools-only server needs: the Streamable HTTP transport in its stateless form (one JSON-RPC request per POST, answered with JSON; no sessions and no server-sent events), initialize, ping, tools/list and tools/call. That is small enough to write by hand, which keeps the SDK's dependencies out of the binary.

Tools call the /v1 API in-process, so they share its validation, errors and workspace scoping; the workspace is resolved from the /mcp request's credentials like any /v1 request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(opts Options) http.Handler

NewHandler serves the MCP endpoint.

Types

type Mode

type Mode string

Mode sets which tools are served.

const (
	// ReadOnly serves the tools that only read (the default).
	ReadOnly Mode = "read-only"
	// Full serves every tool, including ones that enqueue, retry, cancel,
	// pause and reconfigure.
	Full Mode = "full"
	// Off doesn't serve /mcp.
	Off Mode = "off"
)

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode parses a WORKLY_MCP value.

type Options

type Options struct {
	// API serves /v1 for requests already scoped to a workspace.
	API  http.Handler
	Mode Mode
	// ModeFor, if set, can make a request read-only when Mode is Full, e.g.
	// for credentials granted only read access; anything but Full is read-only.
	// It can't widen Mode.
	ModeFor func(*http.Request) Mode
	Version string
	Logger  *slog.Logger
}

Jump to

Keyboard shortcuts

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