Exp LLM MCP RAG

Data and AI

基于 KelvinQiu802/llm-mcp-rag 的 Python 实现版本,用于学习和实践 LLM、MCP 和 RAG 技术.

Your AI app calls Exp LLM MCP RAG, which does the data and AI work and sends the result back to the chat.

About Exp LLM MCP RAG

Exp LLM MCP RAG is a community MCP server from StrayDragon, filed in our directory under data and ai. 基于 KelvinQiu802/llm-mcp-rag 的 Python 实现版本,用于学习和实践 LLM、MCP 和 RAG 技术.

At a glance

Publisher
StrayDragon (community)
Runs
See the README for setup
Written in
Python
License
MIT
GitHub stars
164

How to set up Exp LLM MCP RAG

  1. Follow the install steps in the Exp LLM MCP RAG README; it is written in Python, so have that toolchain ready.
  2. Check the Exp LLM MCP RAG README for keys or settings; the registry lists none that Exp LLM MCP RAG requires.
  3. Add Exp LLM MCP RAG to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Exp LLM MCP RAG tools to confirm the connection.
  5. Run one read-only task with Exp LLM MCP RAG first, and keep your app asking before each tool call until the results look right.

Exp LLM MCP RAG compared with similar servers

  • Compliant LLM by fiddlecube has fewer GitHub stars than Exp LLM MCP RAG (163 against 164); both are community servers, and both run locally.
  • Atlas (scaleapi) by scaleapi has more GitHub stars than Exp LLM MCP RAG (165 against 164); both are community servers, and both run locally.
  • freellmpool by 0xzr has fewer GitHub stars than Exp LLM MCP RAG (161 against 164); both are community servers, and both run locally.

Before you connect Exp LLM MCP RAG

  • Give Exp LLM MCP RAG its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Exp LLM MCP RAG tool call until you trust what it does with them.
  • Treat text that Exp LLM MCP RAG fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Exp LLM MCP RAG on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Exp LLM MCP RAG

How marketing and sales teams put Exp LLM MCP RAG to work, by company size. Pick the size closest to yours and start Exp LLM MCP RAG on one use case.

Small business

  • A small team can use Exp LLM MCP RAG to clean and enrich a lead list or a spreadsheet in one pass, instead of hours of copy and paste.
  • Owners can ask Exp LLM MCP RAG to sort feedback, reviews or survey answers into themes and see what customers mention most.
  • Exp LLM MCP RAG runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing ops can connect Exp LLM MCP RAG to enrich and score inbound leads, so sales sees fit and intent before the first call.
  • Content and research teams can use Exp LLM MCP RAG to analyze transcripts and surveys at scale and pull the quotes worth using.
  • Start Exp LLM MCP RAG on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises can run Exp LLM MCP RAG inside their own cloud and data boundary, so models and data stay where governance requires.
  • Large teams can use Exp LLM MCP RAG in batch pipelines with evaluation and logging, so AI output is measured before it reaches customers.
  • Exp LLM MCP RAG is a community server, so have security review the code and pin a version before Exp LLM MCP RAG touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Exp LLM MCP RAG README

From StrayDragon/exp-llm-mcp-rag on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

LLM-MCP-RAG 实验项目

本项目是基于 KelvinQiu802/llm-mcp-rag 的 Python 实现版本,用于学习和实践 LLM、MCP 和 RAG 技术。

该项目作者有演示视频 见 https://www.bilibili.com/video/BV1dcRqYuECf/

强烈建议先浏览其README, 本仓库对一些逻辑进行了微调和命名调整!

项目简介

本项目是一个基于大语言模型(LLM)、模型上下文协议(MCP)和检索增强生成(RAG)的实验性项目。它展示了如何构建一个能够与外部工具交互并利用检索增强生成技术的 AI 助手系统。

核心功能
  • 基于 OpenAI API 的大语言模型调用
  • 通过 MCP(Model Context Protocol)实现 LLM 与外部工具的交互
  • 实现基于向量检索的 RAG(检索增强生成)系统
  • 支持文件系统操作和网页内容获取

系统架构

graph TD
    A[用户] -->|提问| B[Agent]
    B -->|调用| C[LLM]
    C -->|生成回答/工具调用| B
    B -->|工具调用| D[MCP 客户端]
    D -->|执行| E[MCP 服务器]
    E -->|文件系统操作| F[文件系统]
    E -->|网页获取| G[网页内容]
    H[文档/知识库] -->|嵌入| I[向量存储-内存形式]
    B -->|查询| I
    I -->|相关上下文| B

主要组件

