Описание
Simple MCP RAG server using @modelcontextprotocol/sdk
README
MCP (Model Context Protocol) server for RAG (Retrieval-Augmented Generation) using Pinecone, OpenAI-compatible embedding APIs, and the official MCP SDK. Save documents and search by semantic similarity via MCP tools.
Add to MCP clients
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"rag": {
"command": "npx",
"args": ["-y", "@laskarks/mcp-rag-node"],
"env": {
"APIKEY": "sk-...",
"EMBEDDING_MODEL": "text-embedding-3-small",
"RAG_CHUNK_MAX_TOKENS": 1536,
"PINECONE_API_KEY": "...",
"PINECONE_INDEX": "rag-index",
"PROVIDER": "openai | openrouter"
}
}
}
}
Cursor (.cursor/mcp.json or MCP settings):
{
"mcpServers": {
"rag": {
"command": "npx",
"args": ["-y", "@laskarks/mcp-rag-node"],
"env": {
"APIKEY": "sk-...",
"EMBEDDING_MODEL": "text-embedding-3-small",
"RAG_CHUNK_MAX_TOKENS": 1536,
"PINECONE_API_KEY": "...",
"PINECONE_INDEX": "rag-index",
"PROVIDER": "openai | openrouter"
}
}
}
}
Tools
| Tool | Description |
|---|---|
save_to_rag |
Chunk text, create embeddings, and save to Pinecone. |
search_document_on_rag |
Search documents by keyword using semantic similarity. |
Installation
npm i @laskarks/mcp-rag-node
Environment Variables
Required
| Variable | Description | Example |
|---|---|---|
APIKEY |
OpenAI or OpenRouter API key for embeddings | sk-... |
EMBEDDING_MODEL |
Embedding model ID | text-embedding-3-small, openai/text-embedding-3-small |
PINECONE_API_KEY |
Pinecone API key | ... |
PINECONE_INDEX |
Pinecone index name (dimension must match embedding model) | rag-index |
PROVIDER |
AI provider (allowed values: openai, openrouter) |
openai or openrouter |
Important: Create your Pinecone index with the same dimension as your embedding model.
Embedding models and vector dimensions
Use the Dimension column when creating your Pinecone index.
| Model | Dimension | Provider |
|---|---|---|
text-embedding-3-small |
1536 | OpenAI, OpenRouter |
text-embedding-3-large |
3072 | OpenAI, OpenRouter |
text-embedding-ada-002 |
1536 | OpenAI, OpenRouter |
text-embedding-3-small (with dimensions param) |
512–1536 | OpenAI |
voyage-3 |
1024 | Voyage (via OpenRouter) |
nomic-embed-text-v1.5 |
768 | Nomic (via OpenRouter) |
mistral-embed |
1024 | Mistral (via OpenRouter) |
cohere/embed-english-v3.0 |
1024 | Cohere (via OpenRouter) |
For OpenRouter, use the model ID format, e.g. openai/text-embedding-3-small or voyage/voyage-3.
Optional
| Variable | Description | Default |
|---|---|---|
RAG_CHUNK_MAX_TOKENS |
Max tokens per chunk before embedding | 1536 |
RAG_CHUNK_OVERLAP |
Overlap tokens between chunks | 50 |
Usage
Run the server
npm run build
npm start
Or with env file:
# .env
APIKEY=sk-...
EMBEDDING_MODEL=text-embedding-3-small
PINECONE_API_KEY=...
PINECONE_INDEX=rag-index
PROVIDER=openai
npm start
Development
# Install dependencies
npm install
# Build
npm run build
# Run server (from compiled JS)
npm start
# Run server (dev, from TypeScript)
npm run dev
# Run sample client
npm run client
Project structure
src/
├── index.ts # MCP server entry, tools registration
├── ai.ts # AI controller (chunking, embeddings, Pinecone)
├── env.ts # Environment loading
└── client.ts # Example MCP client for testing
dist/ # Compiled output (after npm run build)
Publish to npm
Before publishing:
- Add
filestopackage.jsonto include onlydist/and docs:
"files": ["dist", "README.md"]
- Ensure
npm run buildsucceeds anddist/is committed or built on publish. - Add
binentry fornpx rag-mcp-nodejs(optional):
"bin": { "rag-mcp-nodejs": "dist/index.js" }
Note: MCP servers are usually run via node dist/index.js; a bin is optional. 4. Set a unique package name (npm may require scoped name, e.g. @yourname/rag-mcp-nodejs). 5. Add repository, homepage, and engines.node in package.json (optional but recommended).
Requirements
- Node.js >= 18
- Pinecone account
- OpenAI or OpenRouter API key
License
ISC
Установить Rag Node в Claude Desktop, Claude Code, Cursor
unyly install rag-nodeСтавит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.
Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh
Или настроить вручную
Выполни в терминале:
claude mcp add rag-node -- npx -y @laskarks/mcp-rag-nodeFAQ
Rag Node MCP бесплатный?
Да, Rag Node MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Rag Node?
Нет, Rag Node работает без API-ключей и переменных окружения.
Rag Node — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Rag Node в Claude Desktop, Claude Code или Cursor?
Открой Rag Node на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Rag Node with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
