DEV Community

Rafael Silva
Rafael Silva

Posted on

How to Publish an MCP Server to the Official Registry and npm: A Step-by-Step Guide

The Model Context Protocol (MCP) is rapidly becoming the standard for connecting AI agents (like Claude, Cursor, and Windsurf) to external data sources and tools. If you've built an MCP server, the next critical step is distribution.

In building SkillFlow — an open marketplace for AI agent skills — we had to navigate the exact process of publishing our own MCP server to make it accessible to developers worldwide.

In this guide, I'll walk you through the exact steps to publish your MCP server to both npm and the Official MCP Registry, ensuring it's easily discoverable and installable via npx.


1. Preparing Your MCP Server for npm

Before submitting to any registry, your server needs to be easily executable. The best way to distribute a TypeScript/JavaScript MCP server is via npm using npx.

Update your package.json

You need to ensure your package is configured correctly for CLI execution. Add the bin field to your package.json:

{
  "name": "your-mcp-server-name",
  "version": "1.0.0",
  "description": "Your awesome MCP server",
  "mcpName": "your-mcp-server-name", // CRITICAL for some registries!
  "bin": {
    "your-mcp-server-name": "./build/index.js"
  },
  "scripts": {
    "build": "tsc",
    "prepublishOnly": "npm run build"
  }
}
Enter fullscreen mode Exit fullscreen mode

Crucial detail: Notice the "mcpName" field. While not strictly standard in npm, many MCP directories and clients parse this field to identify the server's canonical name. Don't skip it!

Add the Shebang

Make sure your entry file (e.g., src/index.ts) starts with a shebang so the OS knows how to execute it:

#!/usr/bin/env node

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
// ... rest of your code
Enter fullscreen mode Exit fullscreen mode

Publish to npm

Once built, publish your package:

npm login
npm publish
Enter fullscreen mode Exit fullscreen mode

Now, anyone can run your server using: npx -y your-mcp-server-name


2. Publishing to the Official MCP Registry

Anthropic maintains the official MCP Registry at registry.modelcontextprotocol.io. Getting listed here is the highest leverage action you can take for distribution.

Step 1: Install the Publisher CLI

Anthropic provides a CLI tool specifically for registry submissions:

npm install -g @modelcontextprotocol/publisher
Enter fullscreen mode Exit fullscreen mode

Step 2: Create server.json

In the root of your project, create a server.json manifest. This file tells the registry how to install and run your server.

{
  "$schema": "https://registry.modelcontextprotocol.io/schema/server.json",
  "name": "io.github.yourusername/your-server",
  "description": "A brief description of what your server does (max 100 chars)",
  "repository": {
    "type": "git",
    "url": "https://github.com/yourusername/your-repo"
  },
  "version": "1.0.0",
  "packages": [
    {
      "name": "your-mcp-server-name",
      "type": "npm",
      "version": "1.0.0",
      "transport": "stdio"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Important rules for server.json:

  1. The name MUST be a reverse-DNS style identifier (e.g., io.github.username/repo).
  2. The description MUST be under 100 characters.
  3. The packages array tells clients exactly how to fetch and run your code.

Step 3: Authenticate and Publish

Run the publisher tool from the directory containing your server.json:

mcp-publisher login
Enter fullscreen mode Exit fullscreen mode

This will open a browser window for GitHub OAuth device activation. Once authenticated, run:

mcp-publisher pub
Enter fullscreen mode Exit fullscreen mode

If successful, your server will be instantly live on the registry!


3. Submitting to Community Directories

Once you're on npm and the Official Registry, you should amplify your reach. Several community directories automatically ingest from the official registry, but others require manual submission.

I highly recommend submitting to:

  • Glama (glama.ai/mcp/servers)
  • Smithery (smithery.ai)
  • MCP Market (mcp.market)
  • AI Agents Directory (aiagentsdirectory.com)

If you're building tools for AI agents, you might also want to list your server on SkillFlow.builders, where we curate high-quality MCP servers with trust metrics and compatibility scores.

Conclusion

Publishing an MCP server is straightforward once you know the exact metadata required. By combining an npm package with an official registry manifest, you ensure that AI clients can seamlessly discover and execute your tools.

Have you built an interesting MCP server? Let me know in the comments!io.github.username/repo`).

  1. The description MUST be under 100 characters.
  2. The packages array tells clients exactly how to fetch and run your code.

Step 3: Authenticate and Publish

Run the publisher tool from the directory containing your server.json:

bash
mcp-publisher login

This will open a browser window for GitHub OAuth device activation. Once authenticated, run:

bash
mcp-publisher pub

If successful, your server will be instantly live on the registry!


3. Submitting to Community Directories

Once you're on npm and the Official Registry, you should amplify your reach. Several community directories automatically ingest from the official registry, but others require manual submission.

I highly recommend submitting to:

  • Glama (glama.ai/mcp/servers)
  • Smithery (smithery.ai)
  • MCP Market (mcp.market)
  • AI Agents Directory (aiagentsdirectory.com)

If you're building tools for AI agents, you might also want to list your server on SkillFlow.builders, where we curate high-quality MCP servers with trust metrics and compatibility scores.

Conclusion

Publishing an MCP server is straightforward once you know the exact metadata required. By combining an npm package with an official registry manifest, you ensure that AI clients can seamlessly discover and execute your tools.

Have you built an interesting MCP server? Let me know in the comments!

Top comments (0)