Documentation
¶
Overview ¶
Package server runs an MCP server over stdio for a client that starts it, or over HTTP for an always-on one, behind a bearer token and with a health probe.
Index ¶
Constants ¶
const ( // Path is where the MCP endpoint is served over HTTP. Path = "/mcp" // HealthPath answers "ok" to a GET with no token, or a container with a token would never be healthy. HealthPath = httpd.HealthPath )
const DefaultInstructions = `` /* 646-byte string literal not displayed */
DefaultInstructions is what every server tells a client that connects, before its own words: what the registry makes true of every tool, said once so no tool's description has to.
Variables ¶
This section is empty.
Functions ¶
func CheckAuth ¶
CheckAuth refuses to listen with no bearer token unless the operator said so: a blank token in a copied .env once served every tool to the whole network with one line of warning.
func Handler ¶
Handler is the routes: the MCP endpoint at Path behind the bearer check, the health probe at HealthPath outside it. Apart from Run so they can be tested or mounted elsewhere without a port.
func Instructions ¶ added in v0.6.1
Instructions is DefaultInstructions and then the server's own, a paragraph each, for mcp.ServerOptions. A server wanting other words altogether sets the options itself.
Types ¶
type Options ¶
type Options struct {
// Listen is the address to serve Streamable HTTP on, ":8080" say. Empty serves stdio.
Listen string
// AuthToken is the bearer token an HTTP client must send. Empty is none, which Run refuses without AllowNoAuth.
AuthToken string
// AllowNoAuth is the operator saying that anyone who can reach the port may use every tool.
AllowNoAuth bool
// Name is the tool's name, "abs-mcp": the realm a refused client is told.
Name string
// EnvPrefix starts the tool's environment variables, "ABS" for ABS_AUTH_TOKEN, so messages name the right one.
EnvPrefix string
}
Options says how to serve.