19#include <asio/awaitable.hpp>
26namespace neograph::mcp {
47 const std::string& name,
48 const std::string& description,
49 const json& input_schema);
54 MCPTool(std::shared_ptr<detail::StdioSession> session,
55 const std::string& name,
56 const std::string& description,
57 const json& input_schema);
66 std::string
execute(
const json& arguments)
override;
68 std::string
get_name()
const override {
return name_; }
71 std::string server_url_;
72 std::shared_ptr<detail::StdioSession> stdio_session_;
74 std::string description_;
121 bool initialize(
const std::string& client_name =
"neograph");
135 json
call_tool(
const std::string& name,
const json& arguments);
150 const std::string& method,
151 const json& params = json::object());
156 json rpc_call(
const std::string& method,
const json& params = json::object());
159 std::string server_url_;
161 std::string path_prefix_;
171 mutable std::mutex http_state_mu_;
172 std::string session_id_;
178 std::string negotiated_protocol_version_;
182 std::shared_ptr<detail::StdioSession> stdio_session_;
NEOGRAPH_API export/import macro for shared-library builds.
Client for connecting to MCP (Model Context Protocol) servers.
MCPClient(std::vector< std::string > argv)
Construct a stdio-mode MCP client by spawning a subprocess.
json call_tool(const std::string &name, const json &arguments)
Call a tool directly by name.
bool initialize(const std::string &client_name="neograph")
Initialize the connection and perform the MCP handshake.
MCPClient(const std::string &server_url)
Construct an HTTP-mode MCP client.
std::vector< std::unique_ptr< Tool > > get_tools()
Discover tools from the MCP server.
asio::awaitable< json > rpc_call_async(const std::string &method, const json ¶ms=json::object())
Async variant of rpc_call for the HTTP transport.