Indexsearch

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 7, 2026

Elasticsearch tools: indices, mappings, query DSL search, ES|QL, and shards.

已验证STDIO仅桌面数据库数据与分析

概览

AI 生成的概览

Elasticsearch MCP 服务器,让助手列出索引、读取字段映射、执行 query DSL 搜索与 ES|QL 查询,并查看分片信息。

可以做什么
  • 列出索引并查看集群的分片分布
  • 读取指定索引的字段映射
  • 使用 Elasticsearch query DSL 对索引执行搜索
  • 通过集群查询接口执行 ES|QL 查询
  • 返回集群解析后的 JSON 结果,非 JSON 回复保留在 raw 字段中
适用场景
适合需要探查或查询现有 Elasticsearch 集群的场景:确认有哪些索引、在写查询前了解数据结构、执行临时搜索或 ES|QL 查询,或排查分片布局。
运行要求
通过 npx 或 Docker 镜像以 stdio 在本地运行,mcp 子命令启动服务器。需要一个可访问的 Elasticsearch 集群,用 ES_URL(默认 INDEXSEARCH_URL 指定,可选 ES_API_KEY 用于认证。未声明其他账号或凭据。
安装前请注意
ES_API_KEY 会作为 Authorization 头发送,其权限取决于集群授予的范围,建议使用只读密钥。搜索与 ES|QL 查询会发往集群,可能开销较大或返回敏感索引数据。索引名仅在本地校验,服务器不限制助手可访问的索引或可执行的查询。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Indexsearch,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

indexsearch

indexsearch gives an agent — or you, at a terminal — the five core Elasticsearch tools: see which indices exist, read an index's field mappings, run a search in query DSL, run an ES|QL query, and inspect shard placement. Everything goes through the cluster's own HTTP API; there is no bundled client library and no second query language to learn.

Each tool call is first mapped to a plain HTTP request — method, path, and JSON body — and that mapping is the whole contract: GET /_cat/indices?format=json, GET /{index}/_mapping, POST /{index}/_search, POST /_query, GET /_cat/shards. Transport is an injectable fetch function, which is what the test suite drives; no live cluster is needed to verify behaviour, and no result is ever invented when a cluster is unreachable or answers with an error.

Install

bash
npx @reneturcios/indexsearch list-indices

Or run the container image:

bash
docker run -i ghcr.io/cloudcorprecords/indexsearch

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead, and pass the cluster settings as environment variables (-e ES_URL=...).

Configuration

VariableMeaningDefault
ES_URLCluster base URLhttp://localhost:9200
INDEXSEARCH_URLFallback cluster base URL when ES_URL is unset—
ES_API_KEYAPI key, sent as Authorization: ApiKey <key>unset (no auth)

CLI

bash
# List indicesindexsearch list-indices
# Read one index's field mappingsindexsearch mappings products
# Search with query DSL (a bare clause, or a full {"query": ...} body)indexsearch search products '{"match":{"name":"shoes"}}'
# Run an ES|QL queryindexsearch esql 'FROM products | SORT price DESC | LIMIT 5'
# Shard information for every index, or for oneindexsearch shardsindexsearch shards products
# Start the MCP serverindexsearch mcp
indexsearch --version

Exit codes: 0 on success, 1 when the request or the cluster fails (the error names the HTTP status or the unreachable URL), 2 for usage errors.

Index names are validated before any request is made: names carrying characters Elasticsearch forbids in index names (whitespace, /, *, ?, ", <, >, |, ,, #, :, \) are rejected locally.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/indexsearch mcp

MCP client configuration:

json
{  "mcpServers": {    "indexsearch": {      "command": "npx",      "args": ["-y", "@reneturcios/indexsearch", "mcp"],      "env": { "ES_URL": "http://localhost:9200" }    }  }}

Tools

ToolRequiredOptionalHTTP requestWhat it does
list_indices——GET /_cat/indices?format=jsonList all available indices
get_mappingsindex—GET /{index}/_mappingGet field mappings for an index
searchindex, query (object)—POST /{index}/_search with { "query": ... }Search using query DSL
esqlquery (string)—POST /_query with { "query": ... }Run an ES
get_shards—indexGET /_cat/shards[/{index}]?format=jsonGet shard information for all or specific indices

Replies are returned as the cluster's parsed JSON. A non-JSON reply is returned under a raw key rather than being dropped, and an empty reply reads as an empty object.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network, no live clusternpm run dev     # run the CLI from source via tsx

Request construction, validation, header and body assembly, error surfacing, and settings resolution are all covered by tests that drive the core through a fake fetch and assert the exact paths and bodies.

License

MIT — see LICENSE.

来源:README.md,提交 0798c6b

工具

5

list_indices

List all available Elasticsearch indices

无需输入参数。

get_mappings

Get field mappings for a specific Elasticsearch index

输入参数index必填

esql

Perform an Elasticsearch ES|QL query

输入参数query必填

get_shards

Get shard information for all or specific indices

输入参数index

版本历史

1
  1. v0.1.0最新Oct 31, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分