Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
mcp_json_discovery.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
13#pragma once
14
16
17#include <nlohmann/json_fwd.hpp>
18
19#include <filesystem>
20#include <map>
21#include <set>
22#include <string>
23#include <vector>
24
25namespace entropic {
26
32 std::string name;
33 std::string transport;
34 std::string command;
35 std::vector<std::string> args;
36 std::map<std::string, std::string> env;
37 std::string url;
44 std::string working_dir;
45};
46
57public:
63 explicit MCPJsonDiscovery(std::filesystem::path project_dir);
64
71 std::vector<ExternalServerConfig> discover(
72 const std::set<std::string>& existing_names) const;
73
74private:
75 std::filesystem::path project_dir_;
76
87 void parse_mcp_json(
88 const std::filesystem::path& path,
89 const std::filesystem::path& own_socket,
90 const std::set<std::string>& existing_names,
91 std::set<std::string>& seen,
92 std::vector<ExternalServerConfig>& out) const;
93
105 void parse_server_entry(
106 const std::string& name,
107 const nlohmann::json& cfg,
108 const std::filesystem::path& own_socket,
109 const std::set<std::string>& existing_names,
110 std::set<std::string>& seen,
111 std::vector<ExternalServerConfig>& out) const;
112
122 bool infer_transport(
123 const nlohmann::json& cfg,
124 const std::string& type,
125 ExternalServerConfig& entry) const;
126
135 bool parse_sse_entry(
136 const nlohmann::json& cfg,
137 ExternalServerConfig& entry) const;
138
147 bool parse_stdio_entry(
148 const nlohmann::json& cfg,
149 ExternalServerConfig& entry) const;
150};
151
158std::filesystem::path compute_socket_path(
159 const std::filesystem::path& project_dir);
160
171bool is_blocked_env_var(const std::string& key);
172
173} // namespace entropic
Discovers external MCP servers from .mcp.json files.
std::vector< ExternalServerConfig > discover(const std::set< std::string > &existing_names) const
Discover servers from .mcp.json files.
Configuration structs with defaults.
Activate model on GPU (WARM → ACTIVE).
std::filesystem::path compute_socket_path(const std::filesystem::path &project_dir)
Compute project-unique Unix socket path for self-detection.
@ optional
optional: every escape asks the host's path approver
bool is_blocked_env_var(const std::string &key)
Environment variable blocklist for .mcp.json env field.
Parsed server entry from .mcp.json.
std::map< std::string, std::string > env
Stdio env vars.
std::string command
Stdio command (empty for SSE)
std::string working_dir
gh#166 (v2.13.0): cwd for the spawned child ("" = inherit).
std::string transport
"stdio" | "sse"
std::vector< std::string > args
Stdio command args.
std::string url
SSE URL (empty for stdio)