Documentation
¶
Overview ¶
Package server exposes the MCP tools as an MCP server, which runs over stdio or, through NewMux, over streamable HTTP. With auth configured, NewMux puts the token check in front of /mcp, limits each caller to the tools and targets that the authorization section gives it, and serves the protected resource metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMux ¶
NewMux returns an HTTP handler that serves s, a NewServer server for cfg, over the MCP streamable HTTP transport at /mcp. With auth configured, /mcp requires a valid access token, logger gets the reason for each rejected token or verification failure, and the protected resource metadata is served at the path the token challenge points to.
func NewServer ¶
func NewServer(ctx, subscriptions context.Context, name, version string, cfg *config.Config, clients *temporal.Clients, payloads *payload.Renderer, records io.Writer, logger *slog.Logger) (*mcp.Server, error)
NewServer returns the MCP server for the given configuration, making Temporal calls through clients and rendering the payloads in tool responses with payloads. Without auth, every caller may use every tool on every target; with it, each caller may use only what cfg's authorization gives it. records gets an audit record of each tool call, as a line of JSON; a call whose record cannot be written fails. logger gets the cause of each internal error. Cancelling subscriptions ends subscription listeners without cancelling tool calls. Once ctx is done, the server cancels each request in progress and each request it gets, whatever its MCP protocol version, so tool calls end with outcome cancelled. It fails if cfg has an auth section but no authorization, if an authorization profile names a tool the server does not have, or if a profile's ToolsDeny leaves it no tools. It sets the Tools of each authorization profile without them to the server's read-only tools other than those in the profile's ToolsDeny.
Types ¶
This section is empty.