classDiagram
    class Agent {
        +mcp_clients: list[MCPClient]
        +model: str
        +llm: AsyncChatOpenAI
        +system_prompt: str
        +context: str
        +init()
        +cleanup()
        +invoke(prompt: str)
    }

    class MCPClient {
        +name: str
        +command: str
        +args: list[str]
        +version: str
        +init()
        +cleanup()
        +get_tools()
        +call_tool(name: str, params: dict)
    }

    class AsyncChatOpenAI {
        +model: str
        +messages: list
        +tools: list[Tool]
        +system_prompt: str
        +context: str
        +chat(prompt: str, print_llm_output: bool)
        +get_tools_definition()
        +append_tool_result(tool_call_id: str, tool_output: str)
    }

    class EembeddingRetriever {
        +embedding_model: str
        +vector_store: VectorStore
        +embed_query(query: str)
        +embed_documents(document: str)
        +retrieve(query: str, top_k: int)
    }

    class VectorStore {
        +items: list[VectorStoreItem]
        +add(item: VectorStoreItem)
        +search(query_embedding: list[float], top_k: int)
    }

    class ALogger {
        +prefix: str
        +title(text: str, rule_style: str)
    }

    Agent --> MCPClient
    Agent --> AsyncChatOpenAI
    Agent ..> EembeddingRetriever
    EembeddingRetriever --> VectorStore
    Agent ..> ALogger
    AsyncChatOpenAI ..> ALogger

快速开始

环境准备
  1. 确保已安装 Python 3.12 或更高版本
  2. 克隆本仓库
  3. 复制 .env.example 为 .env 并填写必要的配置信息:
    • OPENAI_API_KEY: OpenAI API 密钥
    • OPENAI_BASE_URL: OpenAI API 基础 URL, 注意要保留后面的'/v1' (默认为 'https://api.openai.com/v1')
    • DEFAULT_MODEL_NAME: (可选) 默认使用的模型名称(默认为 "gpt-4o-mini")
    • EMBEDDING_KEY: (可选) 嵌入模型 API 密钥(默认为 $OPENAI_API_KEY)
    • EMBEDDING_BASE_URL: (可选) 嵌入模型 API 基础 URL, 如硅基流动的API或兼容OpenAI格式的API (默认为 $OPENAI_BASE_URL)
    • USE_CN_MIRROR: (可选) 是否使用中国镜像, 设置任意值(如'1')为 true (默认为 false)
    • PROXY_URL: (可选) 代理 URL (如 "http(s)://xxx"), 用于 fetch (mcp-tool) 走代理
安装依赖
# 使用 uv 安装依赖
uv sync
运行示例

本项目使用 just 命令工具来运行不同的示例:

# 查看可用命令
just help

RAG 示例流程

sequenceDiagram
    participant User as 用户
    participant Agent as Agent
    participant LLM as LLM
    participant ER as EmbeddingRetriever
    participant VS as VectorStore
    participant MCP as MCP客户端
    participant Logger as ALogger

    User->>Agent: 提供查询
    Agent->>Logger: 记录操作日志
    Agent->>ER: 检索相关文档
    ER->>VS: 查询向量存储
    VS-->>ER: 返回相关文档
    ER-->>Agent: 返回上下文
    Agent->>LLM: 发送查询和上下文
    LLM-->>Agent: 生成回答或工具调用
    Agent->>Logger: 记录工具调用
    Agent->>MCP: 执行工具调用
    MCP-->>Agent: 返回工具结果
    Agent->>LLM: 发送工具结果
    LLM-->>Agent: 生成最终回答
    Agent-->>User: 返回回答

项目结构

  • src/augmented/: 主要源代码目录
    • agent.py: Agent 实现,负责协调 LLM 和工具
    • chat_openai.py: OpenAI API 客户端封装
    • mcp_client.py: MCP 客户端实现
    • embedding_retriever.py: 嵌入检索器实现
    • vector_store.py: 向量存储实现
    • mcp_tools.py: MCP 工具定义
    • utils/: 工具函数
      • info.py: 项目信息和配置
      • pretty.py: 统一日志输出系统
  • rag_example.py: RAG 示例程序
  • justfile: 任务运行配置文件

学习资源

Questions about Exp LLM MCP RAG

What is the Exp LLM MCP RAG MCP server?

基于 KelvinQiu802/llm-mcp-rag 的 Python 实现版本,用于学习和实践 LLM、MCP 和 RAG 技术. Exp LLM MCP RAG is maintained by StrayDragon on GitHub at StrayDragon/exp-llm-mcp-rag, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Exp LLM MCP RAG MCP server?

Exp LLM MCP RAG doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (StrayDragon/exp-llm-mcp-rag). Like most servers, Exp LLM MCP RAG ends with a command or URL you paste into your AI app's MCP config.

Does Exp LLM MCP RAG need an API key?

The registry lists no required keys for Exp LLM MCP RAG. Check the Exp LLM MCP RAG README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Exp LLM MCP RAG an official MCP server?

No. Exp LLM MCP RAG is a community server maintained by StrayDragon. Community servers can be excellent; read the code and the open issues before you give Exp LLM MCP RAG access to company data.

What license is Exp LLM MCP RAG under?

Exp LLM MCP RAG is released under the MIT license, according to its GitHub repository. The license covers the code of Exp LLM MCP RAG; the service it connects to has its own terms.