Install
$ agentstack add mcp-xgd16-ai-mcp ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
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 →About
ai-mcp
🚀 轻量级、高性能的 MCP(Model Context Protocol)服务端
一个用 Go 构建的 MCP 服务端,基于 mark3labs/mcp-go 与 GoFrame v2。项目内置多种可即用的工具(Tools),可通过 MCP 客户端(如 Cursor、继续集成的 IDE/Agent)进行调用。
✨ 核心优势
- 🪶 轻量级:单文件部署,无复杂依赖
- 🌍 多平台支持:支持 Windows、macOS、Linux 等主流操作系统
- 💾 低内存占用:运行时内存占用 提示:仓库默认配置包含示例数据库连接,请替换为你自己的连接信息,避免敏感信息泄露。
4) 运行
./mcp-server
启动后,终端会打印:
MCP SSE服务已启动地址: http://127.0.0.1:18232/sse
5) 连接到 MCP 客户端 在支持 MCP 的客户端中新增一个服务端配置,指向上述 SSE 地址(例如 http://127.0.0.1:18232/sse)。不同客户端配置方式略有差异,请参考对应客户端文档。
内置工具(Tools)
以下工具名称与参数定义自 internal/mcp/handler.go 注册,处理函数位于对应 mcp_tool_*.go 文件:
RunSafeShellCommand:安全执行终端命令(禁用危险操作符、限制超时与管道数)。- 参数:
command(必填):命令文本,最多 3 个|管道,禁止&&/||/重定向等;timeoutSeconds(可选):超时秒,默认 10,最大 60;cwd(可选):工作目录。
Md5Encode:对给定文本进行 MD5(小写十六进制)。- 参数:
text(必填)
Base64Encode:文本转 Base64。- 参数:
text(必填)
Base64Decode:Base64 解码为文本。- 参数:
data(必填)
JwtParse:解析 JWT(不校验签名),返回 header 与 payload。- 参数:
token(必填)
JsonEncode:校验并压缩 JSON 字符串。- 参数:
raw(必填)
SQL_Actuator:把自然语言转 SQL 的上层调用者可将 SQL 传入本工具执行,结果以 Markdown 表格返回。- 参数:
sql(必填)
GetDatabaseInfo:返回数据库类型、主机、端口、库名、用户名、版本、大小等信息。- 参数:
dbname(可选)
NowTime:获取当前时间信息与毫秒时间戳。
TimestampToDateTime:将时间戳转换为日期时间字符串。- 参数:
timestamp(必填)
GetCalendarDays:获取指定年与月的所有日期信息(是否周末、英文月名等)。- 参数:
year、month(必填)
日志
- 日志配置位于
config.yaml的logger段; - 当
path配置为目录时,会按file模板写日志; stdout: true时会同时输出到终端。
开发说明
🏗️ 项目架构
- 模块名:
ai-mcp(见go.mod) - 主要依赖:
github.com/mark3labs/mcp-go(MCP 协议实现)github.com/gogf/gf/v2(配置、日志、时间、数据库等)- 入口:
main.go,启动 SSE 服务,地址来自config.yaml的mcp-server.address - 工具注册:
internal/mcp/handler.go遍历GetList()注册 Tools
⚡ 轻量级构建优化
- 绿色 GC:使用
GOEXPERIMENT=greenteagc启用 Go 实验性垃圾回收器,减少内存占用 - 二进制瘦身:使用
-ldflags="-s -w"去除调试信息和符号表,减小文件体积 - 静态链接:生成静态链接的可执行文件,无需外部依赖
- 交叉编译:支持一键构建多平台版本,满足不同部署需求
常见问题
🔧 部署相关问题
- 端口被占用:修改
config.yaml中的mcp-server.address - 无法连接数据库:确认
database.default.link正确、网络可达,必要时关闭或放通防火墙 - 客户端连不上:确保使用 SSE 地址(形如
http://host:port/sse)
🚀 性能优化问题
- 内存占用过高:确保使用
GOEXPERIMENT=greenteagc构建,启用绿色 GC 优化 - 启动速度慢:检查系统资源,程序冷启动时间通常 < 100ms
- 跨平台兼容性:使用
make build-all构建所有平台版本,确保目标平台支持 - 文件体积大:使用
-ldflags="-s -w"参数去除调试信息,可减小 30-50% 体积
许可协议
MIT License
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: xgd16
- Source: xgd16/ai-mcp
- License: MIT
- Homepage: https://github.com/xgd16/ai-mcp
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.