If you've built a local CLI tool in TypeScript/Node.js and added a stdio Model Context Protocol (MCP) server to it, getting it cleanly published to the Official MCP Registry (registry.modelcontextprotocol.io), passing Glama's automated Dockerfile + TDQS grading, and showing up in Cursor Directory has a handful of subtle gotchas that aren't obvious from the docs.

This week I shipped two zero-dependency open-core CLIs & MCP servers all the way through that pipeline — PromptBill (v1.5.0, local AI coding cost attribution & client PDF/Xero/QuickBooks invoices) and AuditDeck (v1.1.0, local 5-pillar Git repo auditor & 3-page Client Handover PDFs) — with zero long-lived API secrets, zero npm token management, and $0 hosting cost.

PromptBill CLI & Client Invoice PDF Preview

Here is the exact working recipe (and the 4 real pitfalls that bit me along the way).

1. The Zero-Secret OCI + OIDC Pattern (ghcr.io -> Official MCP Registry)

Many tutorials assume you must publish an npm package and configure an NPM_TOKEN secret before registering an MCP server. You don't.

The Official MCP Registry supports OCI container packages on GitHub Container Registry (ghcr.io), verified via a single OCI LABEL plus GitHub Actions OIDC (id-token: write)!

Step A: Add the OCI Ownership Label to Your Dockerfile

Pitfall #1: if your package.json has a "prepare": "npm run build" script and you run npm ci before copying src/, Docker fails because tsconfig.json / src/ aren't copied yet. Use --ignore-scripts during the dependency install step:

FROM node:22-alpine WORKDIR /app COPY package.json package-lock.json* ./ RUN npm ci --ignore-scripts COPY tsconfig.json ./ COPY src ./src RUN npm run build && npm prune --omit=dev LABEL io.modelcontextprotocol.server.name="io.github.danielneuron/promptbill" LABEL org.opencontainers.image.source="https://github.com/danielneuron/promptbill" ENTRYPOINT ["node", "/app/dist/cli.js"] CMD ["mcp"] 

Step B: Write a Valid server.json at Repo Root

{ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "name": "io.github.danielneuron/promptbill", "description": "Local-first AI coding cost attribution and client PDF/Xero/QuickBooks invoice generator.", "repository": { "url": "https://github.com/danielneuron/promptbill", "source": "github" }, "version": "1.5.0", "packages": [ { "registryType": "oci", "identifier": "ghcr.io/danielneuron/promptbill:1.5.0", "transport": { "type": "stdio" } } ] } 

Step C: Automate Publishing on Every GitHub Release via OIDC

With packages: write and id-token: write, GitHub Actions builds the OCI image to ghcr.io, downloads mcp-publisher, authenticates with zero stored secrets, and publishes straight to registry.modelcontextprotocol.io:

name: Publish to MCP Registry on: release: types: [published] permissions: contents: read packages: write id-token: write jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/build-push-action@v6 with: context: . push: true tags: | ghcr.io/danielneuron/promptbill:${{ github.ref_name }} ghcr.io/danielneuron/promptbill:latest - name: Publish to Official MCP Registry run: | curl -sSL "https://github.com/modelcontextprotocol/registry/releases/download/v1.8.1/mcp-publisher_linux_amd64.tar.gz" | tar -xz ./mcp-publisher login github-oidc ./mcp-publisher publish 

Make sure your GHCR package visibility is set to Public once after the first push so the registry validator can inspect the OCI manifest label!

2. Passing Glama's Dockerfile Test & Boosting TDQS + Server Coherence to A (83% Discovery)

Two pitfalls hit almost every multi-command CLI that exposes an mcp subcommand:

Pitfall #2: Glama Auto-Generated CMD Drops Your mcp Subcommand

If your CLI runs as node ./dist/cli.js mcp, Glama's auto-generated Dockerfile wrapper (mcp-proxy) may omit "mcp", causing the container to print CLI help and exit with code 1. Setting Glama's CMD arguments explicitly to:

["mcp-proxy", "--", "node", "./dist/cli.js", "mcp"] 

fixed both builds immediately (10-second build, all tools discovered cleanly).

Pitfall #3: Missing instructions, Tool annotations, and prompts Capped Our Initial TDQS Score

When we shipped v1.0 with bare tools/list, Glama scored TDQS around 3.3–3.4/5. Upgrading our zero-dep JSON-RPC handler (protocolVersion: "2025-11-25") to return:

  1. Top-level server instructions in initialize explaining when and how an agent should sequence tools,
  2. MCP tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) on every tool, and
  3. Two guided prompts/list + prompts/get workflows (monthly-client-invoice / repo-cost-audit in PromptBill; client-handover-audit / pre-release-security-check in AuditDeck)

immediately pushed BOTH servers to Discovery Score 83%, Server Coherence A, and Quality A (3.7/5 TDQS) on PromptBill!

3. Pitfall #4: Don't Forget .mcp.json at Repo Root

When submitting to IDE marketplaces like Cursor Directory, automated repo scanners look for a root .mcp.json manifest:

{ "mcpServers": { "promptbill": { "command": "npx", "args": ["-y", "github:danielneuron/promptbill", "mcp"] } } } 

Adding .mcp.json alongside server.json and glama.json lets developers and automated scanners wire up your server cleanly across Claude Code, Cursor, Cline, Roo Code, and Windsurf.

See Both Live Examples in Production

Both zero-dependency MIT open-core tools use this exact setup (and are especially handy right at end-of-month client billing & milestone handover time!):

  1. PromptBill (Landing Page • Sample Pro PDF • Glama A • Cursor Directory) — Parses local Claude Code, OpenAI Codex CLI, Gemini CLI, Cline & Roo Code logs per Git repo into client PDF & Xero/QuickBooks invoices.
  2. AuditDeck (Landing Page • Sample 3-Page Pro PDF • Glama 83% • Cursor Directory) — 5-pillar local Git repository auditor & white-label Client Handover PDF generator (masked secret scan, lockfiles, CI/tests, Git bus-factor).

Both CLI cores & MCP servers are 100% free & MIT open-source (npx github:danielneuron/promptbill ui --demo / npx github:danielneuron/auditdeck scan --demo). For freelancers or agencies who want unwatermarked white-label client PDFs, Xero/QuickBooks/Jira CSV exports, and Page 2/3 client appendices, optional one-time Polar.sh licenses ($19 / $29, or the $39 Dev CLI & MCP Pro Bundle — instant PBILL- + ADECK- keys for up to 3 machines each, 7-day offline grace, lifetime v1.x updates, and a 14-day no-questions refund guarantee) keep the projects sustainable without subscriptions.

Are you publishing MCP servers via npm, PyPI, or ghcr.io OCI + OIDC? Happy to answer questions on server.json schemas or Glama TDQS grading in the comments!