Pinecone Read-Only MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Pinecone Read-Only MCP search my knowledge base for how to reset a password"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Pinecone Read-Only MCP (TypeScript)
A Model Context Protocol (MCP) server that implements the MCP specification via @modelcontextprotocol/sdk v1.29+ and provides semantic search over Pinecone vector databases using hybrid search (dense + sparse) with reranking.
Current version: 0.5.0 (npm latest after publish). Pin @0.5.0 in install and MCP config for reproducible upgrades.
Upgrading to 0.5.0
Version 0.5.0 includes breaking MCP and library changes: list_sources returns sources: { name, description? }[], PineconeClient.listNamespacesWithMetadata() returns { namespaces, warnings }, internal-only package re-exports were removed (#203), the MCP SDK floor is ^1.29.0, and hybrid leg failure with zero surviving hits is signaled under experimental.degraded / experimental.hybrid_leg_failed (#228). Legacy module facades remain deprecated but are not removed in this release. See docs/MIGRATION.md § list_sources, § listNamespacesWithMetadata, § internal re-exports (#203), and the CHANGELOG.
Related MCP server: Pinecone MCP Server
Upgrading to 0.4.0
Version 0.4.0 adds multi-source mode (PINECONE_SOURCES, list_sources, optional source on query tools) and breaking (types) branded CoreServerConfig / AllianceServerConfig — setupCoreServer and setupAllianceServer now accept only matching config/context types. See docs/MIGRATION.md, docs/MIGRATION.md § branded ServerConfig, and the CHANGELOG.
Upgrading to 0.3.0
Version 0.3.0 includes breaking MCP and library changes: experimental response fields nested under experimental, legacy module-facade deprecations, and core resolveConfig requiring an index name with suggest-flow off by default. See docs/MIGRATION.md for before/after examples and the CHANGELOG Changed section for the full list.
Upgrading from 0.1.x
Version 0.2.0 includes breaking MCP and type changes. See docs/MIGRATION.md for before/after examples and the CHANGELOG Changed section for the full list.
Release policy
While the package is 0.y.z, minor releases may include breaking changes (semver §4) — pin an exact npm version for reproducible MCP and library use. Deprecated APIs stay available for at least two minor releases before removal; breaking releases ship with CHANGELOG entries, MIGRATION.md steps, and (for publishes) structured GitHub Release notes. Full rules: docs/deprecation-policy.md.
Documentation
Doc | Description |
Index of all guides | |
Tool catalog & flows | |
Env vars, CLI flags, library config | |
Common questions | |
Deprecations & breaking changes | |
Release & deprecation policy | |
GitHub Actions, SBOM, Docker, releases | |
npm publish via GitHub Releases | |
How to contribute | |
Vulnerability reporting |
Error responses
When a tool fails, the MCP tool result sets isError: true. The text content is JSON matching ToolError (parse with toolErrorSchema from @will-cppa/pinecone-read-only-mcp).
Field | Description |
|
|
| Human-readable detail ( |
| Whether the client can plausibly fix the issue and retry ( |
| Optional hint. |
| Required when |
Success payloads are unchanged and do not wrap ToolError. Clients that still expect { "status": "error", "message": "..." } must migrate to the shape above.
For successful query, query_documents, and guided_query payloads, rerank/hybrid fidelity is described in docs/TOOLS.md (row-level reranked, top-level degraded / degradation_reason, and optional hybrid_leg_failed; query_documents propagates the same fields on its nested query payload when applicable).
Features
Hybrid Search: Combines dense and sparse embeddings for superior recall
Semantic Reranking: Uses BGE reranker model for improved precision
Dynamic Namespace Discovery: Automatically discovers available namespaces in your Pinecone index
Multi-Source (optional): Connect multiple Pinecone projects in one MCP server via
PINECONE_SOURCESor a JSON config file; uselist_sourcesand per-resultsourcetags for routingMetadata Filtering: Supports optional metadata filters for refined searches
Fast presets: Lazy initialization, connection pooling, and efficient result merging; use the
querytoolpreset=fast | detailed | fullto trade latency vs quality (no published benchmarks yet — treat descriptions as qualitative).Production-oriented defaults: Input validation, error handling, and configurable logging; upgrading from 0.1.x — see MIGRATION.md.
TypeScript Support: Full TypeScript support with type definitions
Installation
Node.js 20.12 or later is required (engines in package.json).
As a Package
npm install @will-cppa/pinecone-read-only-mcp@0.5.0Or using yarn:
yarn add @will-cppa/pinecone-read-only-mcp@0.5.0Or using pnpm:
pnpm add @will-cppa/pinecone-read-only-mcp@0.5.0Global Installation
npm install -g @will-cppa/pinecone-read-only-mcp@0.5.0From Source
git clone https://github.com/cppallance/pinecone-read-only-mcp-typescript.git
cd pinecone-read-only-mcp-typescript
npm install
npm run buildStability
This package ships as 0.y.z. Under semver §4, minor versions may contain breaking changes until 1.0.0. Pin an exact version or use ~ (tilde) ranges — not ^ (caret) — until 1.0 to avoid absorbing breaking minors automatically.
Breaking changes include: type signature changes, tool schema changes, default behavior changes, and removed exports.
See docs/deprecation-policy.md for the full deprecation window (minimum two minors before removal).
Quick start
To try the server on your own Pinecone project (free tier, no Alliance index), follow examples/quickstart/README.md: create two integrated-embedding indexes, copy examples/quickstart/.env.example, seed sample data, and run the MCP demo. Use an explicit PINECONE_INDEX_NAME in that flow rather than relying on Alliance default index names.
Architecture
The codebase is split into two layers:
src/core/— generic MCP–Pinecone bridge (PineconeClient,resolveConfig, eight MCP tools includingguided_query). Import from@will-cppa/pinecone-read-only-mcp(package root).src/alliance/— C++ Alliance app layer (suggest_query_params, Boost/Slack URL builtins). Import from@will-cppa/pinecone-read-only-mcp/allianceand usecreateServer(config)→ctx.setClient(...)→setupAllianceServer({ context: ctx })for the full tool surface (what the CLI uses); suggest-flow gate on by default. See docs/CONFIGURATION.md for core vs Alliance defaults and Library embedding below.
Configuration
You need a Pinecone API key. Index (PINECONE_INDEX_NAME or --index-name) is required for core/library use; the published CLI defaults to rag-hybrid when unset (Alliance deployment). Sparse index defaults to {index}-sparse. Rerank: set PINECONE_RERANK_MODEL to enable; the CLI defaults to bge-reranker-v2-m3 when unset. See docs/CONFIGURATION.md (core vs Alliance table).
Multiple projects: set PINECONE_SOURCES or PINECONE_CONFIG_FILE instead of a single PINECONE_API_KEY — see Multi-source mode.
Quick reference (published CLI / Alliance — core embedders require index, no index/rerank defaults):
Variable | Required | Default (Alliance CLI) |
| Yes (for live Pinecone) | — |
| No (CLI) / Yes (core) |
|
| No |
|
| No |
|
| No |
|
| No |
|
Run pinecone-read-only-mcp --help for CLI equivalents (--cache-ttl-seconds, --request-timeout-ms, --disable-suggest-flow, etc.).
Deployment model
Each ServerContext owns its own suggest-flow gate, namespaces cache, URL generator registry, and config. Stdio MCP (one client per Node process) typically uses one context. For multi-tenant HTTP embedding, create one ServerContext per session and pass it explicitly to setupAllianceServer({ context: ctx }) or setupCoreServer({ context: ctx }).
Pass config at setup only when the context is not yet configured; after createServer + setClient, pass { context: ctx } only.
Module-level singleton facades (setPineconeClient, registerUrlGenerator, getDefaultServerContext, etc.) are deprecated — they delegate to a process-default context when you omit context at setup. Prefer explicit ServerContext per Library embedding. See docs/deprecation-policy.md.
Library embedding
Recommended (instance-first): create a ServerContext, inject the client, and pass it to setup:
Generic bridge only:
import { createServer, setupCoreServer, teardownServer, ... } from '@will-cppa/pinecone-read-only-mcp'Full Alliance surface (CLI parity):
import { setupAllianceServer, resolveAllianceConfig } from '@will-cppa/pinecone-read-only-mcp/alliance'
const config = resolveAllianceConfig({ apiKey: '...' });
const ctx = createServer(config);
ctx.setClient(
new PineconeClient({
/* ... */
})
);
const server = await setupAllianceServer({ context: ctx });Use await using server = await setupAllianceServer({ context: ctx }) for automatic teardown, or call ctx.teardown() when done.
For the generic bridge only, see examples/quickstart/mcp-demo.ts. For the full Alliance surface, see examples/alliance/library-embedding-demo.ts and docs/TOOLS.md.
Legacy (deprecated)
Process-default / facade-based setup remains available during the deprecation window (removal per deprecation-policy.md — two minors after the deprecation minor):
import { PineconeClient, setPineconeClient } from '@will-cppa/pinecone-read-only-mcp';
import {
resolveAllianceConfig,
setupAllianceServer,
} from '@will-cppa/pinecone-read-only-mcp/alliance';
setPineconeClient(
new PineconeClient({
/* ... */
})
);
const server = await setupAllianceServer(resolveAllianceConfig({ apiKey: '...' }));
// Call teardownServer() before re-initializing the process-default context.Do not use this pattern for new code or multi-tenant embedding. See docs/MIGRATION.md.
Custom URL generators
Namespaces other than mailing and slack-Cpplang (or different URL rules for any namespace) can use programmatic registration — no fork required.
Register additional namespaces on your ServerContext before tools that emit URLs run. Built-in mailing / slack-Cpplang generators are installed by setupAllianceServer (not by setupCoreServer).
import {
createServer,
PineconeClient,
type UrlGenerationResult,
type UrlGeneratorFn,
} from '@will-cppa/pinecone-read-only-mcp';
import {
resolveAllianceConfig,
setupAllianceServer,
} from '@will-cppa/pinecone-read-only-mcp/alliance';
const config = resolveAllianceConfig({ apiKey: '...' }); // optional: indexName, rerankModel
const ctx = createServer(config);
ctx.setClient(
new PineconeClient({
apiKey: config.apiKey,
indexName: config.indexName,
sparseIndexName: config.sparseIndexName,
rerankModel: config.rerankModel,
})
);
const server = await setupAllianceServer({ context: ctx });
const myDocs: UrlGeneratorFn = (metadata): UrlGenerationResult => {
const id = typeof metadata.doc_id === 'string' ? metadata.doc_id : null;
return id
? { url: `https://docs.example.com/${id}`, method: 'generated.custom' }
: { url: null, method: 'unavailable', reason: 'doc_id missing' };
};
ctx.registerUrlGenerator('product-docs', myDocs);A fuller embedding sample lives in examples/alliance/custom-url-generator.ts.
Examples
Generic quickstart — examples/quickstart/ (setup guide, seed script, setupCoreServer MCP demo).
Alliance / advanced — examples/alliance/:
File | Description |
Manual suggest_query_params → query flow | |
guided_query and | |
setupAllianceServer without the CLI | |
Custom URL generator registration |
Run with npx tsx examples/<path>.ts from a checkout (requires valid Pinecone env for live paths). See examples/README.md.
Claude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"pinecone-search": {
"command": "npx",
"args": ["-y", "@will-cppa/pinecone-read-only-mcp@0.5.0"],
"env": {
"PINECONE_API_KEY": "your-api-key-here",
"PINECONE_INDEX_NAME": "your-index-name",
"PINECONE_RERANK_MODEL": "your-rerank-model"
}
}
}
}Or with explicit options:
{
"mcpServers": {
"pinecone-search": {
"command": "npx",
"args": [
"-y",
"@will-cppa/pinecone-read-only-mcp@0.5.0",
"--api-key",
"your-api-key-here",
"--index-name",
"your-index-name",
"--rerank-model",
"bge-reranker-v2-m3"
]
}
}
}For a global installation:
{
"mcpServers": {
"pinecone-search": {
"command": "pinecone-read-only-mcp",
"args": ["--api-key", "your-api-key-here", "--index-name", "your-index-name"]
}
}
}Usage
Command Line
Run the server using npx (no installation required):
npx @will-cppa/pinecone-read-only-mcp@0.5.0 --api-key YOUR_API_KEY --index-name YOUR_INDEXOr if installed globally:
pinecone-read-only-mcp --api-key YOUR_API_KEY --index-name YOUR_INDEXOr if installed locally in your project:
node node_modules/@will-cppa/pinecone-read-only-mcp/dist/index.js --api-key YOUR_API_KEY --index-name YOUR_INDEXAvailable Options
--api-key TEXT Pinecone API key (or set PINECONE_API_KEY env var)
--index-name TEXT Dense index (required, or PINECONE_INDEX_NAME)
--rerank-model TEXT Reranker model (defalut: bge-reranker-v2-m3)
--log-level TEXT Logging level [default: INFO]
--help, -h Show help messageRun pinecone-read-only-mcp --help for the full option list.
Deployment
Production Readiness Defaults
Build now fails fast on TypeScript errors (
npm run buildno longer suppresses failures).CI validates typecheck, lint, format, build, smoke run, tests, and package dry-run.
list_namespacesdata is cached in-memory for 30 minutes to reduce repeated Pinecone calls.Query/count flow has guardrails (
suggest_query_paramsbefore execution) to prevent wasteful calls.
Deploy with npm Package
# install
npm i @will-cppa/pinecone-read-only-mcp@0.5.0
# run
npx @will-cppa/pinecone-read-only-mcp@0.5.0 --api-key YOUR_API_KEYDeploy with Docker
# build image
docker build -t pinecone-read-only-mcp:latest .
# run (stdio MCP server)
docker run --rm -i \
-e PINECONE_API_KEY=YOUR_API_KEY \
-e PINECONE_INDEX_NAME=your-index-name \
pinecone-read-only-mcp:latestRelease Gate (recommended)
Before tagging/releasing:
npm run release:checkThis runs full CI-equivalent checks and validates publish contents with npm pack --dry-run.
API Documentation
The server exposes the following tools via MCP:
list_namespaces
Discovers and lists all available namespaces in the configured Pinecone index, including metadata fields and record counts for each namespace.
Parameters: None
Returns: JSON object with namespace details including available metadata fields
metadata_fields values represent inferred field types from sampled records. Common values include:
string, number, boolean, string[], and array.
Example response:
{
"status": "success",
"count": 3,
"namespaces": [
{
"name": "namespace1",
"record_count": 1500,
"metadata_fields": {
"author": "string",
"year": "number",
"category": "string"
}
},
{
"name": "namespace2",
"record_count": 850,
"metadata_fields": {
"title": "string",
"date": "string"
}
}
]
}Retrieval tool decision matrix
Use this when choosing among overlapping retrieval tools. Semantic vs lexical: use query / query_fast / query_detailed or query_documents for meaning-based search; use keyword_search for exact or keyword-style matches on the sparse index. Chunks vs whole documents: use query / query_fast / query_detailed for ranked chunks; use query_documents when you need merged full-document text. One-shot vs manual flow: use guided_query to run routing, suggestion, and execution in a single call; otherwise call suggest_query_params before gated tools.
query/query_fast/query_detailed— Semantic chunk retrieval. Requiressuggest_query_paramsto be called first for the target namespace.query_documents— Semantic search with chunks reassembled into whole documents. Requiressuggest_query_paramsto be called first for the target namespace.keyword_search— Lexical (sparse-only) search. Does not requiresuggest_query_params.guided_query— Combines namespace routing, suggestion, and query into a single call; no prerequisite tools needed.count— “How many …?” style counts via semantic search. Requiressuggest_query_paramsbefore use (same gate asquery/query_documents).
suggest_query_params
Suggests which fields to request and which path to use (count, or hybrid query presets fast / detailed / full — same vocabulary as the query tool preset argument), based on the namespace’s schema (from list_namespaces) and the user’s natural language query. This is a mandatory flow step before count / query tools.
Parameters:
Parameter | Type | Required | Description |
| string | Yes | Namespace to query (must match a name from |
| string | Yes | User’s question or intent (e.g. "list papers by John Doe with titles", "how many papers by Wong?") |
Returns: suggested_fields (only fields that exist in that namespace), use_count_tool, recommended_tool, explanation, and namespace_found.
Example response:
{
"status": "success",
"suggested_fields": ["document_number", "title", "url", "author"],
"use_count_tool": false,
"recommended_tool": "fast",
"explanation": "User asked for a list or browse; use minimal fields (no chunk_text) for smaller payload and cost.",
"namespace_found": true
}Use suggested_fields as the fields parameter when calling query tools.
guided_query
Single orchestrator tool that runs the full flow in one call:
namespace routing (if namespace is omitted),
query param suggestion,
execution via
countor hybridquery(fast/detailed/fullpresets).
It returns both the final result and experimental.decision_trace for transparency.
Parameters:
Parameter | Type | Required | Default | Description |
| string | Yes | - | User question/intent |
| string | No | - | Optional explicit namespace |
| object | No | - | Optional metadata filter |
| integer | No |
| Query result size for query paths (1-100) |
| enum | No |
| One of |
| boolean | No |
| Auto-generate URLs for |
Returns: JSON containing experimental.decision_trace and result.
generate_urls
Generates URLs for retrieved records when metadata does not contain url and URL is required.
Supported namespaces:
mailingslack-Cpplang
Rules:
mailing: usesdoc_idorthread_id
Format:https://lists.boost.org/archives/list/{doc_id_or_thread_id}/slack-Cpplang: prefersourcedirectly if present; otherwise useteam_id,channel_id, anddoc_idmessage_id = doc_id.replace('.', '')
Format:https://app.slack.com/client/{team_id}/{channel_id}/p{message_id}
Parameters:
Parameter | Type | Required | Description |
| string | Yes | Namespace for URL-generation logic |
| array | Yes | Retrieved records; each item can be either metadata itself or an object with |
Returns: Per-record generated URL, generation method, and reason if unavailable.
count
Returns the unique document count matching a metadata filter and semantic query. Use for questions like "how many papers by John Doe?" instead of the query tool. For performance, the count tool uses semantic (dense) search only (no hybrid or lexical) and requests only document identifiers (document_number, url, doc_id)—no chunk content—then deduplicates by document.
Parameters:
Parameter | Type | Required | Description |
| string | Yes | Namespace to count in (use |
| string | Yes | Search query; use a broad term (e.g. |
| object | No | Same operators as |
Returns: JSON with count (unique documents, up to 10,000), and truncated: true if there are at least 10,000 matches.
Example response:
{
"status": "success",
"count": 42,
"truncated": false,
"namespace": "wg21-papers",
"metadata_filter": { "author": { "$in": ["John Doe"] } }
}keyword_search
Performs keyword (lexical/sparse-only) search over the sparse index ({PINECONE_INDEX_NAME}-sparse by default). Use for exact or keyword-style queries. Does not use the dense index or semantic reranking. Call list_namespaces first to discover namespaces; suggest_query_params is optional.
Parameters:
Parameter | Type | Required | Default | Description |
| string | Yes | - | Search query text (keyword/lexical match) |
| string | Yes | - | Namespace to search (use |
| integer | No |
| Number of results to return (1-100) |
| object | No | - | Optional metadata filter (same operators as |
| string[] | No | - | Optional field names to return; omit for all fields |
Returns: JSON with status, query, namespace, index (sparse index name), result_count, and results (ids, metadata, scores). Result rows match the query tool shape (e.g. paper_number, title, author, url, content, score, reranked: false).
Example response:
{
"status": "success",
"query": "contracts C++",
"namespace": "wg21-papers",
"index": "your-index-sparse",
"result_count": 5,
"results": [
{
"paper_number": "P0548",
"title": "Contracts for C++",
"author": "John Doe",
"url": "https://...",
"content": "...",
"score": 0.85,
"reranked": false
}
]
}query
Performs hybrid semantic search over the specified namespace in the Pinecone index with optional metadata filtering. For count questions, use the count tool instead.
Parameters:
Parameter | Type | Required | Default | Description |
| string | Yes | - | Search query text |
| string | Yes | - | Namespace to search (use |
| integer | No |
| Number of results (1-100) |
| boolean | No |
| Enable semantic reranking |
| object | No | - | Metadata filter to narrow results (e.g., |
| string[] | No | - | Field names to return (e.g. |
Returns: JSON object with search results (only requested fields when fields is set), relevance scores, and metadata
Example response:
{
"status": "success",
"query": "your search query",
"namespace": "namespace1",
"metadata_filter": { "author": "John Doe" },
"result_count": 10,
"results": [
{
"paper_number": "DOC-001",
"title": "Document Title",
"author": "John Doe",
"url": "https://example.com/doc",
"content": "Document content preview...",
"score": 0.9234,
"reranked": true
}
]
}Using Metadata Filters:
Metadata filters allow you to narrow down search results based on document properties. First, use list_namespaces to see available metadata fields, then apply filters.
Supported Operators (10 total):
Operator | Syntax | Description | Example |
Equal |
| Exact match |
|
Not Equal |
| Not equal to |
|
Greater Than |
| Greater than |
|
Greater Than or Equal |
| Greater than or equal |
|
Less Than |
| Less than |
|
Less Than or Equal |
| Less than or equal |
|
In Array |
| Value is in array field |
|
Not In Array |
| Value not in array field |
|
Filter Examples:
// Exact match (implicit $eq) - works for single-value string fields
{"status": "published"}
// Exact string match - NOTE: requires full exact match
{"author": "John Doe"} // Only matches if author field is exactly "John Doe"
// Array field contains value (use $in only for array-type fields)
{"tags": {"$in": ["cpp", "contracts"]}} // Only if tags is stored as an array
// Numeric comparison
{"year": {"$gte": 2023}}
// Timestamp range (papers from last 2 years)
{"timestamp": {"$gte": 1704067200}}
// Multiple conditions on same field
{"score": {"$gt": 0.8, "$lt": 1.0}}
{"timestamp": {"$gte": 1704067200, "$lte": 1735689600}}
// Multiple fields (AND logic)
{
"year": {"$gte": 2023},
"status": "published",
"timestamp": {"$gte": 1704067200}
}
// Array field not in list (only for array-type fields)
{"tags": {"$nin": ["draft", "template"]}}Important Limitations:
String fields require EXACT match - No wildcards, partial matches, or substring searches
Comma-separated strings: If a field contains
"John Doe, Herb Sutter", you cannot filter for just"John Doe"You must match the entire string:
{"author": "John Doe, Herb Sutter"}To filter by individual authors, the data must be stored as an array field
$inand$ninoperators: Only work on array-type fields, not comma-separated stringsUnsupported operators are rejected: Unknown operators (for example
$regex) return a validation error$inand$ninmust use arrays:{"tags": {"$in": "cpp"}}is invalid; use{"tags": {"$in": ["cpp"]}}Multiple conditions at the top level are combined with AND logic
Use comparison operators (
$gt,$gte,$lt,$lte) for numeric and timestamp fieldsDirect value assignment implies
$eq(exact match)
How It Works
Namespace Discovery: The
list_namespacestool queries your Pinecone index stats to discover available namespacesHybrid Search: When querying, the tool searches both dense and sparse indexes in parallel
Result Merging: Results from both indexes are merged and deduplicated
Reranking (optional): The merged results are reranked using a semantic reranker for improved relevance
Development
Setup Development Environment
git clone https://github.com/cppalliance/pinecone-read-only-mcp-typescript.git
cd pinecone-read-only-mcp-typescript
npm installBuild
npm run buildRun Tests
npm testBenchmarks
Measure server-side processing overhead with mocked Pinecone responses (no live API calls, no API key required):
npm run benchmarkThe script prints a table of p50, p95, and p99 latencies in milliseconds and writes results to benchmarks/baseline.json. Compare a new run to the committed baseline (for example with git diff benchmarks/baseline.json after re-running the command) to spot regressions.
Testing the keyword_search tool
Connectivity and keyword search (script):
Run the search test script (includes a keyword search step against the sparse index):PINECONE_API_KEY=your-key npm run test:searchIf the sparse index (
{PINECONE_INDEX_NAME}-sparse) does not exist or has no data, the keyword search step is skipped with a warning.Via MCP client:
Start the server and call thekeyword_searchtool withquery_text,namespace(fromlist_namespaces), and optionaltop_kormetadata_filter. Response shape is the same as thequerytool (e.g.resultswith ids, metadata, scores;rerankedis alwaysfalse).
Code Quality
# Run linting
npm run lint
# Fix linting issues
npm run lint:fix
# Check formatting
npm run format:check
# Format code
npm run format
# Type check
npm run typecheckDevelopment Server
Run the server in development mode with auto-reload:
npm run dev -- --api-key YOUR_API_KEYContribution Guidelines
See CONTRIBUTING.md for prerequisites, dev setup, architecture overview, PR conventions, and code style. Run npm run ci before opening a pull request.
Dependencies
Production Dependencies
@modelcontextprotocol/sdk - MCP SDK for TypeScript
@pinecone-database/pinecone - Pinecone client SDK
zod - TypeScript-first schema validation
dotenv - Environment variable management
Development Dependencies
TypeScript - Type-safe JavaScript
ESLint - Code linting
Prettier - Code formatting
Vitest - Testing framework
Comparison with Python Version
This TypeScript implementation grew out of the Python version and now exposes a strict superset of its tool surface, including:
guided_query(single-call orchestrator with decision trace)query_documents(full-document reassembly from chunks)keyword_search(sparse-index-only retrieval)namespace_routerandsuggest_query_params(flow guidance)countandgenerate_urls
Other benefits:
Native Node.js integration
Better npm ecosystem integration
TypeScript type safety
Similar performance characteristics
Troubleshooting
API Key Issues
If you see "Missing Pinecone API key" at startup:
Ensure
PINECONE_API_KEYenvironment variable is set, ORPass
--api-keyoption when running the server
Missing Index Name
If you see "Missing Pinecone index name" at startup:
Set
PINECONE_INDEX_NAMEin your MCP config or.env, ORPass
--index-namewhen running the serverAlliance deployers: see examples/alliance/.env.example
Index Not Found
If you see index-related errors:
Verify your index name is correct
Ensure your API key has access to the index
Check that both
your-index-nameandyour-index-name-sparseindexes exist
Connection Issues
If you experience connection issues:
Check your internet connection
Verify Pinecone service status
Ensure firewall/proxy settings allow connections to Pinecone
License
This project is licensed under the Boost Software License 1.0 - see the LICENSE file for details.
Authors
Will Pak - cppalliance.org
Acknowledgements
This project uses:
Pinecone for vector storage and retrieval
Model Context Protocol for standardized AI integration
Hybrid search approach combining dense embeddings with sparse BM25-style retrieval
Related Projects
Python version - Original Python implementation
Pinecone MCP - Full-featured Pinecone MCP with write capabilities
Support
For issues and questions:
GitHub Issues: https://github.com/cppalliance/pinecone-read-only-mcp-typescript/issues
Email: will@cppalliance.org
Changelog
See CHANGELOG.md for a list of changes in each version.
Available Tools
9 toolscountA
Get the number of unique documents matching a metadata filter and semantic query. Use when the user asks for a count (e.g. "how many documents by author X?", "how many records tagged Y?"). Uses semantic (dense) search only and requests only document identifiers (no content) for performance. Returns the number of unique documents (deduped by document_number/url/doc_id) up to 10,000; truncated=true if at least that many. Mandatory flow: call suggest_query_params first, then count. Use list_namespaces to discover namespace and metadata fields. For count-by-metadata only, use a broad query_text (e.g. "document" or "record"). Same metadata_filter operators as query: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $and, $or.
Inputs: namespace (required), query_text (required), source, metadata_filter.
generate_urlsA
Generate URLs for retrieved results when metadata does not include url and URL is needed. Uses the URL generator registered for the given namespace (if any); returns unavailable for namespaces without a generator.
Inputs: records (required), namespace (required), source.
guided_queryA
Combines namespace routing, suggestion, and query into a single call — no prerequisite tools needed. Single orchestrator: optional namespace_router logic -> executes count or hybrid query (fast / detailed / full presets). Returns experimental.decision_trace so behavior stays transparent and debuggable.
Inputs: user_query (required), top_k, source, namespace, +3 more.
keyword_searchA
Keyword (lexical/sparse-only) search over the Pinecone sparse index ({indexName}-sparse). Use for exact or keyword-style queries. Does not use semantic reranking. Call list_namespaces first to discover namespaces. Does not require suggest_query_params.
Inputs: namespace (required), query_text (required), top_k, fields, +2 more.
list_namespacesA
List all available namespaces in the Pinecone index with their metadata fields and record counts. Returns detailed information about each namespace including available metadata fields that can be used for filtering in queries. Use this tool first to discover which namespaces exist and what metadata fields are available for filtering. In multi-source mode, omit source to list namespaces from all configured projects (each tagged with source). Results are cached in-memory for 30 minutes for better performance.
Inputs: source.
namespace_routerA
Suggest likely namespace(s) for a user query using namespace names, metadata fields, and keyword heuristics. Use before suggest_query_params when namespace is unclear. In multi-source mode, ranks across all sources unless source is set.
Inputs: user_query (required), top_n, source.
queryB
Hybrid semantic search (dense + sparse) with optional reranking. Requires suggest_query_params to be called first for the target namespace. Use preset=fast for low-latency retrieval without reranking and lightweight fields; detailed for reranked, content-oriented retrieval; full to set use_reranking and fields explicitly.
Inputs: namespace (required), query_text (required), top_k, fields, +4 more.
query_documentsA
Run a semantic query and return whole documents (reassembled from chunks). Reranks for document-level relevance when a rerank model is configured (higher latency/cost than chunk-only query). Use for content analysis, summarization, or when you need full-document context. Chunks are grouped by document_number/doc_id/url, ordered by chunk_index when present (e.g. from RecursiveCharacterTextSplitter), and merged into one content per document. Requires suggest_query_params to be called first for the target namespace. Use list_namespaces to discover namespaces.
Inputs: namespace (required), query_text (required), top_k, source, +2 more.
suggest_query_paramsA
Suggest which fields to request and whether to use the count tool, based on the namespace schema (from list_namespaces) and the user's natural language query. Call list_namespaces first to get available namespaces and metadata fields. Then call this tool with the target namespace and the user query; it returns suggested_fields (only fields that exist in that namespace), use_count_tool (true if the query is a count question), recommended_tool (count | fast | detailed | full — same vocabulary as the query tool preset), and an explanation. When the suggest-flow gate is enabled (the Alliance default) this call is required before the query/count tools; when the gate is off (the core default) it is optional. Either way, use the returned suggested_fields in query tools to reduce payload and cost.
Inputs: namespace (required), user_query (required), source.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
The retrieval tools (query, query_documents, keyword_search) are distinguishable by mode (hybrid/chunk, whole-document, lexical), and the descriptions clarify the distinctions. However, guided_query is an explicit orchestrator that duplicates the namespace_router -> suggest_query_params -> query/count pipeline, and namespace_router vs suggest_query_params have overlapping advisory purposes, creating real 'which path do I take' ambiguity.
Most names follow snake_case verb_noun (list_namespaces, generate_urls, query_documents, suggest_query_params, keyword_search). But there are notable deviations: bare verbs (count, query) and a noun-based name (namespace_router), plus guided_query which is verb_noun but semantically an orchestrator.
Nine tools is a good scope for a read-only retrieval server and comfortably within the 3-15 sweet spot. The only mild redundancy is guided_query re-implementing the route/suggest/query sequence, making the set slightly larger than strictly needed.
The read-only retrieval surface is well covered: namespace discovery, param suggestion, routing, counting, hybrid/lexical search, whole-document retrieval, and URL generation. Minor gaps exist beyond design constraint (write operations are intentionally absent): no direct fetch-by-ID or explicit index/namespace stats endpoint beyond list_namespaces.
Maintenance
Related MCP Connectors
Serverless hybrid search: full-text, vector and faceted search, in SQL, ES DSL, Solr and more.
Semantic nearest-neighbour search over your datasets, plus indices and projections.
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Search and SQL on object storage: full-text, vector and hybrid search plus SQL over your data.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenancePinecone integration with vector search capabilities149MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables interaction with Pinecone vector databases for storing and searching embeddings. Supports similarity search, metadata filtering, and vector operations for semantic search and RAG applications.-
- AlicenseNot gradedqualityDmaintenanceEnables reading and writing to a Pinecone vector index, including semantic search, document management, and stats retrieval.MIT
- FlicenseNot gradedqualityDmaintenanceEnables searching and asking questions over your PDF documents using a Pinecone vector index with local embeddings and language model, no external LLM API key required.-