registry/internal/database/migrations/011_fix_empty_schema_fields.sql
Tadas Antanavicius 8f8fc89801
Fix missing $schema entries - data migration (#806)
Drafted by Claude Code, reviewed by me.

## Summary

This PR adds a data migration to fix 17 server entries that were
published with empty `$schema` fields.

**This is a pure data migration** - no code changes are needed because:

- Validation for the `$schema` field was already added in commit
[6d2001b](6d2001b)
on **2025-10-07**
- That validation was deployed to production on **2025-10-14** with
v1.3.0 ([PR
#668](https://github.com/modelcontextprotocol/registry/pull/668))
- All 17 affected entries were published before deployment (see dates
below)

## Affected Entries (17 total)

| Server | Version | Published |
|--------|---------|-----------|
| io.github.ruvnet/claude-flow | 2.0.0-alpha.104 | 2025-09-10 |
| io.github.ruvnet/claude-flow | 2.0.0-alpha.105 | 2025-09-10 |
| io.github.ruvnet/ruv-swarm | 1.0.18 | 2025-09-10 |
| io.github.ruvnet/ruv-swarm | 1.0.19 | 2025-09-10 |
| travel.kismet/mcp-server | 0.0.0 | 2025-09-10 |
| io.github.jkakar/cookwith-mcp | 1.0.0 | 2025-09-11 |
| io.github.jkakar/cookwith-mcp | 1.0.1 | 2025-09-12 |
| io.github.jkakar/cookwith-mcp | 1.0.2 | 2025-09-12 |
| io.github.OtherVibes/mcp-as-a-judge | 0.3.12 | 2025-09-18 |
| io.github.OtherVibes/mcp-as-a-judge | 0.3.13 | 2025-09-18 |
| io.github.OtherVibes/mcp-as-a-judge | 0.3.14 | 2025-09-18 |
| io.github.OtherVibes/mcp-as-a-judge | 0.3.20 | 2025-09-20 |
| io.github.Skills03/scrimba-teaching | 1.0.1 | 2025-09-21 |
| io.github.Skills03/scrimba-teaching | 1.1.0 | 2025-09-21 |
| io.github.Skills03/scrimba-teaching | 1.2.0 | 2025-09-21 |
| io.github.toby/mirror-mcp | 0.0.4 | 2025-10-01 |
| io.github.antuelle78/weather-mcp | 1.0.0 | 2025-10-09 ⚠️ |

**Note on outlier:** `io.github.antuelle78/weather-mcp` was published on
2025-10-09, which is after the validation code was committed
(2025-10-07) but before it was deployed (2025-10-14). This confirms the
entries slipped through due to the gap between merge and deployment.

## Dry Run SQL

To verify affected rows before running the migration:

```sql
SELECT server_name, version, value->>'$schema' as schema_value
FROM servers
WHERE (server_name, version) IN (
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.12'),
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.13'),
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.14'),
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.20'),
    ('io.github.Skills03/scrimba-teaching', '1.0.1'),
    ('io.github.Skills03/scrimba-teaching', '1.1.0'),
    ('io.github.Skills03/scrimba-teaching', '1.2.0'),
    ('io.github.antuelle78/weather-mcp', '1.0.0'),
    ('io.github.jkakar/cookwith-mcp', '1.0.0'),
    ('io.github.jkakar/cookwith-mcp', '1.0.1'),
    ('io.github.jkakar/cookwith-mcp', '1.0.2'),
    ('io.github.ruvnet/claude-flow', '2.0.0-alpha.104'),
    ('io.github.ruvnet/claude-flow', '2.0.0-alpha.105'),
    ('io.github.ruvnet/ruv-swarm', '1.0.18'),
    ('io.github.ruvnet/ruv-swarm', '1.0.19'),
    ('io.github.toby/mirror-mcp', '0.0.4'),
    ('travel.kismet/mcp-server', '0.0.0')
)
AND (value->>'$schema' = '' OR value->>'$schema' IS NULL);
```

Result against prod:

```sql
app=> SELECT server_name, version, value->>'$schema' as schema_value
FROM servers
WHERE (server_name, version) IN (
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.12'),
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.13'),
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.14'),
    ('io.github.OtherVibes/mcp-as-a-judge', '0.3.20'),
    ('io.github.Skills03/scrimba-teaching', '1.0.1'),
    ('io.github.Skills03/scrimba-teaching', '1.1.0'),
    ('io.github.Skills03/scrimba-teaching', '1.2.0'),
    ('io.github.antuelle78/weather-mcp', '1.0.0'),
    ('io.github.jkakar/cookwith-mcp', '1.0.0'),
    ('io.github.jkakar/cookwith-mcp', '1.0.1'),
    ('io.github.jkakar/cookwith-mcp', '1.0.2'),
    ('io.github.ruvnet/claude-flow', '2.0.0-alpha.104'),
    ('io.github.ruvnet/claude-flow', '2.0.0-alpha.105'),
    ('io.github.ruvnet/ruv-swarm', '1.0.18'),
    ('io.github.ruvnet/ruv-swarm', '1.0.19'),
    ('io.github.toby/mirror-mcp', '0.0.4'),
    ('travel.kismet/mcp-server', '0.0.0')
)
AND (value->>'$schema' = '' OR value->>'$schema' IS NULL);
             server_name             |     version     | schema_value 
-------------------------------------+-----------------+--------------
 io.github.toby/mirror-mcp           | 0.0.4           | 
 io.github.jkakar/cookwith-mcp       | 1.0.0           | 
 io.github.ruvnet/ruv-swarm          | 1.0.19          | 
 io.github.jkakar/cookwith-mcp       | 1.0.1           | 
 io.github.ruvnet/ruv-swarm          | 1.0.18          | 
 io.github.antuelle78/weather-mcp    | 1.0.0           | 
 io.github.jkakar/cookwith-mcp       | 1.0.2           | 
 io.github.OtherVibes/mcp-as-a-judge | 0.3.12          | 
 travel.kismet/mcp-server            | 0.0.0           | 
 io.github.Skills03/scrimba-teaching | 1.0.1           | 
 io.github.OtherVibes/mcp-as-a-judge | 0.3.20          | 
 io.github.Skills03/scrimba-teaching | 1.2.0           | 
 io.github.ruvnet/claude-flow        | 2.0.0-alpha.105 | 
 io.github.ruvnet/claude-flow        | 2.0.0-alpha.104 | 
 io.github.Skills03/scrimba-teaching | 1.1.0           | 
 io.github.OtherVibes/mcp-as-a-judge | 0.3.14          | 
 io.github.OtherVibes/mcp-as-a-judge | 0.3.13          | 
```

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-30 08:41:02 -08:00

63 lines
2.7 KiB
PL/PgSQL

-- Migration: Fix empty $schema fields in 17 specific server entries
--
-- This migration updates exactly 17 server entries that were published with
-- empty $schema fields (""). These entries are explicitly listed below to
-- ensure no other data is affected.
--
-- Issue: https://github.com/modelcontextprotocol/registry/issues/805
--
-- Affected entries (17 total):
-- io.github.OtherVibes/mcp-as-a-judge: 0.3.12, 0.3.13, 0.3.14, 0.3.20
-- io.github.Skills03/scrimba-teaching: 1.0.1, 1.1.0, 1.2.0
-- io.github.antuelle78/weather-mcp: 1.0.0
-- io.github.jkakar/cookwith-mcp: 1.0.0, 1.0.1, 1.0.2
-- io.github.ruvnet/claude-flow: 2.0.0-alpha.104, 2.0.0-alpha.105
-- io.github.ruvnet/ruv-swarm: 1.0.18, 1.0.19
-- io.github.toby/mirror-mcp: 0.0.4
-- travel.kismet/mcp-server: 0.0.0
BEGIN;
-- Define the exact list of affected entries
-- Using a CTE to make the affected entries explicit and auditable
WITH affected_entries AS (
SELECT server_name, version FROM (VALUES
-- io.github.OtherVibes/mcp-as-a-judge (4 versions)
('io.github.OtherVibes/mcp-as-a-judge', '0.3.12'),
('io.github.OtherVibes/mcp-as-a-judge', '0.3.13'),
('io.github.OtherVibes/mcp-as-a-judge', '0.3.14'),
('io.github.OtherVibes/mcp-as-a-judge', '0.3.20'),
-- io.github.Skills03/scrimba-teaching (3 versions)
('io.github.Skills03/scrimba-teaching', '1.0.1'),
('io.github.Skills03/scrimba-teaching', '1.1.0'),
('io.github.Skills03/scrimba-teaching', '1.2.0'),
-- io.github.antuelle78/weather-mcp (1 version)
('io.github.antuelle78/weather-mcp', '1.0.0'),
-- io.github.jkakar/cookwith-mcp (3 versions)
('io.github.jkakar/cookwith-mcp', '1.0.0'),
('io.github.jkakar/cookwith-mcp', '1.0.1'),
('io.github.jkakar/cookwith-mcp', '1.0.2'),
-- io.github.ruvnet/claude-flow (2 versions)
('io.github.ruvnet/claude-flow', '2.0.0-alpha.104'),
('io.github.ruvnet/claude-flow', '2.0.0-alpha.105'),
-- io.github.ruvnet/ruv-swarm (2 versions)
('io.github.ruvnet/ruv-swarm', '1.0.18'),
('io.github.ruvnet/ruv-swarm', '1.0.19'),
-- io.github.toby/mirror-mcp (1 version)
('io.github.toby/mirror-mcp', '0.0.4'),
-- travel.kismet/mcp-server (1 version)
('travel.kismet/mcp-server', '0.0.0')
) AS t(server_name, version)
)
UPDATE servers s
SET value = jsonb_set(
s.value,
'{$schema}',
'"https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json"'::jsonb
)
FROM affected_entries ae
WHERE s.server_name = ae.server_name
AND s.version = ae.version
AND (s.value->>'$schema' = '' OR s.value->>'$schema' IS NULL);
COMMIT;