裂变MCP服务器
该项目正在开发中,尚未发布。
一个基于Go的服务器,用于使用模型上下文协议(MCP)管理Kubernetes上的Fission函数。该项目提供了一种简单有效的方法,可以通过编程创建、列出和管理Fission无服务器函数。
特性
- 🚀 列出命名空间中的所有Fission函数
- 📦 创建和管理Fission函数和包
- 🔧 更新现有功能
- 🐍 支持Python运行时环境
- ☸️ 使用客户端go进行本地Kubernetes集成
先决条件
- 达到1.21或更高
- 安装了Fission的Kubernetes集群
- 有效的kubeconfig文件(
~/.kube/config或设置KUBECONFIG环境变量) - 安装在集群中的裂变CRDs
安装
克隆存储库
git clone https://github.com/tinhminhtue/fission-mcp-server.git
cd fission-mcp-server构建
go build -o fission-mcp-server main.go或者使用Makefile:
make build跑
# Using Go run (recommended for development)
go run ./cmd/server
# Or with pre-built binary
./fission-mcp-serverVS代码调试配置
对于VS代码调试,请在中使用此启动配置 .vscode/launch.json:
{
"name": "Debug Server",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/cmd/server",
"env": {
"FISSION_ROUTER_URL": "http://router.fission.svc.cluster.local"
},
"args": [],
"showLog": true,
"trace": "log"
}用法
服务器将:
- 列出集群中所有现有的Fission函数
- 创建一个名为的新函数
hello-world2使用Python运行时
配置
您可以通过修改中的常量来自定义行为 main.go:
const (
functionName = "hello-world2" // Function name
functionEnv = "python" // Runtime environment
defaultNamespace = "ai-code" // Kubernetes namespace
pythonCode = `...` // Function code
)环境变量
KUBECONFIG:kubeconfig文件的路径(默认为~/.kube/config)PORT:服务器端口(默认为8080)FISSION_ROUTER_URL:用于功能测试的裂变路由器URL(默认为http://router.fission)
- 使用 http://localhost:8888 如果端口转发路由器: kubectl port-forward -n fission svc/router 8888:80 - 如果路由器通过Ingress/LoadBalancer暴露,请使用外部URL
项目结构
fission-mcp-server/
├── main.go # Main application code
├── go.mod # Go module dependencies
├── go.sum # Go module checksums
├── README.md # This file
├── LICENSE # License file
├── CONTRIBUTING.md # Contribution guidelines
├── .gitignore # Git ignore rules
└── Makefile # Build automation发展
运行测试
make test运行功能API烟雾测试
该项目包括对Function API端点的集成烟雾测试,以验证所有CRUD操作在真实的Fission服务器上是否正确工作。
# Start the server first
./fission-mcp-server
# In another terminal, run smoke tests
make test-smoke
# Or run directly with go
go test -v ./tests/看 测试/README.md 查看详细的烟雾测试文件。
为不同平台构建
make build-linux # Build for Linux
make build-darwin # Build for macOS
make build-windows # Build for Windows贡献
欢迎投稿!请阅读 贡献.md 有关我们的行为准则和提交pull请求流程的详细信息。
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
致谢
- 裂变 -Kubernetes的无服务器框架
- Kubernetes客户端 -Kubernetes Go客户端
作者
由...创建 丁明树
