124#include <string_view>
127namespace neograph::acp {
151 std::function<std::optional<std::string>(std::string_view authorization_header)>;
155 std::string host =
"127.0.0.1";
159 std::string endpoint =
"/acp";
162 bool streamable_http =
true;
164 bool websocket =
true;
167 std::size_t max_connections = 16;
174 std::size_t max_payload_bytes = 4 * 1024 * 1024;
182 std::size_t http_threads = 8;
183 std::size_t max_http_threads = 64;
184 std::size_t max_queued_requests = 64;
190 std::chrono::milliseconds connection_idle_timeout = std::chrono::seconds(60);
193 std::chrono::milliseconds keepalive_interval = std::chrono::seconds(15);
221 bool allow_client_mcp_servers =
false;
273 bool is_running()
const;
294 std::unique_ptr<Impl> impl_;
ACP server — exposes a NeoGraph as an Agent Client Protocol agent.
NEOGRAPH_API export/import macro for shared-library builds.
ACP over Streamable HTTP and WebSocket; see the file comment for the mapping, the deviations from the...
int port() const
The bound port; useful when ACPHttpConfig::port is 0.
bool start()
Bind and serve until stop() is called. Returns false if the address cannot be bound.
void stop()
Stop accepting, close every connection (cancelling its prompts) and join the threads....
std::function< ACPHttpConnection(std::string_view principal)> ConnectionFactory
Called once per new connection, with the principal the authenticator returned (empty without one)....
bool start_async()
Bind and serve on a background listener thread.
ACPHttpServer(ConnectionFactory factory, ACPHttpConfig config={})
std::shared_ptr< ACPClient > client()
A handle for agent-to-client requests (fs/*, permission) that reaches the connection owning the sessi...
void attach_client(std::shared_ptr< ACPClient > client)
Bind a client that graph nodes captured before this server existed, as ACPServer::attach_client does ...
std::size_t connection_count() const
The number of open connections.
Limits, Host and Origin rules and authentication of an ACPHttpServer.
std::vector< std::string > allowed_hosts
Host header names the server answers: host names, IPv4 addresses and bracketed IPv6 addresses ([::1])...
std::function< std::optional< std::string >(std::string_view authorization_header)> Authenticator
Resolve the HTTP Authorization header (empty when the request has none) into the principal that made ...
std::vector< std::string > allowed_origins
Exact allowed Origin values. An Origin header is rejected unless listed, except that a loopback bind ...
Authenticator authenticator
Authenticates every request, stream and upgrade when set (HTTP 401 and WWW-Authenticate: Bearer other...
What the factory of an ACPHttpServer returns for one new connection.
std::unique_ptr< ACPServer > server
A fresh, uninitialized ACPServer. The transport drives it with ACPServer::run(); set its capabilities...
std::shared_ptr< void > owner
Optional lifetime owner for objects captured by server; declared first so that it is released after t...