Skip to content

Commit 00e1ef0

Browse files
committed
Update README.md
Following details are added to the README.md file: - Table of contents - `How to connect to the MCP Server` section is updated to use go run github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest instead of local binary - `Tools available in MCP Server` is added providing details about the tools available The generation of the `Tools available in MCP Server` section is automated and a make target is added to update the section. The package naming of the different layers are also made consistent so that the automation can pick the correct names. A github workflow is added to check if the section needs update or not. Additionaly, `both` mode is now renamed to a more intuitive `dual` mode. Assisted-by: Cursor Signed-off-by: arkadeepsen <arsen@redhat.com>
1 parent e2920ed commit 00e1ef0

File tree

26 files changed

+621
-48
lines changed

26 files changed

+621
-48
lines changed

.github/workflows/readme-tools.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: README tools check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
readme-tools:
14+
name: README tools section up to date
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: go.mod
24+
cache: false
25+
26+
- name: Update README tools section
27+
run: make update-readme-tools
28+
29+
- name: Check for changes
30+
run: |
31+
if ! git diff --exit-code README.md; then
32+
echo "::error::README.md tools section is out of date. Run 'make update-readme-tools' and commit the changes."
33+
exit 1
34+
fi

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ else
6363
echo "linter can only be run within a container since it needs a specific golangci-lint version"; exit 1
6464
endif
6565

66+
.PHONY: update-readme-tools
67+
update-readme-tools:
68+
go run ./hack/gen-readme-tools.go
69+
6670
.PHONY: lint-fix
6771
lint-fix:
6872
ifeq ($(CONTAINER_RUNNABLE), 0)

README.md

Lines changed: 145 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
11
# ovn-kubernetes-mcp
2-
Repo hosting the Model Context Protocol Server for troubleshooting OVN-Kubernetes
32

4-
## How to connect to the MCP Server
3+
Repo hosting the Model Context Protocol Server for troubleshooting OVN-Kubernetes.
54

6-
For connecting to the MCP server, the following steps are required:
5+
## Table of Contents
76

