Test MCP Registry v1.8.9 locally with PostgreSQL

Test MCP Registry v1.8.9 locally with PostgreSQL

Verification status: not run. The commands and expected results below were checked against the Registry v1.8.9 source. No PostgreSQL or Registry instance was deployed for this guide, and no Registry requests were sent. Earlier v1.8.4 test results apply to that version alone.

Use these steps to check a self-hosted development instance. Verify the database and binary version, publish two synthetic listings with one remote URL, then check that rejected requests leave no record. Shared remote URLs were introduced in v1.8.8 and are supported in v1.8.9. Registry consumers should identify records by name + version.

1. Prepare PostgreSQL and start the local Registry

You need Bash, Docker with a local engine, Git, Go 1.26 or newer, OpenSSL, curl, and jq. Check that local ports 5499 (PostgreSQL) and 8080 (Registry) are free. The setup binds to 127.0.0.1 and uses a disposable PostgreSQL 16 container, a dedicated database, and random test credentials. The build downloads Go dependencies, and Docker downloads the image if it is missing.

Run the pinned binary directly with an empty MCP_REGISTRY_SEED_FROM and OIDC disabled. The upstream Compose file uses ${VAR:-default} for the seed setting, so an empty value still selects the default seed. Use anonymous tokens only for this loopback test. Keep this configuration off public interfaces.

Save the following as registry-local.sh and run bash registry-local.sh. When the readiness checks pass, leave that terminal open and run step 2 in a second terminal.

#!/usr/bin/env bash
set -euo pipefail

tag=v1.8.9
commit=ba94f657e1ecd4ddff11baa25ad84cda26c2b854
base=http://127.0.0.1:8080
if curl --noproxy '*' -s --max-time 2 "$base/" >/dev/null; then
  printf 'Port 8080 is already serving HTTP. Choose a free port before continuing.\n' >&2
  exit 1
fi
work=$(mktemp -d "${TMPDIR:-/tmp}/mcp-registry.XXXXXX")
registry_pid=
cleanup() {
  if [[ -n "$registry_pid" ]]; then
    kill "$registry_pid" 2>/dev/null || true
    wait "$registry_pid" 2>/dev/null || true
  fi
  if [[ -s "$work/pg.cid" ]]; then
    docker rm -fv "$(cat "$work/pg.cid")" >/dev/null || true
  fi
  rm -rf -- "$work"
}
trap cleanup EXIT
trap 'exit 130' INT
trap 'exit 143' TERM

git clone --depth 1 --branch "$tag" https://github.com/modelcontextprotocol/registry.git "$work/src"
test "$(git -C "$work/src" rev-parse HEAD)" = "$commit"
(
  cd "$work/src"
  go build -ldflags "-X main.Version=$tag -X main.GitCommit=$commit" \
    -o "$work/registry" ./cmd/registry
)

password=$(openssl rand -hex 16)
docker run -d --cidfile "$work/pg.cid" -p 127.0.0.1:5499:5432 \
  -e POSTGRES_DB=mcp_registry -e POSTGRES_USER=mcpregistry \
  -e "POSTGRES_PASSWORD=$password" postgres:16-alpine >/dev/null
pg=$(cat "$work/pg.cid")
for attempt in {1..30}; do
  if docker exec "$pg" pg_isready -h 127.0.0.1 -U mcpregistry -d mcp_registry >/dev/null 2>&1; then
    break
  fi
  sleep 1
done
docker exec "$pg" pg_isready -h 127.0.0.1 -U mcpregistry -d mcp_registry

jwt_key=$(openssl rand -hex 32)
MCP_REGISTRY_SERVER_ADDRESS=127.0.0.1:8080 \
MCP_REGISTRY_DATABASE_URL="postgres://mcpregistry:$password@127.0.0.1:5499/mcp_registry?sslmode=disable" \
MCP_REGISTRY_ENABLE_PPROF=false \
MCP_REGISTRY_SEED_FROM='' \
MCP_REGISTRY_OIDC_ENABLED=false \
MCP_REGISTRY_ENABLE_ANONYMOUS_AUTH=true \
MCP_REGISTRY_ENABLE_REGISTRY_VALIDATION=true \
MCP_REGISTRY_JWT_PRIVATE_KEY="$jwt_key" \
"$work/registry" >"$work/registry.log" 2>&1 &
registry_pid=$!
unset password jwt_key

for attempt in {1..30}; do
  if curl --noproxy '*' -fsS --max-time 2 "$base/v0/ping" >/dev/null 2>&1; then
    break
  fi
  if ! kill -0 "$registry_pid" 2>/dev/null; then
    tail -n 30 "$work/registry.log" >&2
    exit 1
  fi
  sleep 1
done
curl --noproxy '*' -fsS --max-time 2 "$base/v0/ping" >/dev/null
kill -0 "$registry_pid"
curl --noproxy '*' -fsS --max-time 2 "$base/v0/version" |
  jq -e --arg version "$tag" --arg commit "$commit" \
    '.version == $version and .git_commit == $commit' >/dev/null
migrations=$(docker exec "$pg" psql -X -v ON_ERROR_STOP=1 -U mcpregistry -d mcp_registry -Atc \
  'SELECT count(*), max(version) FROM schema_migrations;')
