AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

NativeMCP

mcp-sihaoh-nativemcp · by SihaoH

这是一个由C++编写的MCP系统,包括MCP核心架构的host、client和server

No reviews yet
0 installs
28 views
0.0% view→install

Install

$ agentstack add mcp-sihaoh-nativemcp

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-sihaoh-nativemcp)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
stale · 1y ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of NativeMCP? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

nativeMCP

概述

这是一个由C++编写的MCP系统,包括MCP核心架构的host、client和server;而host本身已经相当于是AI Agent,虽然目前只有命令行(但我觉得也不需要花哨界面)

参考:https://modelcontextprotocol.io/introduction

server可用于其他支持MCP的软件,如Cursor

client也支持MCP官方的servers,和Cursor同样的配置即可

基本组成

  • MCPServer:遵循MCP的Server父类,相当于SDK,子类只需要继承以及按要求新增所需的方法即可;目前通信方式只支持stdio
  • servers:继承MCPServer后实现的一些具体server,可以直接使用;后续分支再更新更多的工具
  • host:宿主应用程序,连接LLM,根据配置加载MCPClient
  • MCPClient:在host应用程序内部与服务器保持1:1连接,在LLM需要的时候调用MCPServer提供的工具
  • ModelAdapter:连接LLM的适配层,目前实现是使用cpp-httplib对Ollama发起请求

依赖库&外部程序

  • Qt6.8:字符串、Json处理,元对象机制(用于动态调用任意函数)
  • cpp-httplib:用于请求Ollama或是其他在线大模型的api
  • Ollama:本地部署大模型的后端程序
  • LLM 任意的大语言模型,用于自然语言的问答,例如DeepSeek、Qwen等

编译环境

编译工具链

  • CMake >= 3.30
  • Visual Studio 2022(勾选使用C++进行桌面开发

vcpkg

用于导入第三方库cpp-httplib、spdlog

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && bootstrap-vcpkg.bat

然后将vcpkg.exe的路径添加到系统环境变量PATH里

Qt6.8.2

可以直接使用在线安装包,不过还是建议自己下载源码来构建。目前只需编译qt-base模块即可。

参考

https://doc.qt.io/qt-6/getting-sources-from-git.html

https://doc.qt.io/qt-6/windows-building.html

https://doc.qt.io/qt-6/configure-options.html

下载源码

git clone --branch v6.8.2 git://code.qt.io/qt/qt5.git .\src

生成
mkdir build
cd build
..\src\configure.bat -init-submodules -submodules qtbase
..\src\configure.bat -debug-and-release -prefix 
cmake --build . --parallel
cmake --install .
cmake --install . --config debug

上述步骤有两次install,第一次默认是只安装release 最后将\bin添加到系统环境变量PATH中里

构建

clone源码并进入到源码目录下

mkdir build
cd build
cmake .. -G "Visual Studio 17 2022"

最后打开build/nativeMCP.sln进行编译和调试(注意先将host设为启动项,或者要调试server的话则将对应的server设为启动项)

配置

修改[config.json](./host/config.json),可简单配置MCP Host的功能

  • api
  • url:api的完整url
  • model:生成对话的模型,推荐deepseek或qwen
  • api_key:如果是本地部署的则为空
  • mcpServers
  • server名称(因为代码会判断冒号,所以不要使用冒号)
  • command:在windows系统上必须都是cmd
  • args:["/c"]第一个参数必须是/c,第二个参数看server的类型选择,exe直接是exe的路径,python程序则填python,Node.js则填npx,后面的参数再根据server的说明来填写

示例

[2025-03-26 12:27:30.296][info][Host.cpp::18] MCP Host初始化
[2025-03-26 12:27:30.299][info][ModelAdapter.cpp::22] ModelAdapter初始化:http://localhost:11434, qwen2.5:7b
[2025-03-26 12:27:30.397][info][Host.cpp::67]
可用工具列表:
cpp-time:
  getCurrentTime 获取当前时间
  waitTime 等待指定的时间
server-test:
  getAvailableIP 获取可用的IP列表
  sendToIP 将内容发送到指定的ip地址
  testMultiParams 测试多参数的工具调用

>>> 获取当前时间,并发送给所有可用的ip
[2025-03-26 12:29:08.349][info][Host.cpp::123] 调用MCP工具[cpp-time::getCurrentTime]: {
    "datetime": "2025-03-26T12:29:08.346",
    "timezone": "Asia/Shanghai"
}

[2025-03-26 12:29:20.160][info][Host.cpp::123] 调用MCP工具[server-test::getAvailableIP]: {
    "ip_list": [
        "192.168.1.201",
        "192.168.1.202",
        "192.168.1.203"
    ]
}

[2025-03-26 12:30:07.784][info][Host.cpp::123] 调用MCP工具[server-test::sendToIP]: {
    "content": "当前时间为:2025-03-26T12:29:08.346 (Asia/Shanghai)",
    "ip": "192.168.1.201",
    "status": "发送成功"
}

[2025-03-26 12:30:07.788][info][Host.cpp::123] 调用MCP工具[server-test::sendToIP]: {
    "content": "当前时间为:2025-03-26T12:29:08.346 (Asia/Shanghai)",
    "ip": "192.168.1.202",
    "status": "发送成功"
}

[2025-03-26 12:30:07.789][info][Host.cpp::123] 调用MCP工具[server-test::sendToIP]: {
    "content": "当前时间为:2025-03-26T12:29:08.346 (Asia/Shanghai)",
    "ip": "192.168.1.203",
    "status": "发送成功"
}

当前时间为:2025-03-26T12:29:08.346 (Asia/Shanghai)

已经将当前时间发送给所有可用的IP地址,发送状态均为成功。

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.