feat
搭建 mcp server+mcp plugin
This commit is contained in:
1 parent
09f9d69d36
commit
5d6f1c74d1
16 files changed
+792
-229
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
#include "mcp_plugin_api.h"
|
||||
|
||||
class mcp_Tools
|
||||
{
|
||||
private:
|
||||
std::unordered_map<std::string, std::shared_ptr<mcp_Tool>> m_tools;
|
||||
|
||||
public:
|
||||
// 注册工具
|
||||
void Register(std::shared_ptr<mcp_Tool> pTool);
|
||||
|
||||
// 组装所有工具的描述,返回 JSON 数组 (用于 tools/list)
|
||||
nlohmann::json ToLLM() const;
|
||||
|
||||
// 路由分发执行指令 (用于 tools/call)
|
||||
nlohmann::json Call(const std::string &name, const nlohmann::json &args);
|
||||
};
|
||||
|
||||
class mcp_ConfigParser
|
||||
{
|
||||
public:
|
||||
static bool LoadAndRegister(const std::string &jsonFilePath, mcp_Tools ®istry);
|
||||
|
||||
private:
|
||||
static void LoadDllTool(const nlohmann::json &toolConfig, const std::string &pluginDir, mcp_Tools ®istry);
|
||||
};
|
||||
Reference in new issue
Block a user