Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: MCP server implementation #1392

Open
3 of 4 tasks
pokgak opened this issue Mar 7, 2025 · 4 comments
Open
3 of 4 tasks

[Question]: MCP server implementation #1392

pokgak opened this issue Mar 7, 2025 · 4 comments
Assignees

Comments

@pokgak
Copy link

pokgak commented Mar 7, 2025

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

No response

Kubernetes Version

No response

Host OS and its Version

No response

Steps to reproduce

Connect to k8sgpt through MCP server

Expected behaviour

k8sgpt provides an MCP server that platforms like Claude can connect to and uses without leaving the interface

Actual behaviour

No support for MCP server

Additional Information

Would like to know if MCP server support is on the map for k8sgpt or is it out of scope for this project? I do see overlap in this but maybe slight separation where the reasoning part is offloaded to external party and the project just focus on exposing tools to them.

@ronaldpetty
Copy link
Contributor

Taking a look at this, have some ideas to try out.

@ronaldpetty
Copy link
Contributor

ronaldpetty commented Mar 18, 2025

Made a prototype. Here was the basic idea.

  • clone k8sgpt
  • added hardcorded MCP server
  • launch at startup
  • register "hello" tool that appends results

Nothing perfect, but proves it can be done. Next I suppose is to think about what a good enough solution might look like.

Image
go build -o mybuild
mybuild serve
% curl -N --http2 -H "Accept: text/event-stream" http://localhost:9999/sse
event: endpoint
data: http://0.0.0.0:9999/message?sessionId=3c8ebbcc-35f1-468a-8228-9e7c8e33dbab
% curl -X POST -H "Content-Type: application/json" \                               
     -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hello_world","arguments":{"name":"Alice"}}}' \
     "http://localhost:9999/message?sessionId=86d58e1d-a584-4c0e-982f-eed8756da228"
{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"Hello, Alice {\n  \"errors\": null,\n  \"problems\": 0,\n  \"provider\": \"\",\n  \"results\": null,\n  \"status\": \"OK\"\n}!"}]}}

I need to chat with the team because we have a few places something like this could live.

@AlexsJones
Copy link
Member

Awesome work @ronaldpetty do you think we would implement this in practice, as an external module/analyzer etc?

@ronaldpetty
Copy link
Contributor

@AlexsJones the primary design is that MCP is pull based (MCP client asks MCP server for tool execution results, the server being K8sGPT).

If we used the Operator, we could just read Results.

If we used the CLI, we could potential do it via k8sgpt serve or through exposing an endpoint and/or port (similar to above).

I don't exactly remember k8sgpt serve purpose (aside development) so maybe that is not the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Proposed
Development

No branches or pull requests

3 participants