kibana-mcp

v0.1.1
io.github.mshegolev/kibana-mcp Checked 17 hours ago Published 7 months ago

Kibana/Elasticsearch MCP — log search, aggregations, index discovery, dashboards.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

kibana_list_indices

List available Elasticsearch indices. Calls ``GET {ES_URL}/_cat/indices?format=json`` and returns a structured list of indices with health, status, document count, and storage size. Use this first to discover which index names / patterns exist before calling ``kibana_search_logs`` or ``kibana_aggregate_logs``. Examples: - Use when: "What log indices are available in Elasticsearch?" → default params, ``pattern='*'``. - Use when: The user mentions a service name but not the index. Try ``pattern='logs-myservice-*'`` to narrow down.…

ParameterTypeDescription
include_systembooleanWhether to include system/internal indices. Hidden by default: any prefix in {'.', 'kibana', 'ilm-history', 'shrink-'} — covers Kibana internals, ILM history, and shrunk index leftovers.
patternstringIndex name or pattern to filter results (e.g. 'logs-*', 'filebeat-*'). Supports Elasticsearch wildcard syntax. Default '*' lists all non-system indices.

kibana_search_logs

Search logs using Elasticsearch Query String Syntax. Wraps ``POST {ES_URL}/{index}/_search`` with a ``bool/must`` query. Returns the top matching log entries with their ``_source`` fields. When more than 20 hits are rendered in the text output, a truncation hint is appended — use the structured ``hits`` field for the full list. Examples: - Use when: "Show me the last 20 ERROR logs from the API service." → ``index='logs-*'``, ``query='level:ERROR AND service:api'``. - Use when: "Find 'connection refused' errors in the last hour." ↅ

ParameterTypeDescription
index *stringElasticsearch index name or pattern (e.g. 'logs-*', 'filebeat-2026.04.18'). Use `kibana_list_indices` to discover available indices.
query *stringElasticsearch Query String Syntax. Examples: 'level:ERROR', 'level:ERROR AND service:api', 'message:"connection refused" AND host:db*', 'status:[500 TO 599]'. Use '*' to match all documents.
sizeintegerMaximum number of log hits to return (1-500, default 20).
sort_orderstringSort order for results: 'desc' (newest first, default) or 'asc' (oldest first).
time_fieldstringName of the timestamp field. Default '@timestamp' (Logstash/Filebeat convention).
time_fromStart of the time range. ISO-8601 (e.g. '2026-04-18T00:00:00Z') or epoch-ms (e.g. '1713398400000'). Omit for unbounded start.
time_toEnd of the time range. ISO-8601 or epoch-ms. Omit for unbounded end (searches up to now).

kibana_aggregate_logs

Aggregate logs using a terms grouping and optional metric. Wraps ``POST {ES_URL}/{index}/_search`` with ``size:0`` (no hits returned) and a ``terms`` aggregation on ``group_by``. This is the efficient way to get counts, averages, or sums grouped by a field value. When more than 20 buckets are rendered in the text output, a truncation hint is appended — use the structured ``buckets`` field for the full list. Examples: - Use when: "How many logs per log level in the last hour?" → ``index='logs-*'``, ``group_by='level'``, ``time_from='202…

ParameterTypeDescription
group_by *stringField name for terms aggregation (e.g. 'level', 'service.keyword', 'http.response.status_code'). For text fields use the '.keyword' sub-field.
index *stringElasticsearch index name or pattern (e.g. 'logs-*').
metricstringAggregation metric: 'count' (default, doc_count per bucket), 'avg', 'sum', 'min', 'max' (require metric_field).
metric_fieldField to apply the metric on. Required when metric is 'avg', 'sum', 'min', or 'max'. Example: 'response_time_ms' for avg latency per service.
querystringElasticsearch Query String Syntax filter applied before aggregation. Use '*' (default) to aggregate all documents, or narrow with e.g. 'service:api'.
sizeintegerNumber of terms buckets to return (1-100, default 10).
time_fieldstringName of the timestamp field.
time_fromStart of time range. ISO-8601 or epoch-ms.
time_toEnd of time range. ISO-8601 or epoch-ms.

kibana_list_dashboards

List Kibana saved dashboards. Calls ``GET {KIBANA_URL}/api/saved_objects/_find?type=dashboard``. The ``kbn-xsrf: true`` header is always sent to satisfy Kibana's CSRF guard. Use this to discover dashboard IDs before calling ``kibana_get_dashboard``. Pagination: if ``has_more`` is ``True``, call again with ``page + 1``. Examples: - Use when: "What Kibana dashboards are available?" → default params. - Use when: "Find the infrastructure dashboard." → ``search='infrastructure'``. - Use when: "List all dashboards — page 2.…

ParameterTypeDescription
pageintegerPage number (1-based).
page_sizeintegerItems per page (1-100, default 20).
searchOptional text search in dashboard titles (case-insensitive substring match).

kibana_get_dashboard

Fetch a single Kibana dashboard with panel details. Calls ``GET {KIBANA_URL}/api/saved_objects/dashboard/{id}``. Returns the dashboard metadata and a summary of contained panels (visualisations, controls, maps, etc.). Examples: - Use when: "What panels does the 'Infrastructure Overview' dashboard have?" → obtain the ID from ``kibana_list_dashboards``, then call with ``dashboard_id=<id>``. - Use when: "Give me the description and panel count of dashboard X." → single call, no search needed if you have the ID. - Use when…

ParameterTypeDescription
dashboard_id *stringKibana dashboard UUID (e.g. 'abcd1234-5678-efgh-ijkl-mnopqrstuvwx'). Use `kibana_list_dashboards` to discover valid IDs.