Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions Formula/m/mcp-server-kubernetes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,29 @@ def install

test do
json = <<~JSON
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26"}}
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"brew-test","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
JSON
output = pipe_output(bin/"mcp-server-kubernetes", json, 0)
assert_match "kubectl_get", output
assert_match "kubectl_describe", output
assert_match "kubectl_logs", output

Open3.popen3(bin/"mcp-server-kubernetes") do |stdin, stdout, _, wait_thread|
begin
stdin.write json
stdin.close
sleep 1
responses = stdout.readlines
ensure
if wait_thread.alive?
begin
Process.kill("TERM", wait_thread.pid)
rescue Errno::ESRCH
# Process already terminated
end
end
end

assert responses.length >= 2, "Expected at least 2 responses, got #{responses.length}"
assert JSON.parse(responses[1]).dig("result", "tools")&.any? { |tool| tool["name"] == "kubectl_get" }
end
end
end
Loading