npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@laskarks/mcp-rag-node

v1.1.1

Published

Simple MCP RAG server using @modelcontextprotocol/sdk

Readme

RAG MCP Server

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@latest"],
      "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@latest"],
      "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:

  1. Add files to package.json to include only dist/ and docs:
 "files": ["dist", "README.md"]
  1. Ensure npm run build succeeds and dist/ is committed or built on publish.
  2. Add bin entry for npx 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