Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/csimi/elastic-mcp/claude-mdgit clone --depth 1 https://github.com/csimi/elastic-mcpWrote 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.
[](https://agentmods.dev/instructions/csimi/elastic-mcp/claude-md)<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="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01210 | $0.01210 |
| Opus 5 | $0.00605 | $0.00605 |
| Sonnet 5 | $0.00242 | $0.00242 |
| Haiku 4.5 | $0.00121 | $0.00121 |
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 5d 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.
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 bundledUndiciConnection. - Dual 8.x / 9.x support (
es-client.js): the v9 client sendscompatible-with=9, which 8.x clusters reject. Both client majors are installed (@elastic/elasticsearchfor v9, theelasticsearch8alias for v8).resolveMajor()honorsELASTICSEARCH_API_VERSION, else probes the root endpoint with a plainapplication/jsonrequest. The probe needscluster: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 ofcreateClient. - Privilege fallbacks (
tools/indices.js):list_indicesfalls back from_cat/indices(needs clustermonitor) to_resolve/index, andget_mappingfromgetMapping(needsview_index_metadata) to_field_caps(needs onlyread). 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_objectreads.kibana_analytics+.kibanadirectly (user content vs. system content), decodes the JSON-as-string fields Kibana stores inline (visState,searchSourceJSON, ...) viadecodeInlineJson, and resolves eachreferences[]entry to its title. Those are restricted system indices, so the API key needs anallow_restricted_indicesread entry on.kibana*. - Results & errors (
util.js): every tool returns throughtoToolResult, which serializes success withjsonResultand converts throws witherrorResult.errorResultsurfaces ElasticsearchResponseErrorstatus + reason and never emits"[object Object]". UseisAuthorizationErrorto detect 403 /security_exception. - Write tools are off by default; registered only when
ELASTICSEARCH_ENABLE_WRITES=true(server.js). Mutating tools carrydestructiveHintannotations.
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.
- 5d ago First seen · 86 lines · 1,210 tokens per session scan A 2662df5ee46b
elastic-mcp CLAUDE.md is an instructions file published in the GitHub repository csimi/elastic-mcp (1 stars, last pushed 12d ago), licensed ISC. It adds 1,210 tokens to every session, about $0.0060 per session on Opus 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.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).