NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::acp::ACPHttpConfig Struct Reference

Limits, Host and Origin rules and authentication of an ACPHttpServer. More...

#include <http_server.h>

Public Types

using Authenticator = std::function< std::optional< std::string >(std::string_view authorization_header)>
 Resolve the HTTP Authorization header (empty when the request has none) into the principal that made the request, or nullopt (or an empty string) to refuse it. The server never keeps the header.
 

Public Attributes

bool allow_client_mcp_servers = false
 Accept stdio MCP servers named by the client in session/new and session/resume (mcpServers). ACPServer starts each as a process of this host, with the command line and environment entries the client sends, in the cwd the client names. For an editor that launched the agent on its own machine that is how it extends the agent; for a remote client it is command execution on the server. So a request that lists any is refused with JSON-RPC -32602 (data.reason "mcp_servers_not_accepted") unless this is true; an empty list is always accepted.
 
std::vector< std::string > allowed_hosts
 Host header names the server answers: host names, IPv4 addresses and bracketed IPv6 addresses ([::1]), compared with the Host header's host without its port and ignoring case. * admits any Host. A loopback bind always admits localhost, 127.0.0.1 and [::1] and refuses every other Host unless it is listed, with or without an Origin. On a remote bind an empty list checks nothing, and a non-empty one admits only the listed names.
 
std::vector< std::string > allowed_origins
 Exact allowed Origin values. An Origin header is rejected unless listed, except that a loopback bind also admits its own loopback origin: http://localhost:<port>, http://127.0.0.1:<port> or http://[::1]:<port> at the port it is bound to (and writes a line to stderr the first time it admits each one). A request without an Origin header is not checked.
 
Authenticator authenticator
 Authenticates every request, stream and upgrade when set (HTTP 401 and WWW-Authenticate: Bearer otherwise). The principal it returns is passed to the factory, and the connection answers only to that principal afterwards. A browser cannot set Authorization on a WebSocket; authenticate those in a reverse proxy.
 
std::chrono::milliseconds connection_idle_timeout = std::chrono::seconds(60)
 A connection with no open stream, no WebSocket and no request for this long is closed and its prompts are cancelled; its id then answers 404. This is how a dropped connection ends over HTTP. Zero keeps such connections until DELETE.
 
std::string host = "127.0.0.1"
 Address to bind. The default is loopback; any other host is a remote bind and needs authenticator.
 
std::size_t http_threads = 8
 HTTP worker threads started with the server. A stream and a WebSocket connection hold one for as long as they are open, so more start on demand up to max_http_threads (they then stay), and at most half of max_http_threads are given to streams and WebSocket connections; a further stream is answered 503. The rest answer POST and DELETE.
 
std::chrono::milliseconds keepalive_interval = std::chrono::seconds(15)
 A quiet stream sends an SSE comment, and a WebSocket a ping, this often, so that a proxy does not cut it and a vanished peer is found.
 
std::size_t max_connections = 16
 Open connections at most; a new one beyond it is refused (HTTP 503).
 
std::size_t max_payload_bytes = 4 * 1024 * 1024
 The largest request body (HTTP) or message (WebSocket) accepted. A body announced larger by its Content-Length is answered with 413 without being read, and a chunked one is cut off once it passes the limit. The WebSocket library reads one frame of up to 16 MiB before this limit can be applied, so a larger value is refused when websocket is on.
 
int port = 0
 0 picks a free port; see ACPHttpServer::port(). The one path the transport serves, for POST, GET (stream or upgrade) and DELETE.
 
bool streamable_http = true
 Serve Streamable HTTP (POST, GET stream, DELETE) on endpoint.
 
bool websocket = true
 Serve the WebSocket upgrade on endpoint.
 

Detailed Description

Limits, Host and Origin rules and authentication of an ACPHttpServer.

The names and meanings follow MCPHttpServerConfig and A2AHttpConfig.

Definition at line 146 of file http_server.h.


The documentation for this struct was generated from the following file: