16namespace neograph::mcp {
19enum class McpCredentialMode { credentialless_stdio };
21enum class McpTrustMode { pinned, trusted_mutable };
23struct NEOGRAPH_API OpenCodeGlobalMcpConfig {
25 std::filesystem::path source_path;
26 std::size_t max_source_bytes = 1024 * 1024;
27 bool single_user_local =
true;
30struct NEOGRAPH_API DiscoveredMcpServer {
31 std::string source_host =
"opencode";
32 std::string source_scope =
"user-global";
33 std::string source_id;
34 std::string server_name;
35 std::filesystem::path source_path;
36 std::filesystem::path cwd;
37 std::vector<std::string> argv;
38 std::chrono::milliseconds startup_timeout{10000};
39 std::string source_content_hash;
40 std::string redacted_config_hash;
41 McpCredentialMode credential_mode = McpCredentialMode::credentialless_stdio;
45struct NEOGRAPH_API DiscoveryRejection {
46 std::string server_name;
49struct NEOGRAPH_API McpDiscoveryReport {
50 std::filesystem::path source_path;
51 std::string source_content_hash;
52 std::vector<DiscoveredMcpServer> servers;
53 std::vector<DiscoveryRejection> rejected;
59 static McpDiscoveryReport discover(
const OpenCodeGlobalMcpConfig& config = {});
62struct NEOGRAPH_API McpCapabilityManifest {
64 bool auto_execute =
false;
65 std::set<std::string> effects;
66 std::string argument_policy;
69 json argument_predicate = json::object();
72struct NEOGRAPH_API McpLaunchApproval {
73 McpTrustMode trust_mode = McpTrustMode::pinned;
74 bool argv_no_credentials_attested =
false;
75 std::string source_path;
76 std::string source_content_hash;
78 std::string executable;
79 std::string executable_identity;
80 std::string argv_hash;
81 std::string interpreter_identity;
82 std::string package_identity;
85struct NEOGRAPH_API McpToolApproval {
86 std::string server_name;
87 std::string launch_identity;
88 std::vector<std::string> selected_tools;
89 std::map<std::string, std::string> schema_hashes;
90 std::vector<McpCapabilityManifest> manifest;
91 std::string policy_version;
94struct NEOGRAPH_API McpAdoptionRequest {
95 DiscoveredMcpServer server;
96 McpLaunchApproval launch;
97 McpToolApproval tools;
102NEOGRAPH_API McpLaunchApproval make_mcp_launch_approval(
103 const DiscoveredMcpServer& server, McpTrustMode mode,
104 bool argv_no_credentials_attested);
106NEOGRAPH_API std::string mcp_tool_schema_hash(
const json& definition);
109 std::string server_name;
110 std::string source_id;
111 std::string trust_mode;
112 std::string credential_mode =
"credentialless_stdio";
113 std::string launch_identity;
114 std::string policy_version;
115 std::vector<std::string> selected_tools;
116 bool revoked =
false;
129 void adopt(
const McpAdoptionRequest& request);
130 void revoke(
const std::string& server_name);
131 bool contains(
const std::string& server_name)
const;
132 std::vector<McpAdoptionStatus> status()
const;
133 std::map<std::string, std::shared_ptr<MCPClient>> clients()
const;
134 HarnessCapabilityExecutor capability_executor()
const;
139 HarnessProviderExecutorConfig& provider)
const;
143 std::shared_ptr<Impl> impl_;
NEOGRAPH_API export/import macro for shared-library builds.
Owns initialized, policy-bound clients and drains them on revocation.
void configure_harness(HarnessProgramHostConfig &host, HarnessProviderExecutorConfig &provider) const
Install approved metadata/bindings before constructing the host and provider worker.
json tool_catalog() const
Immutable namespaced metadata for constructing Harness requests.
void adopt(const McpAdoptionRequest &request)
Approves, inspects, initializes and lists tools; never accepts implicit consent.
Read only OpenCode's user-global raw source.
Compiler-backed subagent Harness service for the MCP server.
Thin C++ RAII wrapper around yyjson with nlohmann-compatible API.
Metadata-safe adoption record; argv and raw config are intentionally absent.