mcp

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT 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 mcp exposes a project's requests to AI agents over the Model Context Protocol (stdio, or streamable HTTP behind a token), so an agent can discover and call an API without shelling out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBind

func CheckBind(addr, token string) error

CheckBind refuses an address outside the loopback interface unless a token guards the server.

func Handler

func Handler(cfg Config, token string) (http.Handler, error)

Handler serves the project over the MCP streamable HTTP transport, behind a bearer token when one is given.

func New

func New(cfg Config) (*sdk.Server, error)

New builds an MCP server for the project in cfg.Dir.

func Serve

func Serve(ctx context.Context, cfg Config) error

Serve runs the server over stdio until the client disconnects.

func ServeHTTP

func ServeHTTP(ctx context.Context, cfg Config, addr, token string, ready func(string)) error

ServeHTTP listens on addr and serves until ctx ends. ready, when set, is called with the bound address once the listener is up.

Types

type Config

type Config struct {
	Dir     string // project root
	Env     string // default environment
	Version string
}

Config controls the server.

Jump to

Keyboard shortcuts

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