Fission函数管理服务器

一个基于Go的服务器,用于通过模型上下文协议(MCP)在Kubernetes上管理Fission无服务器函数,提供创建、列出和管理函数的程序化方法。

  • by disillusioners
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 tinhminhtue/fission-mcp-server

使用说明

裂变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-server

VS代码调试配置

对于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"
}

用法

服务器将:

  1. 列出集群中所有现有的Fission函数
  2. 创建一个名为的新函数 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许可证获得许可-请参阅 许可证 文件以获取详细信息。

致谢

作者

由...创建 丁明树