elastic-mcp: Instructions file for Claude Code

CLAUDE.md

elastic-mcp CLAUDE.md is an instructions file for Claude Code from csimi/elastic-mcp. It costs 1,210 tokens per session, scanned A, original, ISC.

A set of Claude Code instructions for an Elasticsearch MCP server. Elasticsearch is a search and analytics database, and MCP lets an AI assistant call the server's tools; the server is read-only by default with optional write tools.

In plain words
What is it for?
For developing or maintaining Elasticsearch search, index, document, and related MCP tools, then running the project's checks.
Why use it?
It tells coding agents how the JavaScript project is organized and which type-checking, testing, startup, and configuration rules to follow.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is csimi/elastic-mcp's own configuration. It tells Claude Code how to work on elastic-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything elastic-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to csimi/elastic-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/csimi/elastic-mcp/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/csimi/elastic-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for elastic-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/csimi/elastic-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/csimi/elastic-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/csimi/elastic-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/csimi/elastic-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for elastic-mcp CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/csimi/elastic-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/csimi/elastic-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,210 This file is loaded in full into every session.
When invoked 1,210 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01210 $0.01210
Opus 5.5 $0.00484 $0.00484
Sonnet 5.5 $0.00242 $0.00242
Haiku 4.5 $0.00121 $0.00121

Measured 2mo ago against content hash 2662df5ee46b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

elastic-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

Guidance for AI assistants (and humans) working in this repository.

This project was vibe coded. It is typechecked and unit-tested; keep both green on every change.

What this is

A Model Context Protocol (MCP) server for Elasticsearch, over the stdio transport. Read-only by default, with optional write tools. Written in JavaScript with JSDoc types checked by TypeScript (@ts-check / checkJs) — there is no build step; the .js files in src/ are what runs.

Commands

npm run typecheck   # tsc --noEmit (must pass)
npm test            # node --test (must pass)
npm start           # node src/index.js (needs ELASTICSEARCH_URL)

Project layout

src/
  index.js        entry point; resolves version, builds client + server, wires stdio
  server.js       builds the MCP server and registers tool groups
  es-client.js    config parsing, version probe/selection, client construction
  connection.js   base-path-aware UndiciConnection subclass (factory)
  util.js         tool-result + error helpers (jsonResult, errorResult, toToolResult, isAuthorizationError)
  tools/
    search.js     search, count, esql, get_document
    indices.js    list_indices, get_mapping, get_settings, get_aliases, list_shards
    cluster.js    cluster_health, cluster_stats, cluster_info, list_nodes
    kibana.js     get_kibana_object
    write.js      index_document, update_document, delete_document, create_index, delete_index
test/
  config.test.js  readConfig / splitOriginAndPrefix
  util.test.js    tool-result helpers
  server.test.js  end-to-end tool routing against a fake Elasticsearch HTTP server

Architecture notes

  • Base path support (connection.js): the official client routes requests against the node origin only and drops any URL path. createPrefixedConnection(UndiciConnectionBase, prefix) returns a subclass that re-prepends the prefix to every request. The base class is passed in so each client major subclasses its own bundled UndiciConnection.
  • Dual 8.x / 9.x support (es-client.js): the v9 client sends compatible-with=9, which 8.x clusters reject. Both client majors are installed (@elastic/elasticsearch for v9, the elasticsearch8 alias for v8). resolveMajor() honors ELASTICSEARCH_API_VERSION, else probes the root endpoint with a plain application/json request. The probe needs cluster:monitor/main; on any failure it falls back to the v8 client, which both 8.x and 9.x accept. Cross-major type incompatibilities are bridged with casts confined to the v8 branch of createClient.
  • Privilege fallbacks (tools/indices.js): list_indices falls back from _cat/indices (needs cluster monitor) to _resolve/index, and get_mapping from getMapping (needs view_index_metadata) to _field_caps (needs only read). Each remembers the authorization failure in a closure flag for the process lifetime so it stops retrying the rejected endpoint.
  • Kibana saved objects (tools/kibana.js): get_kibana_object reads .kibana_analytics + .kibana directly (user content vs. system content), decodes the JSON-as-string fields Kibana stores inline (visState, searchSourceJSON, ...) via decodeInlineJson, and resolves each references[] entry to its title. Those are restricted system indices, so the API key needs an allow_restricted_indices read entry on .kibana*.
  • Results & errors (util.js): every tool returns through toToolResult, which serializes success with jsonResult and converts throws with errorResult. errorResult surfaces Elasticsearch ResponseError status + reason and never emits "[object Object]". Use isAuthorizationError to detect 403 / security_exception.
  • Write tools are off by default; registered only when ELASTICSEARCH_ENABLE_WRITES=true (server.js). Mutating tools carry destructiveHint annotations.

Read the full file on GitHub · 86 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 86 lines · 1,210 tokens per session scan A 2662df5ee46b

Subscribe to this mod's changes

elastic-mcp CLAUDE.md is an instructions file published in the GitHub repository csimi/elastic-mcp (1 stars, last pushed 2mo ago), licensed ISC. It adds 1,210 tokens to every session, about $0.0048 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

elastic-mcp CLAUDE.md compared with instructions from other repositories

elastic-mcp CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
elastic-mcp CLAUDE.mdcsimi/elastic-mcpInstructions file12mo agoISCA1,210Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode