mcp-server-qdrant

mcp-server-qdrant

Enables storing and retrieving text in a local vector store using Qdrant, running fully locally with no external database or API key.

Category
访问服务器

README

Agentic RAG (Tavily + Context7 + Qdrant)

What it does

A knowledge base the agent builds for itself — one of several context engineering sources an agent can draw on.

RAG — retrieval augmented generation — means giving a model relevant documents to ground its answer. The usual setup loads documents into a vector store up front. Agentic RAG turns that around: the agent builds the knowledge base itself, deciding what is worth keeping and storing it as it works.

This uses the official Qdrant MCP server. Qdrant is a vector database, and the server exposes two tools: one stores a piece of text, the other finds the most relevant stored text for a query. It runs fully locally — QDRANT_LOCAL_PATH keeps everything on disk with no separate database to run, and it embeds text with a local model, so there is no extra API key.

The agent draws on three MCP servers:

Server Transport Purpose
Tavily (tavily-mcp) stdio via npx Live web search, filtered down to tavily_search
Context7 (mcp.context7.com) streamable HTTP Current documentation for libraries, frameworks, SDKs and APIs
Qdrant (mcp-server-qdrant) stdio via uvx The local vector store the agent writes to and reads from

The script runs the two halves of RAG as two separate agents:

  1. Store — one agent with Tavily search, Context7 and Qdrant. It researches the latest on Nvidia from the web, looks up the current OpenAI Agents SDK docs through Context7, and stores the key facts from both.
  2. Retrieve — a second agent with only Qdrant, no web search and no Context7. Whatever it says, it is recalling from what the first agent stored.

Why Context7

The model's training data has a cutoff, so its memory of a fast-moving library is stale and it will confidently invent APIs that no longer exist. Context7 is a hosted MCP server that indexes library documentation and serves the current version on demand. Two tools:

  • resolve-library-id — turns a package or product name ("openai-agents", "next.js") into a Context7 library ID.
  • query-docs — fetches up-to-date documentation and code examples for that library, narrowed to your question.

The agent's instructions route anything library-shaped to Context7 rather than to memory or to a general web search — resolve the ID first, then query the docs. Because it is a plain HTTP endpoint there is nothing to install; it is wired up with MCPServerStreamableHttp instead of MCPServerStdio:

context7_params = {"url": "https://mcp.context7.com/mcp", "timeout": 60}

async with MCPServerStreamableHttp(params=context7_params, client_session_timeout_seconds=60) as docs_server:
    ...

Two timeouts are in play and they do different things. timeout inside the params is the HTTP request timeout; client_session_timeout_seconds is the MCP session read timeout, and it defaults to just 5 seconds — low enough that a slow docs fetch would fail, so it is raised to 60 here.

Setup

  1. Node 22+ (Tavily runs via npx; Qdrant runs via uvx, which uv already provides; Context7 needs nothing installed):
    • Windows (PowerShell): winget install OpenJS.NodeJS.LTS
    • Mac: brew install node
    • Linux / anything else: install via your package manager or from nodejs.org
  2. Get a free Tavily API key at tavily.com (1,000 searches/month, no credit card; starts with tvly-).
  3. Optional: get a free Context7 API key at context7.com. Context7 works anonymously — the key only raises the rate limit.
  4. Copy .env.example to .env and fill in:
    OPENAI_API_KEY=sk-...
    TAVILY_API_KEY=tvly-...
    CONTEXT7_API_KEY=          # optional, leave blank to run anonymously
    
  5. Install dependencies:
    uv sync
    
  6. Run it:
    uv run main.py
    

Notes

  • First run pauses once, sometimes for a while: the first store or search downloads Qdrant's small local embedding model. That is why the Qdrant server gets a 120s client timeout rather than 60s.
  • The vector store lives in memory/qdrant/ (collection knowledge), created relative to your working directory — run from the project folder. Delete it to start with an empty knowledge base.
  • Run the script again and step 1 adds to what is already stored rather than replacing it.
  • If CONTEXT7_API_KEY is set, it is sent as an Authorization: Bearer ... header; if it is absent the header is omitted entirely and the server is used anonymously.
  • The retrieve agent is deliberately left with Qdrant alone. Giving it Context7 too would blur the demonstration — you could no longer tell whether an answer came from the knowledge base or from a fresh docs lookup.
  • Context7 is a remote server, so unlike the other two it depends on network reachability of mcp.context7.com rather than on a local process.
  • Traces at platform.openai.com/traces.
  • Windows, paths with spaces: if npx fails to launch, use {"command": "powershell", "args": ["/c", "npx", ...]} instead.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选