humanus.cpp/server/mcp_server_main.cpp

41 lines
1.1 KiB
C++

/**
* @file mcp_server_main.cpp
* @brief OpenManus MCP Server Implementation
*
* This file implements the OpenManus MCP server that provides tool invocation functionality.
* Currently implements the PythonExecute tool.
*/
#include "../mcp/include/mcp_server.h"
#include "../mcp/include/mcp_tool.h"
#include "../mcp/include/mcp_resource.h"
#include <iostream>
#include <string>
#include <memory>
#include <filesystem>
// Import Python execution tool
extern void register_python_execute_tool(mcp::server& server);
int main() {
// Create and configure server
mcp::server server("localhost", 8818);
server.set_server_info("OpenManusMCPServer", "0.0.1");
// Set server capabilities
mcp::json capabilities = {
{"tools", mcp::json::object()}
};
server.set_capabilities(capabilities);
// Register Python execution tool
register_python_execute_tool(server);
// Start server
std::cout << "Starting OpenManus MCP server at localhost:8818..." << std::endl;
std::cout << "Press Ctrl+C to stop server" << std::endl;
server.start(true); // Blocking mode
return 0;
}