Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
discovery_policy.h File Reference

Which external MCP servers a server set may launch (v2.14.0). More...

#include <entropic/mcp/mcp_json_discovery.h>
#include <entropic/types/config.h>
#include <algorithm>
#include <filesystem>
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
Include dependency graph for discovery_policy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Enumerations

enum class  entropic::McpJsonConfigVerdict { entropic::disabled , entropic::enabled , entropic::ask }
 What configuration alone says about a discovered server. More...
 

Functions

McpJsonConfigVerdict entropic::mcpjson_config_verdict (const std::string &name, const MCPConfig &cfg)
 Config's verdict on one discovered server.
 
std::string entropic::arg_after (const std::vector< std::string > &args, const std::string &flag)
 The value following flag in args, or "".
 
bool entropic::is_entropic_bridge (const ExternalServerConfig &cfg)
 Whether a stdio entry runs entropic mcp-bridge.
 
bool entropic::launches_own_bridge (const ExternalServerConfig &cfg, const std::filesystem::path &own_socket, const std::filesystem::path &spawn_root)
 Whether launching cfg would connect this handle to itself.
 
std::string entropic::discovered_server_json (const ExternalServerConfig &cfg, const std::filesystem::path &root)
 The pre-connect hook's context JSON for one discovered server.
 

Detailed Description

Which external MCP servers a server set may launch (v2.14.0).

Pure decisions, kept out of ServerManager so the CPU suite can pin them without spawning anything.

The Claude-Code model (gh#199)
A .mcp.json the engine discovers is a list of PROCESSES a repository asks the host to start. Before v2.14.0 a named workspace started all of them unconditionally — a consumer's handle, configured by file precisely to avoid project config, launched a 58-tool application server and four nested launchers. Now a discovered entry connects only when enabled: refused when named in mcp.disabled_mcpjson_servers; connected when named in mcp.enabled_mcpjson_servers or mcp.enable_all_project_mcp_servers is set; otherwise the ENTROPIC_HOOK_PRE_MCP_SERVER_CONNECT pre-hook decides, and with nobody to ask it is not connected.
Self-connection (gh#200)
The old guard compared a non-standard "path" key against a socket derived from the ServerManager root — it could never match a stdio entry, and our own tracked .mcp.json (entropic mcp-bridge) escaped it only because its NAME collided with the built-in entropic server. launches_own_bridge resolves where an entropic mcp-bridge entry would actually connect, exactly as src/cli/mcp_bridge.cpp does, and compares that with the socket this handle really binds.
Version
2.14.0

Definition in file discovery_policy.h.