Skip to content

Commit fc0c161

Browse files
cjimticlaude
andauthored
MCP Kubernetes Discovery Enhancements (#350)
* Add OpenSSF Scorecard badge to README * Add `GetPodLogs` method to KubernetesDiscoveryAdapter - Implements a function to fetch pod logs with configurable options, including tail line limits, timestamps, and stream size constraints. - Adds helper `splitLogLines` function to process log content into lines. * Add `GetPodLogs` method to KubernetesDiscoveryHTTP - Implements a function to fetch pod logs with configurable options, such as container, timestamps, tail lines, and more. * Add `GetPodLogs` method and supporting types to `fwdapi` interface - Introduces `GetPodLogs`, enabling retrieval of pod logs with configurable options. - Adds `PodLogsOptions` and `PodLogsResponse` types for log retrieval parameters and responses. * Introduce `get_pod_logs` tool to fetch Kubernetes pod logs - Adds `GetPodLogsInput` type for customizable log retrieval parameters. - Registers `get_pod_logs` as an MCP tool for debugging Kubernetes services. - Implements `handleGetPodLogs` to fetch logs via Kubernetes discovery. * Add mock implementations and tests for `GetPodLogs` - Introduce `GetPodLogs` mock methods in test files for Kubernetes discovery. - Add unit tests for `handleGetPodLogs` to verify functionality with various scenarios. * Add pod and resource discovery methods to `KubernetesDiscoveryAdapter` - Introduces `ListPods`, `GetPod`, and `GetEndpoints` for Kubernetes resource discovery. - Implements `GetEvents` to fetch Kubernetes events with customizable options. - Adds helper functions for pod conversion and formatting. * Add pod and event management tools to `KubernetesDiscoveryHTTP` - Implements `ListPods`, `GetPod`, `GetEvents`, and `GetEndpoints` methods for pod, event, and endpoint discovery. - Registers `list_pods`, `get_pod`, `get_events`, and `get_endpoints` MCP tools to provide detailed resource and event diagnostics for Kubernetes namespaces. - Adds supporting types like `ListPodsOptions`, `GetEventsOptions`, `K8sPod`, and `K8sEndpoints` for better resource representation and filtering. * Add mock implementations for pod and resource discovery methods - Adds `ListPods`, `GetPod`, `GetEvents`, and `GetEndpoints` mocks to support KubernetesDiscovery testing. - Updates test files to include mock resource discovery for enhanced coverage. * Handle errors when closing log stream and refactor log line processing logic * Add FOSSA configuration file for dependency analysis and license compliance * Add tests for new MCP tools and adapter functions - Add tests for handleListPods, handleGetPod, handleGetEvents, handleGetEndpoints - Add tests for handleListContexts, handleGetAnalysis, handleGetQuickStatus, handleGetHistory - Add tests for splitLogLines and formatDuration helper functions - Add tests for KubernetesDiscoveryAdapter pod/event/endpoint methods with nil manager This improves patch coverage from 59.8% to 65.2% for fwdmcp package. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix FOSSA configuration format to use targets section Update .fossa.yml to use the correct v3 format: - Use 'targets: only:' instead of 'analyze: types:' - Specify 'type: go' to analyze only Go modules - This should exclude Python/pip documentation dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5622aeb commit fc0c161

File tree

11 files changed

+1977
-1
lines changed

11 files changed

+1977
-1
lines changed

.fossa.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# FOSSA configuration for kubefwd
2+
# See: https://github.com/fossas/fossa-cli/blob/master/docs/references/files/fossa-yml.md
3+
4+
version: 3
5+
6+
project:
7+
id: github.com/txn2/kubefwd
8+
name: kubefwd
9+
team: txn2
10+
policy: default
11+
12+
# Analyze only Go modules (the actual distributed software)
13+
# Exclude documentation build tooling (Python/pip dependencies)
14+
targets:
15+
only:
16+
- type: go
17+
18+
# Exclude paths that contain non-source dependencies
19+
paths:
20+
exclude:
21+
# Documentation build dependencies (MkDocs, Pygments, etc.)
22+
- .github/requirements-docs.txt
23+
- docs/
24+
# Test fixtures and scripts
25+
- test/scripts/
26+
- test/manifests/
27+
# Build artifacts
28+
- dist/
29+
- mcpb/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
[![codecov](https://codecov.io/gh/txn2/kubefwd/branch/master/graph/badge.svg)](https://codecov.io/gh/txn2/kubefwd)
88
[![Go Report Card](https://goreportcard.com/badge/github.com/txn2/kubefwd)](https://goreportcard.com/report/github.com/txn2/kubefwd)
99
[![GitHub release](https://img.shields.io/github/release/txn2/kubefwd.svg)](https://github.com/txn2/kubefwd/releases)
10-
[![Docker Pulls](https://img.shields.io/docker/pulls/txn2/kubefwd)](https://hub.docker.com/r/txn2/kubefwd)
1110
[![GitHub Downloads](https://img.shields.io/github/downloads/txn2/kubefwd/total)](https://github.com/txn2/kubefwd/releases)
11+
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/txn2/kubefwd/badge)](https://scorecard.dev/viewer/?uri=github.com/txn2/kubefwd)
12+
1213

1314
**[Documentation](https://kubefwd.com)** | **[Getting Started](https://kubefwd.com/getting-started/)** | **[TUI Guide](https://kubefwd.com/tui-guide/)** | **[API Reference](https://kubefwd.com/api-reference/)** | **[MCP (AI Integration)](https://kubefwd.com/mcp-integration/)**
1415

0 commit comments

Comments
 (0)