elastic-mcp CLAUDE.md

elastic-mcp CLAUDE.md is an instructions file for coding agents 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

Install

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.

agentmods
npx agentmods add instructions/csimi/elastic-mcp/claude-md
Clone the repo
git clone --depth 1 https://github.com/csimi/elastic-mcp

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.01210 $0.01210
Opus 5 $0.00605 $0.00605
Sonnet 5 $0.00242 $0.00242
Haiku 4.5 $0.00121 $0.00121

Measured 5d ago against content hash 2662df5ee46b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

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. 5d 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 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.

Related

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,182 tokens

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).

microsoft/vscode · 6,785 tokens

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.

github/spec-kit · 7,104 tokens

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.

langchain-ai/langchain · 4,469 tokens

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).

microsoft/vscode · 5,001 tokens