Skip to content

feat(kiali): add built-in MCP prompts to the Kiali toolset#1176

Merged
manusa merged 14 commits into
containers:mainfrom
hhovsepy:issue9744
Jun 15, 2026
Merged

feat(kiali): add built-in MCP prompts to the Kiali toolset#1176
manusa merged 14 commits into
containers:mainfrom
hhovsepy:issue9744

Conversation

@hhovsepy

@hhovsepy hhovsepy commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements GetPrompts() for the Kiali toolset, providing 11 built-in MCP prompts that MCP clients (e.g., Claude Desktop, Cursor) can discover and use for common service mesh tasks
  • Adds lightweight resource listing prompts (list_applications, list_namespaces, list_services, list_workloads, list_istio_config) that call list_or_get_resources with structured analysis instructions
  • Adds advanced operational prompts (mesh_health_check, mesh_topology, traffic_topology, service_troubleshoot, trace_analysis, istio_config_review) that pre-fetch data from Kiali endpoints and construct detailed analysis guides for the AI model
  • Organizes all prompt logic under a new pkg/toolsets/kiali/prompts/ package with reusable handler patterns

Kiali PR: kiali/kiali#9768

@josunect josunect left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @hhovsepy !
I've added some comments.

Comment thread pkg/toolsets/kiali/prompts/service_troubleshoot.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/istio_config_review.go Outdated
@hhovsepy

Copy link
Copy Markdown
Contributor Author

Thank you for the suggestions Josune, all were valid, also I add missing handler for istio config list.

hhovsepy and others added 11 commits June 12, 2026 09:13
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

@josunect josunect left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Tests passed, also I've done some manual testing using the inspector:

Image

@manusa manusa changed the title Add built-in MCP prompts to the Kiali toolset feat(kiali): add built-in MCP prompts to the Kiali toolset Jun 12, 2026

@manusa manusa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the structure is clean (the listResourceHandler factory is a nice touch), the README/docs/configuration.md regenerate with no drift, and build/vet/the kiali suite all pass.

Reviewing from the kubernetes-mcp-server side — Kiali owns the toolset's deeper behavior and its own tests, so I've kept this to three things worth a look before merge:

  1. traffic-topology can fail on its default no-arg invocationget_mesh_traffic_graph marks namespaces required, but the prompt makes it optional and hard-fails when omitted.
  2. Generic prompt nameslist-namespaces / list-services / list-workloads aren't mesh-qualified; with core + kiali enabled they read like core cluster ops, and this will only get worse as core adds its own prompts.
  3. service-troubleshoot hardcodes a -v1 workload suffix — fine for bookinfo, empty logs for most real services.

Not flagging test coverage — assuming that's handled in the Kiali repo.

Comment thread pkg/toolsets/kiali/prompts/traffic_topology.go Outdated
Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
Comment thread pkg/toolsets/kiali/prompts/service_troubleshoot.go Outdated
@manusa manusa added this to the 0.1.0 milestone Jun 12, 2026
@hhovsepy

Copy link
Copy Markdown
Contributor Author

Thank you very much @manusa for the review, all points were approached.
The 1. point with namespaces, I decided to make "namespaces" required, as comma separated namespaces, or user will need to explicitly put "all" in case of all mesh namespaces, but not default all namespaces when not set.

@hhovsepy
hhovsepy requested a review from manusa June 15, 2026 10:36
@manusa

manusa commented Jun 15, 2026

Copy link
Copy Markdown
Member

Hi @hhovsepy thanks for taking care of this. Last commit wasn't signed off and we have a DCO failure.

@manusa manusa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the iterations, @hhovsepy — the prompt naming and the -v1 workload suffix from my earlier review are both sorted. josunect's threads are all resolved and the suite/docs are clean.

One thing left before this is good to go — it's the other half of my original traffic-graph comment:

mesh-topology ships with its traffic-graph section permanently empty. meshTopologyHandler calls get_mesh_traffic_graph with no namespaces, but that endpoint requires them, so the section always degrades to (data unavailable: …). traffic-topology already solves this with resolveNamespaces — same fix applies here (details inline). That's the only blocker from my side.

Non-blocking polish, take it or leave it:

  • "all mesh namespaces" in the traffic-topology arg/error/README actually means all accessible namespaces — minor wording.
  • A one-line comment on fetchKialiData to mark the soft-fail intentional (it's what hid the issue above).
  • A mesh-topology test would've caught this — worth one with the fix, though I'm leaving broader coverage to the Kiali repo.

Fix the mesh-topology graph and I'm happy to approve.

Comment thread pkg/toolsets/kiali/prompts/list_resources.go Outdated
hhovsepy added 2 commits June 15, 2026 14:24
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

@manusa manusa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hhovsepy — all my review points are addressed. mesh-topology now resolves namespaces before the traffic-graph call (with TestMeshTopologyPrompt covering it), and the wording and fetchKialiData doc comment are in too. Verified build/vet/the Kiali suite locally. LGTM.

@manusa
manusa merged commit 435877a into containers:main Jun 15, 2026
11 checks passed
anandrkskd pushed a commit to anandrkskd/openshift-mcp-server that referenced this pull request Jun 25, 2026
…s#1176)

* Added Kiali MCP prompts

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Apply suggestion from @josunect

Co-authored-by: Josune Cordoba <49480155+josunect@users.noreply.github.com>
Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Added the missing handler for Istio config list

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Update tests

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* Approached all comments

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* approached comments

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

* fixed README

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>

---------

Signed-off-by: Hayk Hovsepyan <hhovsepy@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: josunect <jcordoba@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants