1
0
mirror of https://github.com/k8sgpt-ai/k8sgpt.git synced 2025-05-14 02:55:17 +00:00
k8sgpt/pkg/server
Alex Jones e41ffd80d0
feat: add MCP support ()
* feat: first mcp impl

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: update

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: wip

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: switcheed to stdio transport

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: readme

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* feat: fix the linter 🤖

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* feat: fix the linter 🤖

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* feat(mcp): implement MCP server and handler

- Implement MCP server and handler
- Add MCP server to serve
- Add MCP handler to handle MCP requests
- Add MCP server to serve
- Add MCP handler to handle MCP requests

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* feat: consolidating code duplication

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* feat: added http sse support

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: fixed broken tests

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: updated and fixed linter

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: updated and fixed linter

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* chore: updated the linter issues

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

---------

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2025-04-29 09:22:44 +01:00
..
analyze fix: prevent npe by handling checking error in NewAnalysis call () 2025-01-31 14:26:35 +00:00
client_example feat: add MCP support () 2025-04-29 09:22:44 +01:00
config feat: add MCP support () 2025-04-29 09:22:44 +01:00
example feat: add MCP support () 2025-04-29 09:22:44 +01:00
query fix: config ai provider in query () 2025-04-15 11:11:40 +01:00
log.go feat: refactoring to the new schema () 2024-08-15 14:42:55 +01:00
mcp.go feat: add MCP support () 2025-04-29 09:22:44 +01:00
README.md feat: add MCP support () 2025-04-29 09:22:44 +01:00
server_test.go feat: testupdate () 2024-11-10 15:33:50 +00:00
server.go fix: [Bug] Make lint command is not working () 2024-10-30 10:49:44 +00:00

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 implementation
  • server.go: The HTTP server implementation
  • tools.go: Tool definitions for the MCP server

Features

The MCP server provides the following features:

  1. Analyze Kubernetes Resources: Analyze Kubernetes resources in a cluster
  2. Get Cluster Information: Retrieve information about the Kubernetes cluster

Usage

To use the MCP server, you need to:

  1. Initialize the MCP server with a Kubernetes client
  2. Start the server
  3. 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.