8-
```shell
9-
make build
10-
```
7+
- [Operating Modes](#operating-modes)
8+
- [How to connect to the MCP Server](#how-to-connect-to-the-mcp-server)
9+
- [Command-line options](#command-line-options)
10+
- [Live Cluster Mode](#live-cluster-mode)
11+
- [Offline Mode](#offline-mode)
12+
- [Dual Mode](#dual-mode)
13+
- [Local development](#local-development)
14+
- [Tools available in MCP Server](#tools-available-in-mcp-server)
15+
- [Live Cluster Mode](#live-cluster-mode-1)
16+
- [Offline Mode](#offline-mode-1)
17+
18+
---
1119

12-
The server supports 3 operating modes:
13-
- `live-cluster` (default): Connect to a live Kubernetes cluster for real-time debugging
14-
- `offline`: Offline troubleshooting without requiring cluster access
15-
- `both`: In this mode, tools from both `live-cluster` and `offline` modes will be available.
20+
## Operating Modes
21+
22+
| Mode | Description |
23+
|--------------------------|-------------|
24+
| `live-cluster` (default) | Connect to a live Kubernetes cluster for real-time debugging (requires kubeconfig). |
25+
| `offline` | Analyze sosreports and must-gathers without cluster access. |
26+
| `dual` | Exposes tools from dual live-cluster and offline modes (requires kubeconfig for live-cluster tools). |
27+
28+
---
29+
30+
## How to connect to the MCP Server
31+
32+
To use the MCP server, ensure you have [Go](https://go.dev/) installed with a version greater than or equal to the version specified in the `go.mod` file.
1633

1734
The server currently supports 2 transport modes: `stdio` and `http`.
1835

36+
### Command-line options
37+
38+
| Option | Default | Description |
39+
|--------|---------|-------------|
40+
| `--mode` | `live-cluster` | Server mode: `live-cluster`, `offline`, or `dual`. |
41+
| `--transport` | `stdio` | Transport: `stdio` or `http`. |
42+
| `--port` | `8080` | Port for HTTP transport. |
43+
| `--kubeconfig` | (none) | Path to kubeconfig file. Required for `live-cluster` and `dual`. |
44+
| `--pwru-image` | `docker.io/cilium/pwru:v1.0.10` | Container image for the **pwru** network tool (kernel packet tracing). |
45+
| `--tcpdump-image` | `nicolaka/netshoot:v0.13` | Container image for the **tcpdump** network tool (packet capture). |
46+
1947
### Live Cluster Mode
2048

2149
For `stdio` mode, the server can be run and connected to by using the following configuration in an MCP host (Cursor, Claude, etc.):
@@ -24,8 +52,10 @@ For `stdio` mode, the server can be run and connected to by using the following
2452
{
2553
"mcpServers": {
2654
"ovn-kubernetes": {
27-
"command": "/PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server",
55+
"command": "go",
2856
"args": [
57+
"run",
58+
"github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest",
2959
"--kubeconfig",
3060
"/PATH-TO-THE-KUBECONFIG-FILE"
3161
]
@@ -37,7 +67,7 @@ For `stdio` mode, the server can be run and connected to by using the following
3767
For `http` mode, the server should be started separately:
3868

3969
```shell
40-
./PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server --transport http --kubeconfig /PATH-TO-THE-KUBECONFIG-FILE
70+
go run github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest --transport http --kubeconfig /PATH-TO-THE-KUBECONFIG-FILE
4171
```
4272

4373
The following configuration should be used in an MCP host (Cursor, Claude, etc.) to connect to the server:
@@ -62,8 +92,13 @@ For `stdio` mode:
6292
{
6393
"mcpServers": {
6494
"ovn-kubernetes": {
65-
"command": "/PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server",
66-
"args": ["--mode", "offline"]
95+
"command": "go",
96+
"args": [
97+
"run",
98+
"github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest",
99+
"--mode",
100+
"offline"
101+
]
67102
}
68103
}
69104
}
@@ -72,25 +107,27 @@ For `stdio` mode:
72107
For `http` mode:
73108

74109
```shell
75-
./PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server --transport http --mode offline
110+
go run github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest --transport http --mode offline
76111
```
77112

78-
> NOTE: For must-gather tools to be added, availability of [`omc`](https://github.com/gmeghnag/omc) binary is mandatory. Otherwise, the must-gather tools will not be added to the MCP server. Additionally, if [`ovsdb-tool`](https://www.openvswitch.org/support/dist-docs/ovsdb-tool.1.txt) binary is not available, then some of the must-gather tools, which use `ovsdb-tool` binary, will not be added to the MCP server.
113+
> **Note:** Must-gather tools require the [`omc`](https://github.com/gmeghnag/omc) binary. Some must-gather tools also require the [`ovsdb-tool`](https://www.openvswitch.org/support/dist-docs/ovsdb-tool.1.txt) binary; if it is not available, those tools are not registered.
79114
80-
### Both Mode
115+
### Dual Mode
81116

82-
For using both [live-cluster](#live-cluster-mode) (needs kubeconfig) and [offline](#offline-mode) tools, use `--mode both`:
117+
For using dual [live-cluster](#live-cluster-mode) (needs kubeconfig) and [offline](#offline-mode) tools, use `--mode dual`:
83118

84119
For `stdio` mode:
85120

86121
```json
87122
{
88123
"mcpServers": {
89124
"ovn-kubernetes": {
90-
"command": "/PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server",
125+
"command": "go",
91126
"args": [
127+
"run",
128+
"github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest",
92129
"--mode",
93-
"both",
130+
"dual",
94131
"--kubeconfig",
95132
"/PATH-TO-THE-KUBECONFIG-FILE"
96133
]
@@ -102,5 +139,92 @@ For `stdio` mode:
102139
For `http` mode:
103140

104141
```shell
105-
./PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server --transport http --mode both --kubeconfig /PATH-TO-THE-KUBECONFIG-FILE
142+
go run github.com/ovn-kubernetes/ovn-kubernetes-mcp/cmd/ovnk-mcp-server@latest --transport http --mode dual --kubeconfig /PATH-TO-THE-KUBECONFIG-FILE
106143
```
144+
145+
### Local development
146+
147+
When developing or building locally, run `make build` and use the binary path as the command.
148+
149+
- Use `--mode <live-cluster|offline|dual>` to choose the mode.
150+
- For `live-cluster` or `dual`, add `--kubeconfig /path/to/kubeconfig`.
151+
- For `offline`, omit `--kubeconfig`.
152+
153+
**stdio:**
154+
155+
```json
156+
{
157+
"mcpServers": {
158+
"ovn-kubernetes": {
159+
"command": "/PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server",
160+
"args": [
161+
"--mode",
162+
"<live-cluster|offline|dual>",
163+
"--kubeconfig",
164+
"/PATH-TO-THE-KUBECONFIG-FILE"
165+
]
166+
}
167+
}
168+
}
169+
```
170+
171+
**http:**
172+
173+
```shell
174+
/PATH-TO-THE-LOCAL-GIT-REPO/_output/ovnk-mcp-server --transport http --mode <live-cluster|offline|dual> --kubeconfig /PATH-TO-THE-KUBECONFIG-FILE
175+
```
176+
177+
For `offline` mode, omit the `--kubeconfig` argument in dual examples above.
178+
179+
---
180+
181+
<!-- TOOLS_SECTION_START -->
182+
## Tools available in MCP Server
183+
184+
### Live Cluster Mode
185+
186+
Available when running with `--mode live-cluster` or `--mode dual` (and with a valid kubeconfig).
187+
188+
| Category | Tool | Description |
189+
|---------------|------|-------------|
190+
| **Kubernetes** | `pod-logs` | Get container logs from a pod in the Kubernetes cluster. |
191+
| | `resource-get` | Get a specific Kubernetes resource by name. |
192+
| | `resource-list` | List Kubernetes resources of a specific kind. |
193+
| **Ovn** | `ovn-show` | Display a comprehensive overview of OVN configuration from either the Northbound or Southbound database. |
194+
| | `ovn-get` | Query records from an OVN database table with flexible filtering. |
195+
| | `ovn-lflow-list` | List logical flows from the OVN Southbound database. |
196+
| | `ovn-trace` | Trace a packet through the OVN logical network. |
197+
| **Ovs** | `ovs-list-br` | List all OVS bridges on a specific pod. |
198+
| | `ovs-list-ports` | List all ports on a specific OVS bridge. |
199+
| | `ovs-list-ifaces` | List all interfaces on a specific OVS bridge. |
200+
| | `ovs-vsctl-show` | Display a comprehensive overview of OVS configuration. |
201+
| | `ovs-ofctl-dump-flows` | Dump OpenFlow flows from a specific OVS bridge. |
202+
| | `ovs-appctl-dump-conntrack` | Dump connection tracking entries from OVS datapath. |
203+
| | `ovs-appctl-ofproto-trace` | Trace a packet through the OpenFlow pipeline. |
204+
| **Kernel** | `get-conntrack` | get-conntrack allows to interact with the connection tracking system of a Kubernetes node. |
205+
| | `get-iptables` | get-iptables allows to interact with kernel to list packet filter rules. |
206+
| | `get-nft` | get-nft allows to interact with kernel to list packet filtering and classification rules. |
207+
| | `get-ip` | get-ip allows to interact with kernel to list routing, network devices, interfaces. |
208+
| **Network Tools** | `tcpdump` | Capture network packets on a node or inside a pod with strict safety controls. |
209+
| | `pwru` | Trace packets through the Linux kernel networking stack using eBPF. |
210+
211+
### Offline Mode
212+
213+
Available when running with `--mode offline` or `--mode dual`. No cluster access required.
214+
215+
| Category | Tool | Description |
216+
|----------------|------|-------------|
217+
| **Sosreport** | `sos-list-plugins` | List enabled sosreport plugins with their command counts. |
218+
| | `sos-list-commands` | List all commands collected by a specific sosreport plugin. |
219+
| | `sos-search-commands` | Search for commands across all plugins by pattern. |
220+
| | `sos-get-command` | Get command output using filepath from manifest. |
221+
| | `sos-search-pod-logs` | Search Kubernetes pod container logs. |
222+
| **Must Gather** | `must-gather-get-resource` | Get a specific Kubernetes resource from a must-gather archive. |
223+
| | `must-gather-list-resources` | List Kubernetes resources of a specific kind from a must-gather archive. |
224+
| | `must-gather-pod-logs` | Get container logs from a pod in a must-gather archive. |
225+
| | `must-gather-ovnk-info` | Get OVN-Kubernetes networking information from a must-gather archive. |
226+
| | `must-gather-list-northbound-databases` | List OVN Northbound database files available in a must-gather archive. |
227+
| | `must-gather-list-southbound-databases` | List OVN Southbound database files available in a must-gather archive. |
228+
| | `must-gather-query-database` | Query an OVN database from a must-gather archive using ovsdb-tool. |
229+
230+
<!-- TOOLS_SECTION_END -->

cmd/ovnk-mcp-server/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
kernelmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/kernel/mcp"
1515
kubernetesmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/kubernetes/mcp"
1616
mustgathermcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/must-gather/mcp"
17-
nettoolsmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/nettools/mcp"
17+
nettoolsmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/network-tools/mcp"
1818
ovnmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/ovn/mcp"
1919
ovsmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/ovs/mcp"
2020
sosreportmcp "github.com/ovn-kubernetes/ovn-kubernetes-mcp/pkg/sosreport/mcp"
@@ -84,11 +84,11 @@ func main() {
8484
setupLiveCluster(serverCfg, ovnkMcpServer)
8585
case "offline":
8686
setupOffline(ovnkMcpServer)
87-
case "both":
87+
case "dual":
8888
setupLiveCluster(serverCfg, ovnkMcpServer)
8989
setupOffline(ovnkMcpServer)
9090
default:
91-
log.Fatalf("Invalid mode: %s. Valid modes are: live-cluster, offline, both", serverCfg.Mode)
91+
log.Fatalf("Invalid mode: %s. Valid modes are: live-cluster, offline, dual", serverCfg.Mode)
9292
}
9393

9494
// Create a context that can be cancelled to shutdown the server.
@@ -143,7 +143,7 @@ func main() {
143143

144144
func parseFlags() *MCPServerConfig {
145145
cfg := &MCPServerConfig{}
146-
flag.StringVar(&cfg.Mode, "mode", "live-cluster", "Mode of debugging: live-cluster or offline or both")
146+
flag.StringVar(&cfg.Mode, "mode", "live-cluster", "Mode of debugging: live-cluster or offline or dual")
147147
flag.StringVar(&cfg.Transport, "transport", "stdio", "Transport to use: stdio or http")
148148
flag.StringVar(&cfg.Port, "port", "8080", "Port to use")
149149
flag.StringVar(&cfg.Kubernetes.Kubeconfig, "kubeconfig", "", "Path to the kubeconfig file")

0 commit comments

Comments
 (0)