Skip to content

Load per-source schema manifests from Pinecone _mcp_config at startup - #210

Merged
wpak-ai merged 8 commits into
cppalliance:mainfrom
jonathanMLDev:feat/inline-pinecone-sources-json
Jul 15, 2026
Merged

Load per-source schema manifests from Pinecone _mcp_config at startup#210
wpak-ai merged 8 commits into
cppalliance:mainfrom
jonathanMLDev:feat/inline-pinecone-sources-json

Conversation

@jonathanMLDev

@jonathanMLDev jonathanMLDev commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Load per-source description and namespace declarations automatically from the reserved Pinecone _mcp_config namespace (schema_manifest record) at startup, for both multi-source and single-key deployments.
  • Keep PINECONE_CONFIG_FILE / --config-file for local overrides; local namespaces always win over remote manifests.
  • Add PINECONE_DISABLE_REMOTE_SCHEMA / --disable-remote-schema to opt out of remote loading.
  • Add fetchRecordFields so manifest chunk_text is readable on integrated-embedding indexes.
  • Remote fetch failures are non-fatal: startup continues with a warning and falls back to live schema sampling.

Motivation

MCP hosts like Cursor only accept string env values, so embedding rich per-source config inline in mcp.json is awkward. Storing schema manifests in Pinecone keeps mcp.json limited to API keys and index names while still providing declared descriptions and metadata_schema for tools like list_namespaces.

Configuration precedence

  1. PINECONE_CONFIG_FILE (local file)
  2. Colon-separated PINECONE_SOURCES / --sources
  3. Remote _mcp_config manifest (when no local namespaces are declared)

Inline JSON in PINECONE_SOURCES is not supported; a clear startup error points users to PINECONE_CONFIG_FILE or _mcp_config instead.

Test plan

  • npm test
  • npm run lint
  • npm run format:check
  • npm run build
  • Restart pinecone-search-local in Cursor and confirm startup log: Loading _mcp_config schema manifest for N source(s)...
  • Call list_namespaces and verify schema_source: "declared" for namespaces covered by the manifest
  • Set PINECONE_DISABLE_REMOTE_SCHEMA=true, reload, and confirm remote loading is skipped
  • Confirm PINECONE_CONFIG_FILE local namespaces still override remote manifests

Summary by CodeRabbit

  • New Features

    • Automatically loads namespace descriptions and metadata schemas from remote configuration when local declarations are unavailable.
    • Added an option to disable remote schema loading via CLI or environment variable.
    • Added support for JSON-based multi-source configuration, including environment-variable API key references.
  • Improvements

    • Clarified configuration precedence, supported source formats, schema behavior, and security considerations.
    • Improved validation and warnings for invalid or outdated source and namespace configuration.
    • Added clearer multi-source routing and tool behavior documentation.

@jonathanMLDev
jonathanMLDev requested a review from wpak-ai as a code owner July 13, 2026 16:22
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

JSON configuration parsing now validates source metadata and environment indirection. Startup can load missing descriptions and namespace schemas from _mcp_config, with non-fatal failures and an opt-out. Record-field retrieval and declared namespace wiring support this metadata flow.

Changes

Source configuration parsing and controls

Layer / File(s) Summary
Source configuration parsing and controls
src/core/config.ts, src/core/server/source-config.ts, src/core/server/source-config.test.ts, src/cli.ts
Adds validated JSON configuration parsing, optional API-key indirection, malformed-reference errors, colon-format compatibility, config-file precedence, and remote-schema disable controls.

Record retrieval and remote schema loading

Layer / File(s) Summary
Record retrieval and remote schema loading
src/core/pinecone-client.ts, src/core/pinecone/indexes.ts, src/core/pinecone/indexes.test.ts, src/core/server/remote-schema.ts, src/core/server/remote-schema.test.ts
Fetches and flattens Pinecone record fields with timeouts, parses _mcp_config/schema_manifest, merges metadata, and reports non-fatal warnings.

Startup and namespace discovery wiring

Layer / File(s) Summary
Startup and namespace discovery wiring
src/index.ts, src/core/server/server-context.ts, src/core/server/server-context.composition.test.ts
Loads remote schemas for eligible startup paths and passes declared namespaces into namespace discovery.

Configuration and operational documentation

Layer / File(s) Summary
Configuration and operational documentation
docs/CONFIGURATION.md, docs/SECURITY.md, docs/TOOLS.md, CHANGELOG.md
Documents supported formats, precedence, remote schema behavior, metadata privacy, routing semantics, and deployment examples.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Startup
  participant PineconeClient
  participant RemoteSchemaLoader
  participant ServerContext
  Startup->>PineconeClient: Fetch _mcp_config/schema_manifest
  PineconeClient->>RemoteSchemaLoader: Return record fields
  RemoteSchemaLoader-->>Startup: Return merged definitions and warnings
  Startup->>ServerContext: Provide resolved sources or declared namespaces
  ServerContext-->>Startup: Discover namespaces using declared metadata
Loading

Possibly related issues

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: wpak-ai, auramindnest

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: loading per-source schema manifests from Pinecone _mcp_config during startup.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.20388% with 7 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@02014e0). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/core/server/source-config.ts 78.26% 5 Missing ⚠️
src/core/server/remote-schema.ts 96.36% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #210   +/-   ##
=======================================
  Coverage        ?   85.61%           
=======================================
  Files           ?       47           
  Lines           ?     2488           
  Branches        ?      857           
=======================================
  Hits            ?     2130           
  Misses          ?      357           
  Partials        ?        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jonathanMLDev

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 41 minutes.

@jonathanMLDev

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review again

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

@jonathanMLDev I'll run a full review of the PR again.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 29 minutes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/core/pinecone/indexes.ts (1)

237-253: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider reusing the cached denseIndex instead of a fresh pc.index() call.

Every other method in this class (ensureIndexes, listNamespacesWithMetadata, checkIndexes) reuses the cached denseIndex/sparseIndex from ensureIndexes(). This method instead calls pc.index(this.indexName) fresh via ensureClient(). Per Pinecone's own guidance, targeting an index by name can trigger an internal describeIndex() call to resolve the host, and the SDK FAQ recommends reusing resolved index instances to avoid that extra round-trip. Routing through ensureIndexes() and destructuring denseIndex would align with the rest of the class and avoid a possibly redundant resolution call on every invocation — worth verifying SearchableIndex exposes .fetch() before applying.

♻️ Possible direction (verify `SearchableIndex.fetch` exists before applying)
   async fetchRecordFields(namespace: string, id: string): Promise<Record<string, unknown> | null> {
-    const pc = this.ensureClient();
-    const response = await pc.index(this.indexName).fetch({ ids: [id], namespace });
+    const { denseIndex } = await this.ensureIndexes();
+    const response = await denseIndex.fetch({ ids: [id], namespace });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/pinecone/indexes.ts` around lines 237 - 253, Update
fetchRecordFields to obtain and reuse the cached denseIndex from ensureIndexes()
instead of calling ensureClient().index(this.indexName) for each request. Verify
that SearchableIndex exposes fetch(), then invoke fetch on the resolved
denseIndex while preserving the existing namespace, ID, metadata merge, and
null-result behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/pinecone/indexes.ts`:
- Around line 237-253: Update fetchRecordFields() to perform the Pinecone fetch
with a bounded AbortSignal-backed timeout, ensuring slow or hung remote requests
reject so loadRemoteSchemaForSource() can reach its existing warning path and
startup is not blocked.

---

Nitpick comments:
In `@src/core/pinecone/indexes.ts`:
- Around line 237-253: Update fetchRecordFields to obtain and reuse the cached
denseIndex from ensureIndexes() instead of calling
ensureClient().index(this.indexName) for each request. Verify that
SearchableIndex exposes fetch(), then invoke fetch on the resolved denseIndex
while preserving the existing namespace, ID, metadata merge, and null-result
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 906e29da-9a72-495d-b53f-f025163669de

📥 Commits

Reviewing files that changed from the base of the PR and between 38d67fa and f8cd323.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • docs/CONFIGURATION.md
  • docs/SECURITY.md
  • src/cli.ts
  • src/core/config.ts
  • src/core/pinecone-client.ts
  • src/core/pinecone/indexes.test.ts
  • src/core/pinecone/indexes.ts
  • src/core/server/remote-schema.test.ts
  • src/core/server/remote-schema.ts
  • src/core/server/server-context.composition.test.ts
  • src/core/server/server-context.ts
  • src/core/server/source-config.test.ts
  • src/core/server/source-config.ts
  • src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Comment thread src/core/pinecone/indexes.ts
@jonathanMLDev jonathanMLDev changed the title Support JSON-shaped PINECONE_SOURCES with descriptions and namespaces Load per-source schema manifests from Pinecone _mcp_config at startup Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/CONFIGURATION.md`:
- Around line 237-240: Update the remote schema loading guidance for both
single-key and multi-source embedding flows to require !config.checkIndexes in
addition to !config.disableRemoteSchema, matching the CLI guard and preventing
remote fetches during index-check mode.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e94933a-38ab-4673-bfb4-5fb186aaba6f

📥 Commits

Reviewing files that changed from the base of the PR and between f8cd323 and 49fe850.

📒 Files selected for processing (9)
  • docs/CONFIGURATION.md
  • src/cli.test.ts
  • src/core/pinecone-client.test.ts
  • src/core/pinecone-client.ts
  • src/core/pinecone/indexes.test.ts
  • src/core/pinecone/indexes.ts
  • src/core/server/remote-schema.test.ts
  • src/core/server/remote-schema.ts
  • src/core/server/source-config.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/core/pinecone/indexes.ts
  • src/core/pinecone-client.ts
  • src/core/server/source-config.test.ts
  • src/core/server/remote-schema.test.ts
  • src/core/server/remote-schema.ts
  • src/core/pinecone/indexes.test.ts

Comment thread docs/CONFIGURATION.md Outdated
@jonathanMLDev jonathanMLDev self-assigned this Jul 14, 2026
@wpak-ai
wpak-ai merged commit cc4e057 into cppalliance:main Jul 15, 2026
12 checks passed
@jonathanMLDev
jonathanMLDev deleted the feat/inline-pinecone-sources-json branch July 30, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants