17#include <nlohmann/json.hpp>
73 auto args = nlohmann::json::parse(args_json);
74 std::string url = args.at(
"url").get<std::string>();
76 static constexpr int default_max = 20000;
77 static constexpr int cap_max = 50000;
78 int max_length = args.value(
"max_length", default_max);
79 max_length = std::min(max_length, cap_max);
81 logger->info(
"[web_fetch] url='{}' max_length={}", url, max_length);
84 "Web fetch not yet connected (requires cpp-httplib integration)",
136 auto args = nlohmann::json::parse(args_json);
137 std::string query = args.at(
"query").get<std::string>();
139 static constexpr int default_max = 5;
140 static constexpr int cap_max = 10;
141 int max_results = args.value(
"max_results", default_max);
142 max_results = std::min(max_results, cap_max);
144 logger->info(
"[web_search] query='{}' max_results={}",
148 "Web search not yet connected (requires cpp-httplib integration)",
169 std::string tools_dir = data_dir +
"/tools";
172 "web_fetch",
"web", tools_dir);
173 web_fetch_ = std::make_unique<WebFetchTool>(
174 std::move(fetch_def));
177 "web_search",
"web", tools_dir);
178 web_search_ = std::make_unique<WebSearchTool>(
179 std::move(search_def));
184 logger->info(
"WebServer initialized with 2 tools");
Concrete base class for MCP servers (80% logic).
void register_tool(ToolBase *tool)
Register a tool with this server.
WebServer(const std::string &data_dir)
Construct with data dir.
~WebServer() override
Destructor.
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Activate model on GPU (WARM → ACTIVE).
ToolDefinition load_tool_definition(const std::string &tool_name, const std::string &server_prefix, const std::string &data_dir)
Load a tool definition from a JSON file.
MCPAccessLevel
MCP tool access level for per-identity authorization.
@ READ
Read-only operations (e.g., read_file, list_directory)
MCPServerBase concrete base class + ServerResponse.
Structured result from tool execution.
Web MCP server — web_fetch + web_search.