gatewayhttp

package
v1.63.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gatewayhttp exposes the apigateway toolkit's invoke operation over plain REST so non-MCP HTTP clients (e.g. Apache NiFi's InvokeHTTP processor) can drive the same gateway connections that MCP callers use through api_invoke_endpoint.

The handler is a thin shim: every request is routed through an in-memory MCP session against the platform's assembled server, so the existing authenticator, persona authorization, route policy, and audit middleware all apply to REST callers identically to MCP callers. No auth, audit, or policy logic is reimplemented here.

Index

Constants

View Source
const RequestBodyLimit = 1 << 20 // 1 MiB

RequestBodyLimit caps the inbound JSON body the REST handler will read. The api_invoke_endpoint contract already trims response bodies to a per-connection maximum; this limit bounds the request-side memory footprint when non-MCP callers POST through the gateway.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(deps Deps) (http.Handler, error)

NewHandler returns an http.Handler that exposes api_invoke_endpoint as a connection-scoped REST resource:

POST /api/v1/gateway/{connection}/invoke

Non-MCP callers POST a JSON body shaped like apigateway.InvokeInput (minus the connection field, which is taken from the URL) and receive an apigateway.InvokeOutput JSON body back. The upstream's HTTP status code is returned inside the body (InvokeOutput.Status); the HTTP status of the platform's own response only signals platform-level outcomes:

200 — the platform performed the upstream call (outcome in body)
400 — the request failed validation (method, path, body)
401 — no credential, or the credential was rejected
403 — persona or route policy denied the call
404 — the named connection is not registered

Surfacing the upstream status in the body keeps platform-side and upstream-side failures distinguishable for NiFi's response routing.

Types

type Deps

type Deps struct {
	// MCPServer is the assembled MCP server (with middleware chain
	// already attached). Required.
	MCPServer *mcp.Server
}

Deps wires the REST gateway handler to the platform's assembled MCP server. The handler does not fork the auth or audit pipelines: every REST request goes through an in-memory MCP session so the existing authenticator, persona authorization, route policy, and audit middleware all apply.

Jump to

Keyboard shortcuts

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