Cover image
Try Now
2025-04-14

将文档从网络无缝加载到Elasticsearch中,并立即允许您的LLM或AI助手进入向量搜索文档。

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

Elasticsearch Knowledge Base MCP Server

Overview

This MCP server empowers your AI Assistant to ASK, LEARN, and REMEMBER:

  • ASK: Ask questions of the gathered knowledge bases, in plain language like, "What's the best way to use local_example in ruby Rspec tests?".
  • LEARN: Obtain and index entire documentation stores (e.x. every word of every page of https://docs.pytest.org/en/stable/contents.html) from the Web, git repositories, or the local filesystem.
  • REMEMBER: Store working information, user preferences, and rules as "memories" for future reference.

Internally, the server uses a KnowledgeBaseClient protocol to abstract interactions with the knowledge base backend, allowing for potential future flexibility. The current implementation uses Elasticsearch.

This MCP Server is powered by Elasticsearch Serverless Search (Start a free trial) for inference, and vector search, and Elastic Crawler for crawling, parsing, and indexing.

Benefits

This MCP Server significantly reduces token usage of the AI Assistant by allowing it to reference specific documentation for the task at hand instead of relying on the AI model's internal knowledge. This allows the AI Assistant to one-shot complex tasks because it doesn't need to guess parameter names, types, or usage. It also allows the AI Assistant to reference documentation as needed without needing to be trained on it.

Demo

Searching Documentation

See how you can autonomously search documentation stored in a knowledge base to gather details needed for a task:

https://github.com/user-attachments/assets/64b5fee1-a983-4a92-9485-bfc54f879374

Crawling Documentation

Watch how you can identify project dependencies and automatically crawl relevant web documentation to build a knowledge base:

https://github.com/user-attachments/assets/c7226aa9-9b40-45fb-877b-8721550e0576

Configuration

To use this server, the MCP host (e.g., Roo VS Code extension, Cline, VS Code) must be configured with the connection details for the target Elasticsearch cluster, including the host URL and authentication credentials (like an API Key).

This server requires connection details for your Elasticsearch cluster and is configured directly within your MCP host's settings file (e.g., mcp_settings.json for the Roo VS Code extension).

The recommended way to run this server is using uvx, which handles fetching and running the code directly from GitHub.

VS Code

  1. Open the command palette (Ctrl+Shift+P or Cmd+Shift+P).
  2. Type "Settings" and select "Preferences: Open User Settings (JSON)".
  3. Add the following MCP Server configuration
{
    "mcp": {
        "inputs": [

            {
                "type": "promptString",
                "id": "es-host",
                "description": "Elasticsearch Host",
                "password": false
            },
            {
                "type": "promptString",
                "id": "es-api-key",
                "description": "Elasticsearch API Key",
                "password": false
            }
        ],
        "servers": {
            "External Documentation - GitHub": {
                "command": "uvx",
                "args": [
                    "git+https://github.com/strawgate/es-documentation-manager-mcp"
                ],
                "env": {
                    "ES_HOST": "${input:es-host}",
                    "ES_API_KEY": "${input:es-api-key}",
                },
            }
        }
    }
}

Cline / Roo Code

Add the following configuration block to your mcpServers object:

  "Knowledge Base": {
      "command": "uvx",
      "args": [
        "git+https://github.com/strawgate/es-knowledge-base-mcp"
      ],
      "env": {
        "ES_HOST": "https://YOUR_ELASTICSEARCH_HOST_URL:443",
        // --- Authentication: Provide EITHER API Key
        "ES_API_KEY": "YOUR_BASE64_ENCODED_API_KEY",
        // OR Username/Password
        "ES_USERNAME": "YOUR_ELASTICSEARCH_USERNAME",
        "ES_PASSWORD": "YOUR_ELASTICSEARCH_PASSWORD",
      },
      "alwaysAllow": [
        "get_documentation_types",
        "pull_crawler_image",
        "crawl_domains",
        "search_specific_documentation",
        "search_all_documentation",
        "get_document_by_url",
        "get_document_by_title"
      ],
      "disabled": false
    }

Available Tools

The knowledge-base server provides the following tools to interact with Elasticsearch knowledge bases:

Learning from Web Sources

  • from_web_documentation: Initiate a web crawl starting from a given URL (url) to gather information and store it as a new knowledge base. You need to provide a knowledge_base_name and knowledge_base_description.
  • from_web_documentation_request: Start a web crawl based on a structured request object (KnowledgeBaseProto) containing the name, source URL, and description.
  • from_web_documentation_requests: Initiate multiple web crawls simultaneously by providing a list of structured request objects (KnowledgeBaseProto).

Memory - Storing Thoughts

  • from_thought: Save a single piece of information (a "thought") with a title and body directly into the knowledge base system.
  • from_thoughts: Save multiple thoughts at once by providing a list of thought objects, each with a title and body.

Querying Knowledge

  • questions: Ask one or more questions (as a list of strings) and receive answers based on information across all available knowledge bases. You can specify the desired answer_style (concise, normal, comprehensive, exhaustive).
  • questions_for_kb: Ask one or more questions targeted at a specific knowledge base, identified by its knowledge_base_name. You can also specify the answer_style as concise, normal, or comprehensive.

Resources

  • kb://entry: Access the details (Title, Source, Description) of a specific knowledge base entry using its unique ID or assigned name.

Knowledge Base Management

  • get: Retrieve a list of all existing knowledge base entries.
  • get_by_id_or_name: Fetch details of a specific knowledge base using its unique ID or assigned name.
  • update: Modify the name, source URL, or description associated with a knowledge base entry.
  • update_name: Change only the name of a specific knowledge base entry.
  • update_description: Change only the description of a specific knowledge base entry.
  • delete: Remove a specific knowledge base entry entirely.

Contributing

For details on local development, setup, and contributing to this project, please see the Contributing Guide.

相关推荐

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • Byaidu
  • PDF科学纸翻译带有保留格式的pdf -基于ai完整保留排版的pdf文档全文双语翻译

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • modelscope
  • 开始以更轻松的方式开始构建具有LLM授权的多代理应用程序。

  • dmayboroda
  • 带有可配置容器的本地对话抹布

    Reviews

    2.8 (5)
    Avatar
    user_qK6wQaCW
    2025-04-24

    As a dedicated user of the es-knowledge-base-mcp by strawgate, I am highly impressed with its exceptional functionality. It has tremendously streamlined my workflow, making knowledge management seamless. The intuitive user interface and comprehensive database ensure quick access to information, significantly enhancing productivity. Highly recommended for anyone looking for a reliable MCP application!

    Avatar
    user_VScJbChi
    2025-04-24

    As a dedicated user of the es-knowledge-base-mcp developed by strawgate, I must say it has significantly improved my workflow efficiency. The product's intuitive design and comprehensive knowledge base offer seamless access to valuable information in my preferred language. The initial URL and welcoming message set the tone for a user-friendly experience right from the start. Overall, es-knowledge-base-mcp is an indispensable tool for anyone seeking a reliable MCP solution.

    Avatar
    user_J8kxWSHy
    2025-04-24

    The es-knowledge-base-mcp by strawgate is a fantastic tool for managing knowledge efficiently. The seamless integration and user-friendly interface have greatly enhanced my productivity. Highly recommend this for anyone looking to streamline their information management.

    Avatar
    user_17GBNnlZ
    2025-04-24

    I've been using es-knowledge-base-mcp by strawgate for a while now, and it has significantly improved my work efficiency. The product offers a comprehensive set of tools that streamline my tasks and provide valuable insights. Highly recommend it to anyone looking for a robust knowledge management solution!

    Avatar
    user_U21P0O00
    2025-04-24

    As a dedicated user of the es-knowledge-base-mcp by strawgate, I highly recommend it! It's an incredibly useful tool that has significantly improved my workflow. The interface is intuitive, making it easy to navigate and find the information I need quickly. It's clear that a lot of thought has gone into its development, and it shows in how seamlessly it integrates with other applications. If you're looking for a reliable knowledge base solution, this is the one to go for!