Token导航 LogoToken导航TokenDH.com
Rag MCP Claude logo
搜索检索未说明官方级别未说明来源级核验

Rag MCP Claude

MCP Server

基于OpenAI Embeddings和ChromaDB的语义搜索服务,用于YouTube转录文本的语义检索。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
搜索JavaScriptClaude向量数据库Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

monthop-gmail

提供方

monthop-gmail

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

RAG MCP Claude

MCP (Model Context Protocol) Server สำหรับ Semantic Search บน YouTube transcripts ใช้ OpenAI Embeddings + ChromaDB

ต่างจาก keyword search ทั่วไป (FTS5) ที่ค้นได้เฉพาะ "คำตรงกัน" RAG ค้นหาด้วย ความหมาย ได้ เช่น ค้นว่า "วิธีฝึกจิตให้เข้มแข็ง" จะเจอข้อความเกี่ยวกับ "สมาธิ" แม้ไม่มีคำว่า "ฝึกจิต" ในข้อความเลย

ดูรายละเอียดเปรียบเทียบ RAG vs Keyword Search ที่ docs/concept-comparison.md

Features

  • rag_search - ค้นหาด้วย semantic similarity (ความหมายใกล้เคียง)
  • rag_ingest - นำ transcript / text เข้า knowledge base
  • rag_list_collections - แสดง collections พร้อมสถิติ
  • rag_delete - ลบข้อมูลออกจาก knowledge base

Architecture

                         rag-mcp-claude
                         Port: 3020
┌──────────────────────────────────────────────────┐
│                                                  │
│  ┌──────────┐    ┌─────────────┐                 │
│  │  Ingest   │───▶│ Text Splitter│                 │
│  │  Pipeline │    │ (chunk 500   │                 │
│  └──────────┘    │  overlap 50) │                 │
│                   └──────┬──────┘                 │
│                          ▼                        │
│                  ┌───────────────┐                │
│                  │ OpenAI API     │                │
│                  │ text-embedding │                │
│    ┌──────┐      │ -3-small       │                │
│    │Search│─────▶│ (1536 dims)   │                │
│    └──────┘      └───────┬───────┘                │
│                          ▼                        │
│                  ┌───────────────┐                │
│                  │  ChromaDB      │                │
│                  │  Vector Store  │                │
│                  │  (cosine sim)  │                │
│                  └───────────────┘                │
│                                                  │
└──────────────────────────────────────────────────┘

Quick Start

1. สร้าง OpenAI API Key

ไปที่ https://platform.openai.com/api-keys แล้วสร้าง key

2. สร้าง .env

cp .env.example .env
# แก้ไข .env ใส่ API key
OPENAI_API_KEY=sk-your-api-key-here

3. Deploy ด้วย Docker

docker compose up -d

จะ start 2 containers:

  • rag-chromadb - Vector database (port 8100)
  • rag-mcp-claude - MCP server (port 3020)

4. ตรวจสอบ

curl http://localhost:3020/health

5. Ingest transcript ตัวอย่าง

# Ingest ทุกไฟล์ใน data/sources/
node src/cli-ingest.js --dir ./data/sources

# Ingest ไฟล์เดียว
node src/cli-ingest.js data/sources/SF6Tskjx6Qw.md
ดูคู่มือ ingest ละเอียดที่ docs/guide-ingest.md

MCP Client Configuration

เพิ่มใน .mcp.json หรือ Claude Desktop config:

{
  "mcpServers": {
    "rag": {
      "url": "http://localhost:3020/mcp"
    }
  }
}

Project Structure

rag-mcp-claude/
├── src/
│   ├── server-sse.js    # Streamable HTTP transport server (port 3020)
│   ├── index.js         # Stdio transport server
│   ├── config.js        # Configuration
│   ├── embeddings.js    # OpenAI embedding API wrapper
│   ├── vectorstore.js   # ChromaDB operations (CRUD)
│   ├── ingest.js        # Chunk → Embed → Store pipeline
│   ├── search.js        # Semantic search
│   └── cli-ingest.js    # CLI batch ingest tool
├── data/
│   └── sources/         # Transcript files (.md)
├── docs/
│   ├── concept-comparison.md  # RAG vs FTS5 comparison
│   ├── guide-ingest.md        # คู่มือ ingest ข้อมูล
│   ├── guide-search.md        # คู่มือ search
│   └── guide-openai-key.md    # คู่มือสร้าง OpenAI API Key
├── Dockerfile
├── docker-compose.yml
├── .env.example
└── package.json

API Endpoints

EndpointMethodDescription
/mcpPOSTMCP message endpoint (Streamable HTTP)
/mcpGETSSE stream endpoint
/mcpDELETESession termination
/healthGETHealth check + status

