|
Entropic 2.11.1
Local-first agentic inference engine
|
Pure C interface contract for MCP server plugins. More...


Go to the source code of this file.
Classes | |
| struct | entropic_state_provider_t |
| Read-only engine state provider for introspection tools. More... | |
Macros | |
| #define | ENTROPIC_MCP_PLUGIN_API_VERSION 1 |
| Current MCP plugin API version. | |
Typedefs | |
| typedef struct entropic_mcp_server * | entropic_mcp_server_t |
| Opaque handle to an MCP server instance. | |
Functions | |
| ENTROPIC_EXPORT int | entropic_plugin_api_version (void) |
| Report the plugin API version this plugin was built against. | |
| ENTROPIC_EXPORT entropic_mcp_server_t | entropic_create_server (void) |
| Construct a server instance. | |
| ENTROPIC_EXPORT const char * | entropic_mcp_server_name (entropic_mcp_server_t server) |
| Get the server name. | |
| ENTROPIC_EXPORT char * | entropic_mcp_server_list_tools (entropic_mcp_server_t server) |
| List tools as JSON array string. | |
| ENTROPIC_EXPORT char * | entropic_mcp_server_execute (entropic_mcp_server_t server, const char *tool_name, const char *args_json) |
| Execute a tool and return ServerResponse JSON envelope. | |
| ENTROPIC_EXPORT entropic_error_t | entropic_mcp_server_configure (entropic_mcp_server_t server, const char *config_json) |
| Configure a server instance after creation. | |
| ENTROPIC_EXPORT entropic_error_t | entropic_mcp_server_set_working_dir (entropic_mcp_server_t server, const char *path) |
| Set the working directory for a server. | |
| ENTROPIC_EXPORT void | entropic_mcp_server_destroy (entropic_mcp_server_t server) |
| Destroy a server instance. | |
| ENTROPIC_EXPORT void | entropic_free (void *ptr) |
| Free a string allocated by the server. | |
Pure C interface contract for MCP server plugins.
Every MCP server plugin (.so) implements this interface. ServerManager discovers plugins via dlopen and calls these functions through the opaque handle.
.so under mcp.plugins in the engine config: <name>.<tool> exactly like a built-in server's.A plugin that fails to open, is missing an entry point, or reports a different API version is rejected LOUDLY with ENTROPIC_ERROR_PLUGIN_LOAD_FAILED / ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH — never skipped silently, since a configured-but-absent plugin would leave the operator's stated intent unmet with no signal.
Before v2.10.1 this header documented the dlopen contract but no loader existed; a conformant .so could not be loaded by anything.
inputSchema (camelCase), matching the bundled descriptors in data/tools/*/*.json: -fvisibility=hidden, which is how most plugin projects build. Without the attribute on these declarations such a definition inherits hidden visibility and the resulting .so exports nothing at all, making every dlsym in the loader fail.entropic_mcp_server_t opaque-handle type are LOCKED at API version 1. Any change to a function declaration, struct member layout, or the macro/typedef contracts in this header is a breaking change that requires bumping entropic_plugin_api_version(). Comment-only changes are safe. Cross-version compatibility test: a plugin built against 2.1.4 headers MUST dlopen cleanly into a 2.1.5 engine (verified comment-only diff in gh release v2.1.5 review).The v2.10.1 addition of ENTROPIC_EXPORT to these declarations is NOT a version bump: it changes symbol visibility only, leaving every signature, calling convention, and the opaque-handle type untouched. A plugin built against pre-2.10.1 headers that exported its entry points by other means (its own visibility attribute, or a version script) dlopens into a v2.10.1 engine unchanged.
Definition in file i_mcp_server.h.
| #define ENTROPIC_MCP_PLUGIN_API_VERSION 1 |
Current MCP plugin API version.
Bumped when MCPServerBase or ToolBase virtual method signatures change. A plugin built against an older vtable loaded into a newer engine will be rejected with ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH.
Definition at line 320 of file i_mcp_server.h.
| typedef struct entropic_mcp_server* entropic_mcp_server_t |
Opaque handle to an MCP server instance.
Definition at line 101 of file i_mcp_server.h.
| ENTROPIC_EXPORT entropic_mcp_server_t entropic_create_server | ( | void | ) |
Construct a server instance.
Implemented BY THE PLUGIN, called by the engine's loader once per configured .so. Parameterless for ABI uniformity — pass construction parameters via entropic_mcp_server_configure() instead. The returned handle is owned by the engine and released with entropic_mcp_server_destroy().
Declared here (v2.10.1) rather than described only in prose so that plugin definitions pick up ENTROPIC_EXPORT from this header.
| ENTROPIC_EXPORT void entropic_free | ( | void * | ptr | ) |
Free a string allocated by the server.
| ptr | Pointer returned by list_tools or execute. NULL is a safe no-op. |
Free a string allocated by the server.
Free memory allocated by the engine or entropic_alloc().
@req REQ-API-008 @req REQ-ABI-001
Definition at line 2018 of file entropic.cpp.
| ENTROPIC_EXPORT entropic_error_t entropic_mcp_server_configure | ( | entropic_mcp_server_t | server, |
| const char * | config_json | ||
| ) |
Configure a server instance after creation.
| server | Server handle. |
| config_json | JSON configuration string. |
Some servers need construction parameters (root_dir, config). The entropic_create_server() signature is parameterless for ABI uniformity. Per-server configuration is passed via this call.
Configure a server instance after creation.
| server | Server handle. |
| config_json | Configuration JSON. |
Definition at line 107 of file mcp_c_api.cpp.
| ENTROPIC_EXPORT void entropic_mcp_server_destroy | ( | entropic_mcp_server_t | server | ) |
Destroy a server instance.
| server | Server handle to destroy. NULL is a safe no-op. |
| server | Server handle. @dg_internal |
Definition at line 142 of file mcp_c_api.cpp.
| ENTROPIC_EXPORT char * entropic_mcp_server_execute | ( | entropic_mcp_server_t | server, |
| const char * | tool_name, | ||
| const char * | args_json | ||
| ) |
Execute a tool and return ServerResponse JSON envelope.
| server | Server handle. |
| tool_name | Tool name (without server prefix). |
| args_json | JSON string of arguments. |
Execute a tool and return ServerResponse JSON envelope.
| server | Server handle. |
| tool_name | Tool name. |
| args_json | JSON arguments. |
Definition at line 86 of file mcp_c_api.cpp.
| ENTROPIC_EXPORT char * entropic_mcp_server_list_tools | ( | entropic_mcp_server_t | server | ) |
List tools as JSON array string.
| server | Server handle. |
List tools as JSON array string.
| server | Server handle. |
Definition at line 70 of file mcp_c_api.cpp.
| ENTROPIC_EXPORT const char * entropic_mcp_server_name | ( | entropic_mcp_server_t | server | ) |
Get the server name.
| server | Server handle. |
Get the server name.
| server | Server handle. |
Definition at line 56 of file mcp_c_api.cpp.
| ENTROPIC_EXPORT entropic_error_t entropic_mcp_server_set_working_dir | ( | entropic_mcp_server_t | server, |
| const char * | path | ||
| ) |
Set the working directory for a server.
| server | Server handle. |
| path | Working directory path. |
Base class default is no-op. Directory-aware servers (filesystem, bash, git) implement this. Enables ScopedSandbox (v2.1.5; formerly ScopedWorktree) to swap directories across .so boundaries without breaking isolation.
Set the working directory for a server.
| server | Server handle. |
| path | Working directory path. |
Definition at line 126 of file mcp_c_api.cpp.
| ENTROPIC_EXPORT int entropic_plugin_api_version | ( | void | ) |
Report the plugin API version this plugin was built against.
Implemented BY THE PLUGIN, called by the engine's loader. Return ENTROPIC_MCP_PLUGIN_API_VERSION; a plugin reporting anything else is rejected with ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH and not registered.
Declared here (v2.10.1) rather than described only in prose so that plugin definitions pick up ENTROPIC_EXPORT from this header.
Report the plugin API version this plugin was built against.
Definition at line 603 of file inference_c_api.cpp.