mcp

package
v0.1.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 15 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 implements a Model Context Protocol server (stdio transport, newline-delimited JSON-RPC 2.0) that exposes the Sweef engine as agent tools. This is what an AI client (Claude Desktop, Claude Code, Cursor, custom LLM loops) talks to: `sweef mcp` runs the engine in-process, so there is no browser process and no IPC hop between the protocol and the page.

Tool outputs are shaped for LLM context windows (see format.go): plain text instead of JSON where the JSON adds nothing, compact log lines, truncation with a continuation offset, and after an action the snapshot lines that changed since the agent's last snapshot of the page.

Index

Constants

View Source
const (
	PROTOCOL_VERSION = "2025-06-18"
	SERVER_NAME      = "sweef-browser"
	SERVER_VERSION   = "0.2.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {

	// AutoDelta appends, after an action, the snapshot lines that changed since the
	// agent's last snapshot of that tab (SWEEF_MCP_AUTO_DELTA=0 turns it off).
	AutoDelta bool
	// contains filtered or unexported fields
}

Server runs the MCP loop.

func New

func New(e *engine.Engine, w io.Writer) *Server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, r io.Reader) error

Serve reads newline-delimited JSON-RPC until EOF or ctx ends.

Jump to

Keyboard shortcuts

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