The MCP server provides semantic search functionality through Elasticsearch, enabling users to search through Search Labs blog posts that have been indexed using Elastic Open Crawler.
MCP Server: Elasticsearch semantic search tool
Demo repo for: https://j.blaszyk.me/tech-blog/mcp-server-elasticsearch-semantic-search/
Table of Contents
Related MCP server: Elasticsearch 7.x MCP Server
Overview
This repository provides a Python implementation of an MCP server for semantic search through Search Labs blog posts indexed in Elasticsearch.
It assumes you've crawled the blog posts and stored them in the search-labs-posts index using Elastic Open Crawler.
Running the MCP Server
Add ES_URL and ES_AP_KEY into .env file, (take a look here for generating api key with minimum permissions)
Start the server in MCP Inspector:
Once running, access the MCP Inspector at: http://localhost:5173
Integrating with Claude Desktop
To add the MCP server to Claude Desktop:
This updates claude_desktop_config.json in your home directory. On the next restart, the Claude app will detect the server and load the declared tool.
Crawling Search Labs Blog Posts
1. Verify Crawler Setup
To check if the Elastic Open Crawler works, run:
This should print crawled content from a single page.
2. Configure Elasticsearch
Set up Elasticsearch URL and API Key.
Generate an API key with minimum crawler permissions:
Copy the encoded value from the response and set it as API_KEY.
3. Update Index Mapping for Semantic Search
Ensure the search-labs-posts index exists. If not, create it:
Update the mapping to enable semantic search:
The body field is indexed as semantic text using Elasticsearch’s ELSER model.
4. Start Crawling
Run the crawler to populate the index:
If using a fresh Elasticsearch cluster, wait for the ELSER model to start before indexing.
5. Verify Indexed Documents
Check if the documents were indexed:
This will return the total document count in the index. You can also verify in Kibana.
Done! You can now perform semantic searches on Search Labs blog posts