You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: filter kubernetes-only edges in MCP handler; add claude setup hints to kedge mcp url (#137)
* fix: filter kubernetes-only edges in MCP handler; add claude setup hints to mcp url
- mcp_builder.go: skip server-type edges when resolving MCP targets —
server-type edges have no Kubernetes API, only SSH; including them
in the MCP provider would fail or return empty toolsets
- mcp.go: after printing the MCP URL, print ready-to-use 'claude mcp add'
command and Claude Desktop JSON snippet (includes bearer token from
the active kubeconfig context when available)
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: rename MCP target parameter from 'edge' to 'cluster'
'edge' is kedge-internal terminology. Users think in terms of clusters.
Renaming the query parameter to 'cluster' makes the MCP target selection
more intuitive for the broader community.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* docs: document MCP integration in README, CONTRIBUTING, and DEVELOPERS
- README: add MCP to Features list, Quickstart section with example output,
CLI reference entries for kedge mcp url
- CONTRIBUTING: add mcp packages to key packages table
- DEVELOPERS: add full MCP Integration section covering KubernetesMCP CRD,
URL structure, request flow diagram, toolsets, target parameter, and
per-edge MCP URL; update table of contents
- docs/developers.md: add MCP section for GitHub Pages site
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: update e2e tests to use 'cluster' parameter name for MCP tools/call
GetTargetParameterName() was renamed from 'edge' to 'cluster' but the
e2e test was still passing "edge": edgeName as the tools/call argument,
causing 'upstream unavailable' because the MCP server couldn't resolve
the target.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
---------
Co-authored-by: mjudeikis-bot <ai@faros.sh>
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
kedge exposes all connected Kubernetes clusters as a single [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server. AI agents (Claude, Cursor, Copilot, etc.) connect to this endpoint and can interact with all registered clusters using natural language.
231
+
232
+
### KubernetesMCP CRD
233
+
234
+
**API group:** `mcp.kedge.faros.sh/v1alpha1`
235
+
**Kind:** `KubernetesMCP`
236
+
237
+
The `KubernetesMCP` object is automatically created as `default` in every tenant workspace by the hub bootstrapper. It acts as the configuration object for the multi-cluster MCP endpoint.
238
+
239
+
```yaml
240
+
apiVersion: mcp.kedge.faros.sh/v1alpha1
241
+
kind: KubernetesMCP
242
+
metadata:
243
+
name: default
244
+
spec:
245
+
edgeSelector: {} # empty = all kubernetes-type edges; use label selectors to restrict
246
+
readOnly: false # set true to disable write operations (create/delete/apply)
│ GetDerivedKubernetes(cluster) → rest.Config via revdial tunnel
287
+
│
288
+
▼
289
+
Agent tunnel → target cluster kube-apiserver
290
+
```
291
+
292
+
### Target parameter
293
+
294
+
When an MCP client wants to target a specific cluster, it passes `?cluster=<edge-name>` as a query parameter. The parameter name is `cluster` (not `edge`) because users think in terms of clusters.
295
+
296
+
### Toolsets
297
+
298
+
The MCP server registers toolsets from `kubernetes-mcp-server` via blank imports in `mcp_builder.go`:
-**Kubernetes edge support** — proxy `kubectl` to any registered cluster via the hub
9
9
-**SSH server mode** — manage non-Kubernetes hosts (VMs, bare metal) through the same hub
10
+
-**MCP integration** — expose all connected clusters as a single [Model Context Protocol](https://modelcontextprotocol.io) server for AI agents (Claude, Cursor, etc.)
10
11
-**OIDC authentication** — plug in any OIDC provider (Dex, Auth0, Okta, …)
11
12
-**Static token auth** — quick setup for home labs and dev environments
To add to Claude Desktop (claude_desktop_config.json):
116
+
{
117
+
"mcpServers": {
118
+
"kedge": {
119
+
"url": "https://hub.example.com/...",
120
+
"headers": { "Authorization": "Bearer <token>" }
121
+
}
122
+
}
123
+
}
124
+
```
125
+
126
+
The MCP server aggregates **all connected kubernetes-type clusters** into one endpoint. AI agents can list pods, describe deployments, apply manifests, and more — across all your clusters at once.
This prints the URL and a ready-to-use `claude mcp add` command with your bearer token.
328
+
329
+
### KubernetesMCP resource
330
+
331
+
A `default``KubernetesMCP` object is auto-created in every tenant workspace. It selects which kubernetes-type edges are included via `spec.edgeSelector` (empty = all connected kubernetes edges).
332
+
333
+
### How it works
334
+
335
+
1. The hub's MCP virtual workspace handler validates the bearer token.
336
+
2. Lists all `Edge` objects in the workspace, filters to `spec.type: kubernetes` + connected + label selector.
337
+
3. Builds a `MultiEdgeKedgeEdgeProvider` that dials each edge over its revdial tunnel.
338
+
4. Passes control to `kubernetes-mcp-server` which implements the MCP protocol.
339
+
340
+
See [DEVELOPERS.md](https://github.com/faroshq/kedge/blob/main/DEVELOPERS.md#mcp-integration) for the full internals reference.
0 commit comments