printf 'schema_migrations: %s\n' "$migrations"
test "$migrations" = '19|19'
read -r -p 'Registry ready. Run the checks in a second terminal, then press Enter to clean up. '
CheckExpected result (not run)
PostgreSQL readinesspg_isready reports that the database accepts connections.
Registry HTTP readinessGET /v0/ping returns 200.
Binary identityGET /v0/version returns v1.8.9 and the full pinned commit SHA above.
Fresh database migrationsThe schema_migrations query returns 19|19 for the count and highest migration version.

If startup fails, check the Docker engine, image download, and port usage first. Resolve any version or migration mismatch before continuing. At exit, the script stops its Registry process, removes its PostgreSQL container and anonymous volume by the recorded container ID, and clears its temporary directory.

2. Verify independent records with the same remote URL

Save the next block as registry-check.sh and run bash registry-check.sh in the second terminal. Use a fresh database from step 1 for each run. Requests go only to the local Registry. The two listings use https://shared.example/mcp as metadata. The payload supplies remotes and omits packages, so there is no package ownership to check. Percent-encode the server name as a single path segment on reads and check the .server object in the response.

#!/usr/bin/env bash
set -euo pipefail

base=http://127.0.0.1:8080
commit=ba94f657e1ecd4ddff11baa25ad84cda26c2b854
remote=https://shared.example/mcp
work=$(mktemp -d "${TMPDIR:-/tmp}/mcp-registry-check.XXXXXX")
trap 'rm -rf -- "$work"' EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
response="$work/response.json"
http=(curl --noproxy '*' -sS --max-time 10)

check_status() {
  local label=$1 expected=$2 actual
  shift 2
  actual=$("${http[@]}" -o "$response" -w '%{http_code}' "$@")
  printf '%s: expected %s, got %s\n' "$label" "$expected" "$actual"
  [[ "$actual" == "$expected" ]]
}

record() {
  jq -n --arg name "$1" --arg version "$2" --arg url "$remote" '{
    "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
    name: $name, description: "Local shared URL fixture", version: $version,
    remotes: [{type: "streamable-http", url: $url}]
  }'
}

publish() {
  local name=$1 version=$2 expected=$3
  shift 3
  record "$name" "$version" >"$work/server.json"
  check_status "publish $name $version" "$expected" "$@" \
    -H 'Content-Type: application/json' --data-binary "@$work/server.json" "$base/v0.1/publish"
}

read_version() {
  local name=$1 version=$2 expected=$3
  local encoded_name encoded_version
  encoded_name=$(jq -nr --arg value "$name" '$value | @uri')
  encoded_version=$(jq -nr --arg value "$version" '$value | @uri')
  check_status "read $name $version" "$expected" \
    "$base/v0.1/servers/$encoded_name/versions/$encoded_version"
  if [[ "$expected" == 200 ]]; then
    jq -e --arg name "$name" --arg version "$version" --arg remote "$remote" '
      .server.name == $name and .server.version == $version and
      ([.server.remotes[].url] == [$remote])
    ' "$response" >/dev/null
  fi
}

check_status "Registry version" 200 "$base/v0/version"
jq -e --arg commit "$commit" '.version == "v1.8.9" and .git_commit == $commit' "$response" >/dev/null
check_status "local anonymous token" 200 -X POST "$base/v0.1/auth/none"
token=$(jq -er '.registry_token | select(type == "string" and length > 0)' "$response")
ns=io.modelcontextprotocol.anonymous

publish "$ns/a" 1.0.0 200 -H "Authorization: Bearer $token"
publish "$ns/b" 1.0.1 200 -H "Authorization: Bearer $token"
read_version "$ns/a" 1.0.0 200
read_version "$ns/b" 1.0.1 200

publish "$ns/missing-auth" 1.0.0 422
publish "$ns/invalid-auth" 1.0.0 401 -H 'Authorization: Bearer invalid-fixture'
publish "io.modelcontextprotocol.other/forbidden" 1.0.0 403 -H "Authorization: Bearer $token"
read_version "$ns/missing-auth" 1.0.0 404
read_version "$ns/invalid-auth" 1.0.0 404
read_version "io.modelcontextprotocol.other/forbidden" 1.0.0 404
ScenarioExpected result (not run)
POST /v0.1/auth/none200, with a registry_token that can publish under io.modelcontextprotocol.anonymous/* only.
Publish [email protected] and [email protected]Both return 200, and the listings share one remote URL.
Read each record by exact name and versionBoth return 200. Each has its own .server.name and .server.version, and both have the same .server.remotes[].url.
Valid payload without Authorization422 for the missing required header.
Invalid token401 for failed authentication.
Valid token outside its allowed namespace403 for insufficient permission.
Read each of the three rejected recordsAll return 404. Each used an unused name and version, so these reads check that failed requests left no record.

Both successful publishes use the same anonymous namespace. For the behavior across namespaces, see the upstream shared-URL regression test, which exercises two separate permission scopes. For consumers, see Registry versioning.

3. Clean up and record results

Press Enter in the first terminal and confirm that both ports are free. After an actual run, record the version, migration count, HTTP status for each case, and the fields read back. Keep expected and actual values in separate columns. Omit the database password, JWT signing key, and token from the record.