Skip to main content
Glama
jedrazb

Elasticsearch Semantic Search MCP Server

by jedrazb

MCP 服务器:Elasticsearch 语义搜索工具

演示 repo: https://j.blaszyk.me/tech-blog/mcp-server-elasticsearch-semantic-search/

目录


Related MCP server: ElasticMind-MCP

概述

该存储库提供了一个 MCP 服务器的 Python 实现,用于通过Elasticsearch中索引的Search Labs 博客文章进行语义搜索

它假设您已经使用Elastic Open Crawler抓取了博客文章并将其存储在search-labs-posts索引中。


运行 MCP 服务器

ES_URLES_AP_KEY添加到.env文件中,(查看此处了解如何生成具有最低权限的 api 密钥)

MCP Inspector中启动服务器:

make dev

运行后,访问 MCP Inspector: http://localhost:5173


与 Claude Desktop 集成

要将 MCP 服务器添加到Claude Desktop

make install-claude-config

这会更新你主目录中的claude_desktop_config.json 。下次重启后,Claude 应用将检测服务器并加载声明的工具。


抓取搜索实验室博客文章

1. 验证爬虫设置

要检查Elastic Open Crawler是否工作,请运行:

docker run --rm \
  --entrypoint /bin/bash \
  -v "$(pwd)/crawler-config:/app/config" \
  --network host \
  docker.elastic.co/integrations/crawler:latest \
  -c "bin/crawler crawl config/test-crawler.yml"

这应该从单个页面打印抓取的内容。


2.配置Elasticsearch

设置Elasticsearch URL 和 API Key

生成具有最低爬虫权限的 API 密钥:

POST /_security/api_key
{
  "name": "crawler-search-labs",
  "role_descriptors": {
    "crawler-search-labs-role": {
      "cluster": ["monitor"],
      "indices": [
        {
          "names": ["search-labs-posts"],
          "privileges": ["all"]
        }
      ]
    }
  },
  "metadata": {
    "application": "crawler"
  }
}

从响应中复制encoded值并将其设置为API_KEY


3. 更新语义搜索的索引映射

确保search-labs-posts索引存在。如果不存在,请创建它:

PUT search-labs-posts

更新映射以启用语义搜索

PUT search-labs-posts/_mappings
{
  "properties": {
    "body": {
      "type": "text",
      "copy_to": "semantic_body"
    },
    "semantic_body": {
      "type": "semantic_text",
      "inference_id": ".elser-2-elasticsearch"
    }
  }
}

使用Elasticsearch 的 ELSER 模型body字段索引为语义文本


4.开始爬行

运行爬虫来填充索引:

docker run --rm \
  --entrypoint /bin/bash \
  -v "$(pwd)/crawler-config:/app/config" \
  --network host \
  docker.elastic.co/integrations/crawler:latest \
  -c "bin/crawler crawl config/elastic-search-labs-crawler.yml"

[!TIP]如果使用新的 Elasticsearch 集群,请等待ELSER 模型启动后再进行索引。


5.验证索引文档

检查文档是否已被索引:

GET search-labs-posts/_count

这将返回索引中的文档总数。您也可以在Kibana中验证。


完成!您现在可以对Search Labs 博客文章进行语义搜索了

F
license - not found
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An unofficial MCP server that provides semantic search capabilities for Hugging Face models and datasets, enabling Claude and other MCP-compatible clients to search, discover, and explore the Hugging Face ecosystem using natural language queries.
    20
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that indexes PDF documentation and text into Elasticsearch for semantic search and retrieval. It enables users to query knowledge bases, ingest new files, and dynamically update content through MCP-compatible clients like Claude Desktop and Cursor.
    4
    1
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables semantic and keyword search over Claude Code conversation history stored locally, using hybrid search, local embeddings, and time-decay scoring.
    23
    MIT

View all related MCP servers

Related MCP Connectors

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

  • MCP server giving Claude AI access to 22+ NYC public-record databases for real estate due diligence

  • Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jedrazb/elastic-semantic-search-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server