Documentation
¶
Overview ¶
Package server wires a parsed OpenAPI document into a running MCP server: every tool definition gets a handler that proxies the call to the upstream API and formats the response back into an MCP result.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveBase ¶
ResolveBase determines the upstream API root to send requests to. An explicit override always wins. Otherwise the first server URL in the spec is used: absolute URLs as-is, relative URLs resolved against the URL the spec was fetched from. A templated server URL or an unresolvable relative URL is an error that asks the operator for --base.
func RunHTTP ¶
RunHTTP serves the MCP server over the streamable-HTTP transport. The protocol endpoint is mounted at /mcp; any other path returns infoText as plain text, so a human who opens the root URL in a browser gets an explanation instead of a protocol error. The same server instance is shared across sessions. It blocks until ctx is cancelled or the listener fails.
Types ¶
type Config ¶
type Config struct {
Doc *openapi.Document
Defs []tool.Def
BaseURL string // resolved upstream API root
Headers map[string]string // injected on every upstream request (e.g. auth)
Timeout time.Duration // per-request upstream timeout
Version string // mcpify version, reported to clients
}
Config describes one mcpify server instance.