17#include <nlohmann/json.hpp>
72 auto args = nlohmann::json::parse(args_json);
73 std::string url = args.at(
"url").get<std::string>();
75 static constexpr int default_max = 20000;
76 static constexpr int cap_max = 50000;
77 int max_length = args.value(
"max_length", default_max);
78 max_length = std::min(max_length, cap_max);
80 logger->info(
"[web_fetch] url='{}' max_length={}", url, max_length);
83 "Web fetch not yet connected (requires cpp-httplib integration)",
134 auto args = nlohmann::json::parse(args_json);
135 std::string query = args.at(
"query").get<std::string>();
137 static constexpr int default_max = 5;
138 static constexpr int cap_max = 10;
139 int max_results = args.value(
"max_results", default_max);
140 max_results = std::min(max_results, cap_max);
142 logger->info(
"[web_search] query='{}' max_results={}",
146 "Web search not yet connected (requires cpp-httplib integration)",
162 std::string tools_dir = data_dir +
"/tools";
165 "web_fetch",
"web", tools_dir);
166 web_fetch_ = std::make_unique<WebFetchTool>(
167 std::move(fetch_def));
170 "web_search",
"web", tools_dir);
171 web_search_ = std::make_unique<WebSearchTool>(
172 std::move(search_def));
177 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.