Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::ExternalMCPClient Class Reference

Client for an external MCP server (stdio or SSE). More...

#include <entropic/mcp/external_client.h>

Public Member Functions

 ExternalMCPClient (std::string name, std::unique_ptr< Transport > transport)
 Construct with name and transport.
 
bool connect ()
 Connect: open transport + MCP initialize + tools/list.
 
void disconnect ()
 Disconnect: close transport.
 
std::string list_tools () const
 List tools as JSON array string (cached).
 
std::string execute (const std::string &tool_name, const std::string &args_json)
 Execute a tool call via the external server.
 
std::pair< std::vector< std::string >, std::vector< std::string > > refresh_tools ()
 Re-query tools/list and diff against cache.
 
bool is_connected () const
 Check connection state.
 
const std::string & name () const
 Get server name.
 
void interrupt ()
 Abort any pending execute() by interrupting the transport.
 

Detailed Description

Client for an external MCP server (stdio or SSE).

Owns a Transport instance. Handles MCP protocol negotiation, tool list caching, tool name prefixing, and response sanitization.

Security
External server responses have their "directives" array stripped. External servers CANNOT inject delegate, stop_processing, phase_change, or other engine-level directives.
Version
1.8.7

Definition at line 41 of file external_client.h.

Constructor & Destructor Documentation

◆ ExternalMCPClient()

entropic::ExternalMCPClient::ExternalMCPClient ( std::string  name,
std::unique_ptr< Transport transport 
)

Construct with name and transport.

Parameters
nameServer name (unique key, used as tool prefix).
transportOwnership transferred.
Version
1.8.7
Parameters
nameServer name.
transportOwnership transferred.

Definition at line 27 of file external_client.cpp.

Member Function Documentation

◆ connect()

bool entropic::ExternalMCPClient::connect ( )

Connect: open transport + MCP initialize + tools/list.

Connect: open transport, initialize, query tools.

Returns
true on success.
Version
1.8.7
Returns
true on success.

Definition at line 39 of file external_client.cpp.

◆ disconnect()

void entropic::ExternalMCPClient::disconnect ( )

Disconnect: close transport.

Disconnect: close transport, clear cache.

Version
1.8.7

Definition at line 66 of file external_client.cpp.

◆ execute()

std::string entropic::ExternalMCPClient::execute ( const std::string &  tool_name,
const std::string &  args_json 
)

Execute a tool call via the external server.

Parameters
tool_nameLocal name (without server prefix).
args_jsonJSON arguments string.
Returns
ServerResponse JSON envelope (directives always empty).
Version
1.8.7
Parameters
tool_nameLocal name (without server prefix).
args_jsonJSON arguments.
Returns
ServerResponse JSON (directives always empty).

Definition at line 93 of file external_client.cpp.

◆ interrupt()

void entropic::ExternalMCPClient::interrupt ( )
inline

Abort any pending execute() by interrupting the transport.

Delegates to Transport::interrupt(). Safe to call concurrently from the engine's interrupt thread. (P1-10, 2.0.6-rc16)

@utility

Version
2.0.6-rc16

Definition at line 114 of file external_client.h.

◆ is_connected()

bool entropic::ExternalMCPClient::is_connected ( ) const

Check connection state.

Check connection state via transport.

Returns
true if transport is connected.
Version
1.8.7
Returns
true if connected.

Definition at line 174 of file external_client.cpp.

◆ list_tools()

std::string entropic::ExternalMCPClient::list_tools ( ) const

List tools as JSON array string (cached).

List tools as JSON array string (cached, prefixed).

Returns
JSON array of tool definitions with prefixed names.
Version
1.8.7
Returns
JSON array string.

Definition at line 80 of file external_client.cpp.

◆ name()

const std::string & entropic::ExternalMCPClient::name ( ) const
inline

Get server name.

Returns
Server name string. @utility
Version
1.8.7

Definition at line 103 of file external_client.h.

◆ refresh_tools()

std::pair< std::vector< std::string >, std::vector< std::string > > entropic::ExternalMCPClient::refresh_tools ( )

Re-query tools/list and diff against cache.

Returns
Pair of (added_names, removed_names).
Version
1.8.7
Returns
Pair of (added, removed) tool name vectors.

Definition at line 149 of file external_client.cpp.


The documentation for this class was generated from the following files: