@couleetech/mcp-k8s-server
v0.1.0
Published
MCP Kubernetes server project
Readme
MCP Kubernetes Server
This project is an MCP server that integrates with Kubernetes to manage pods, deployments, and services. It is built using TypeScript and Node.js, and follows strict best practices including ESLint, Prettier, and comprehensive unit testing.
Features
- Manage Kubernetes pods, deployments, and services through a set of tools.
- Exposes a REST API for tool discovery and usage.
- Configurable via environment variables for flexible deployment.
Project Structure
mcp-k8s-server/ ├── src/ │ ├── clients/ # Kubernetes API clients and auth checker │ ├── config/ # Configuration and logging modules │ ├── tools/ # Tool implementations for pods, deployments, services │ ├── app.ts # Application initializer │ └── server.ts # Express server exposing API endpoints ├── tests/ # Unit tests for modules and tools ├── .eslintrc.js # ESLint configuration ├── .prettierrc.json # Prettier configuration ├── tsconfig.json # TypeScript configuration ├── .gitlab-ci.yml # GitLab CI/CD pipeline configuration ├── Dockerfile # Docker configuration for production ├── docker-compose.yml # Docker Compose configuration for local development └── package.json # NPM package configuration
Environment Variables
- K8S_SERVER: URL of your Kubernetes cluster.
- K8S_TOKEN: Authentication token for the Kubernetes API.
- DISABLED_TOOLS: Comma-separated list of tool names to disable (optional).
- TOOLSET_PREFIX: Prefix to add to tool names in the registry (optional).
- PORT: Port for the Express server (default: 3000).
Setup and Usage
- Clone the repository.
- Install dependencies:
npm install - Create a
.envfile with the required environment variables. - Build the project:
npm run build - Run tests:
npm test - Start the server:
npm startornode dist/server.js
The server exposes the following endpoints:
- GET /tools: Returns the list of available tools.
- GET /health: Health check endpoint.
Tool Usage
Tools are available via the tool registry and can be invoked directly from the API or within the code. They facilitate operations like listing pods, managing deployments, and more.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License. See LICENSE for details.
