Entropic 2.3.8
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;
38};
39
50public:
56 explicit MCPJsonDiscovery(std::filesystem::path project_dir);
57
64 std::vector<ExternalServerConfig> discover(
65 const std::set<std::string>& existing_names) const;
66
67private:
68 std::filesystem::path project_dir_;
69
80 void parse_mcp_json(
81 const std::filesystem::path& path,
82 const std::filesystem::path& own_socket,
83 const std::set<std::string>& existing_names,
84 std::set<std::string>& seen,
85 std::vector<ExternalServerConfig>& out) const;
86
98 void parse_server_entry(
99 const std::string& name,
100 const nlohmann::json& cfg,
101 const std::filesystem::path& own_socket,
102 const std::set<std::string>& existing_names,
103 std::set<std::string>& seen,
104 std::vector<ExternalServerConfig>& out) const;
105
115 bool infer_transport(
116 const nlohmann::json& cfg,
117 const std::string& type,
118 ExternalServerConfig& entry) const;
119
128 bool parse_sse_entry(
129 const nlohmann::json& cfg,
130 ExternalServerConfig& entry) const;
131
140 bool parse_stdio_entry(
141 const nlohmann::json& cfg,
142 ExternalServerConfig& entry) const;
143};
144
151std::filesystem::path compute_socket_path(
152 const std::filesystem::path& project_dir);
153
164bool is_blocked_env_var(const std::string& key);
165
166} // 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.
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 transport
"stdio" | "sse"
std::vector< std::string > args
Stdio command args.
std::string url
SSE URL (empty for stdio)