MCP Tools Reference

rag_search

ค้นหาจาก knowledge base ด้วย semantic search

ParameterTypeRequiredDefaultDescription
querystringYes-คำค้นหา (ภาษาธรรมชาติ)
collectionstringNoyoutube_transcriptsชื่อ collection
top_knumberNo5จำนวนผลลัพธ์ (max 20)

Response:

{
  "query": "สมาธิเปลี่ยนสมองได้อย่างไร",
  "collection": "youtube_transcripts",
  "totalResults": 3,
  "sources": [
    {
      "source": "SF6Tskjx6Qw",
      "title": "Ep0 - Journey Within: สำรวจโลกในหัวคุณ",
      "url": "https://www.youtube.com/watch?v=SF6Tskjx6Qw",
      "channel": "The Mind Architect",
      "chunks": [
        {
          "text": "สมาธิทำให้สมองส่วน Prefrontal Cortex หนาขึ้น...",
          "score": 0.892,
          "chunk_index": 3
        }
      ]
    }
  ]
}

rag_ingest

นำข้อมูลเข้า knowledge base

ParameterTypeRequiredDescription
file_pathstringNo*Path ของ transcript markdown file (.md)
textstringNo*ข้อความที่จะ ingest โดยตรง
sourcestringNoชื่อแหล่งข้อมูล (เช่น video ID)
titlestringNoชื่อเรื่อง
collectionstringNoชื่อ collection

*ต้องระบุอย่างน้อย file_path หรือ text

rag_list_collections

แสดง collections ทั้งหมดพร้อมจำนวน documents

Response:

{
  "total": 1,
  "collections": [
    { "name": "youtube_transcripts", "count": 45 }
  ]
}

rag_delete

ลบข้อมูลออกจาก knowledge base

ParameterTypeRequiredDescription
collectionstringYesชื่อ collection
sourcestringNoลบ documents จาก source นี้
delete_collectionbooleanNoลบทั้ง collection

Environment Variables

VariableDefaultDescription
PORT3020Server port
HOST0.0.0.0Server host
OPENAI_API_KEY(required)OpenAI API key
EMBEDDING_MODELtext-embedding-3-smallOpenAI embedding model
CHROMA_URLhttp://localhost:8100ChromaDB URL
CHROMA_COLLECTIONyoutube_transcriptsDefault collection name
CHUNK_SIZE500Tokens per chunk
CHUNK_OVERLAP50Overlap tokens between chunks
DEFAULT_TOP_K5Default search results

Docker Details

ContainerImagePortDescription
rag-mcp-claudenode:22-slim (custom)3020MCP server (Streamable HTTP)
rag-chromadbchromadb/chroma:latest8100Vector database
  • ChromaDB data persisted in Docker volume chroma-data
  • RAG server ใช้ network_mode: host เพื่อเข้าถึง ChromaDB
  • OpenAI API Key ส่งผ่าน .env file

Data Flow

YouTube Video
     │  (youtube-mcp-claude ดึง transcript)
     ▼
data/sources/*.md        ← Transcript files
     │
     ▼ (rag_ingest / cli-ingest.js)
┌────────────────┐
│ 1. Parse        │  แยก metadata + transcript text
│ 2. Chunk        │  ตัดเป็นท่อนๆ (500 tokens, overlap 50)
│ 3. Embed        │  OpenAI API → vector [1536 dims]
│ 4. Store        │  ChromaDB (cosine similarity index)
└────────────────┘
     │
     ▼ (rag_search)
┌────────────────┐
│ 1. Embed query  │  แปลงคำถามเป็น vector
│ 2. Search       │  หา vectors ที่ใกล้เคียงที่สุด
│ 3. Return       │  ส่งกลับ chunks + metadata + score
└────────────────┘

Cost Estimation (OpenAI)

ModelPrice1 transcript (~10K tokens)1 search query
text-embedding-3-small$0.02 / 1M tokens~$0.0002 (< 1 สตางค์)~$0.000002
text-embedding-3-large$0.13 / 1M tokens~$0.0013~$0.000013

ใช้ text-embedding-3-small ราคาถูกมาก ingest transcript 1,000 วิดีโอ ≈ $0.20 (7 บาท)

Related Projects

ServerPortDescription
youtube-mcp-claude3010YouTube transcript extraction
rag-mcp-claude3020RAG semantic search
chat-mcp-claude3001Chat history (FTS5)
thudong-mcp-claude3002Survey analysis (FTS5)

Documentation

目录标签

目录标签

搜索JavaScriptClaude向量数据库语义搜索本地部署OpenAIChromaDB文本检索

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

api-key

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明api-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP