Skip to content

Conversation

@JonasJesus42
Copy link
Contributor

@JonasJesus42 JonasJesus42 commented Dec 31, 2025

Summary by cubic

Switch the registry to a Supabase-backed implementation so the app reads servers from a local mcp_servers table instead of the MCP Registry API. This improves performance and makes pagination predictable.

  • New Features

    • Supabase client for list/get/versions, with row-to-API conversion and sanitized search input.
    • mcp_servers DDL (indexes, trigger for updated_at, RLS policies to hide unlisted rows).
    • Sync script to import all servers from the official Registry and upsert to Supabase; computes flags and applies verified overrides; supports FORCE_UPDATE.
    • Metadata enrichment script to generate friendly_name, mesh_description, tags, and categories; includes force/limit helpers.
    • package.json: adds @supabase/supabase-js and scripts (sync:supabase, enrich:ai variants).
    • Tools now query Supabase and use IDs like name@version; GET returns the latest version.
  • Migration

    • Set SUPABASE_URL and SUPABASE_ANON_KEY for runtime.
    • Set SUPABASE_SERVICE_ROLE_KEY for the sync script and OPENROUTER_API_KEY for the enrichment script.
    • Populate data: bun run sync:supabase (or sync:supabase:force).
    • If the table is missing, run registry/scripts/create-table.sql in Supabase’s SQL editor.

Written for commit 715d3bb. Summary will update on new commits.

@github-actions
Copy link

github-actions bot commented Dec 31, 2025

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 registry

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: 6195c12

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

5 issues found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="registry/server/tools/registry-binding.ts">

<violation number="1" location="registry/server/tools/registry-binding.ts:226">
P2: The `version` parameter defined in `ListInputSchema` is not being used. The destructuring omits `version` entirely, making the documented API parameter non-functional. Either remove `version` from the schema or implement the filtering logic.</violation>

<violation number="2" location="registry/server/tools/registry-binding.ts:296">
P1: The `version` extracted from the server ID is ignored. When users request a specific version (e.g., `&#39;ai.exa/exa@3.1.1&#39;`), they will always receive the latest version instead because `getServerFromSupabase` only queries `is_latest: true`. Either pass the version to the query function or update the API description to clarify that version-specific lookups are not supported.</violation>
</file>

<file name="registry/server/lib/supabase-client.ts">

<violation number="1" location="registry/server/lib/supabase-client.ts:222">
P2: Search parameter is directly interpolated without sanitization. Special characters (commas, periods, parentheses) in the search string could break PostgREST query parsing or cause unintended filter behavior. Consider sanitizing the search input to escape special characters.</violation>

<violation number="2" location="registry/server/lib/supabase-client.ts:356">
P2: Missing `is_latest: true` filter in stats fallback queries. Other functions (`listServers`, `getServer`) consistently filter by `is_latest` to get only the latest version, but these stats queries will count all versions of servers, leading to inflated/inconsistent counts.</violation>
</file>

<file name="registry/scripts/create-table.sql">

<violation number="1" location="registry/scripts/create-table.sql:122">
P1: RLS policy allows public read of unlisted (hidden) items. The `unlisted` column is meant to hide rows when `TRUE`, but `USING (true)` exposes all rows. Consider restricting to visible items only.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 6 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="registry/server/lib/supabase-client.ts">

<violation number="1" location="registry/server/lib/supabase-client.ts:184">
P2: The `sanitizeSearchInput` function is missing the escape for the underscore (`_`) character. In SQL LIKE/ILIKE patterns, `_` is a single-character wildcard (similar to how `%` is a multi-character wildcard). Without escaping it, users can inject single-character wildcards into search queries.</violation>
</file>

<file name="registry/scripts/enrich-with-ai.ts">

<violation number="1" location="registry/scripts/enrich-with-ai.ts:32">
P0: **CRITICAL SECURITY ISSUE**: API key is hardcoded in source code. This key is now exposed in the repository and should be immediately revoked. The key should be read from `process.env.OPENROUTER_API_KEY` as documented in the script header (line 20).</violation>
</file>

<file name="registry/server/tools/registry-binding.ts">

<violation number="1" location="registry/server/tools/registry-binding.ts:72">
P2: Documentation is inaccurate: `COLLECTION_REGISTRY_APP_GET` does NOT support getting specific versions. The `getServer` function always filters by `is_latest: true`, and the parsed version from the ID is ignored. Consider either updating this documentation to reflect actual behavior, or updating the GET implementation to support version queries.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Restaura arquivos de integração com Supabase que foram perdidos:
- registry/server/lib/supabase-client.ts - Cliente Supabase com CRUD
- registry/scripts/create-table.sql - Script DDL da tabela mcp_servers
- registry/scripts/populate-supabase.ts - Script de sincronização com Registry API

Estes arquivos são necessários para a funcionalidade do registry com Supabase.
Atualiza o registry completo com implementação baseada em Supabase:

Changes:
- package.json: adiciona @supabase/supabase-js e scripts de sync
- main.ts: remove registryUrl do StateSchema (usa env vars)
- registry-binding.ts: simplifica drasticamente (-365/+159 linhas)
  - Usa Supabase client diretamente ao invés da API do Registry
  - Remove lógica complexa de fallback e cache
  - Mantém apenas allowlist e blacklist

Migração completa de API fetch → Supabase queries para melhor performance.
Code review fixes:
- Remove unused 'version' parameter from ListInputSchema
- Add is_latest filter to stats fallback queries
- Add sanitization for search input to prevent PostgREST injection
- Fix RLS policy to hide unlisted items from public access

Translations:
- Translate all comments and strings from PT-BR to English
- Update scripts: enrich-with-ai.ts, populate-supabase.ts
- Update server files: supabase-client.ts, registry-binding.ts
- Keep code consistent and professional in English
- Add escape for underscore (_) character in sanitizeSearchInput
- Underscore is a single-char wildcard in SQL LIKE/ILIKE
- Without escaping, users could inject wildcard patterns
- Example: 'ai_exa' would match 'ai.exa', 'ai-exa', 'ai exa', etc.
🚨 CRITICAL SECURITY FIX 🚨

- Remove hardcoded OPENROUTER_API_KEY from source code
- Use process.env.OPENROUTER_API_KEY instead
- Add validation to check for missing API key at startup
- Pass API key as parameter through function calls

⚠️ ACTION REQUIRED:
The exposed API key (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)
must be IMMEDIATELY REVOKED at OpenRouter dashboard and a new key generated.

The old key is now exposed in git history and should be considered compromised.
- Add .env to .gitignore to prevent accidental commits
- Create ENV_SETUP.md with instructions for environment setup
- Create .env template file (not tracked by git)
- Update COLLECTION_REGISTRY_APP_GET docs to reflect actual behavior
- GET always returns LATEST version (is_latest: true)
- Version suffix in 'name@version' is accepted but IGNORED
- Remove misleading reference to GET supporting specific versions
- Clarify that COLLECTION_REGISTRY_APP_VERSIONS should be used for version queries

The implementation was correct, only the documentation was inaccurate.
@JonasJesus42 JonasJesus42 force-pushed the feat/registry-updates-from-main branch from ff3c404 to 715d3bb Compare January 2, 2026 16:21
@JonasJesus42 JonasJesus42 merged commit 36ed2b5 into main Jan 2, 2026
5 of 8 checks passed
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.

2 participants