Pinecone MCP Server for RAG and Inference
Enable RAG and inference with an MCP server to search and upload records while leveraging Pinecone's Inference API for fast contextual retrieval
npx -y @sirmews/mcp-pineconeOverview
This MCP (Model Context Protocol) server provides a lightweight bridge between your application and Pinecone for fast contextual retrieval and inference-driven RAG (Retrieval-Augmented Generation) workflows. It exposes simple HTTP endpoints to upload/search records (vectors + metadata) in Pinecone and to leverage Pinecone’s Inference API to generate context-aware responses or to produce embeddings when needed.
The server is useful when you want a minimal, developer-friendly service that implements the common MCP pattern: store documents in a vector database, retrieve relevant context for a user query, and run a model against that context. It removes boilerplate for integrating Pinecone’s vector index and Inference API so you can focus on prompt logic and application-level behavior.
Features
- Upload and upsert records (id, text, metadata, vector) into a Pinecone index
- Query/semantic search over stored records with top-K results
- Optional embedding generation to populate vectors before upsert
- Proxy/invoke Pinecone Inference API for generative or embedding models
- Simple HTTP API adhering to common MCP patterns, suitable for RAG pipelines
- Configurable by environment variables; runs locally or in containers
Installation / Configuration
Clone, install dependencies, and run:
# Clone the repo
# Install (Node.js example)
# Run locally
Or use Docker:
# Build and run container
Required environment variables:
| Variable | Description |
|---|---|
| PINECONE_API_KEY | Your Pinecone API key |
| PINECONE_ENVIRONMENT | Pinecone environment name (region) |
| PINECONE_INDEX | Name of the Pinecone vector index to use |
| PORT | Port for the MCP server (default 8080) |
| MODEL | (Optional) Pinecone Inference model identifier for generation/embeddings |
Example .env (local development):
PINECONE_API_KEY=xxxxxxxxxxxxxxxxxxxx
PINECONE_ENVIRONMENT=us-west1-gcp
PINECONE_INDEX=mcp-example
PORT=8080
MODEL=local/generative-model
Available Resources
Common HTTP endpoints (example; check the repo for exact route names and payload schemas):
- POST /records
- Upsert one or more records into Pinecone
- Payload: { records: [{ id, text, metadata?, vector? }] }
- POST /search
- Semantic query against the index
- Payload: { query, topK, includeMetadata? }
- Response: list of matching records with scores
- POST /inference
- Invoke Pinecone Inference API with retrieved context or prompt
- Payload: { model, prompt, maxTokens?, context? }
- GET /health
- Basic healthcheck for the MCP server
Example record schema:
Use Cases
RAG for customer support
- Upload product manuals and support articles as records.
- A user asks a question; call /search with the question text to retrieve the top-K relevant passages.
- Send the retrieved passages as
contextto /inference together with a prompt template. The Inference API generates a concise, context-grounded response.
Document search with fallback embedding generation
- If a record lacks vectors, the server can call Pinecone’s embedding model (via Inference API) to compute embeddings before upsert.
- This enables bulk ingestion where only raw text is provided.
Semantic filtering and metadata-aware retrieval
- Use metadata fields (e.g., language, version, source) to filter or re-rank search results returned by /search.
- Combine with prompt engineering in /inference to produce answers constrained to the desired subset.
Concrete examples
Upload a record:
Search and generate an answer:
# Step 1: semantic search
|
# Step 2: call inference with retrieved context
Notes and Next Steps
- Inspect the repository for configuration hooks, middleware, and exact request/response formats.
- Secure your deployment: restrict access to the MCP server, rotate keys, and enable logging/monitoring.
- The server is intentionally minimal to be extended: add authentication, batching, or custom prompt templates to fit your RAG pipeline.