mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-07-19 09:50:15 +00:00
* use mcp library to support streamable http and fix resourceResponse Signed-off-by: Umesh Kaul <umeshkaul@gmail.com> * added name and version for mcp server Signed-off-by: Umesh Kaul <umeshkaul@gmail.com> * added tests Signed-off-by: Umesh Kaul <umeshkaul@gmail.com> * chore: fixed linter Signed-off-by: AlexsJones <alexsimonjones@gmail.com> * fixed linter issues in server_test.go Signed-off-by: Umesh Kaul <umeshkaul@gmail.com> --------- Signed-off-by: Umesh Kaul <umeshkaul@gmail.com> Signed-off-by: AlexsJones <alexsimonjones@gmail.com> Co-authored-by: AlexsJones <alexsimonjones@gmail.com> |
||
---|---|---|
.. | ||
analyze | ||
client_example | ||
config | ||
example | ||
query | ||
log.go | ||
mcp.go | ||
README.md | ||
server_test.go | ||
server.go |
K8sGPT MCP Server
This directory contains the implementation of the Mission Control Protocol (MCP) server for K8sGPT. The MCP server allows K8sGPT to be integrated with other tools that support the MCP protocol.
Components
mcp.go
: The main MCP server implementationserver.go
: The HTTP server implementationtools.go
: Tool definitions for the MCP server
Features
The MCP server provides the following features:
- Analyze Kubernetes Resources: Analyze Kubernetes resources in a cluster
- Get Cluster Information: Retrieve information about the Kubernetes cluster
Usage
To use the MCP server, you need to:
- Initialize the MCP server with a Kubernetes client
- Start the server
- Connect to the server using an MCP client
Example:
client, err := kubernetes.NewForConfig(config)
if err != nil {
log.Fatalf("Failed to create Kubernetes client: %v", err)
}
mcpServer := server.NewMCPServer(client)
if err := mcpServer.Start(); err != nil {
log.Fatalf("Failed to start MCP server: %v", err)
}
Integration
The MCP server can be integrated with other tools that support the MCP protocol, such as:
- Mission Control
- Other MCP-compatible tools
License
This code is licensed under the Apache License 2.0.