MP-201a · Module 3

Publishing & Distribution

3 min read

Publishing an MCP server follows the same patterns as publishing any package, with one addition: you need to tell users how to configure their MCP client to connect. For npm packages, publish with a bin field in package.json that points to your compiled entry point. Users install globally with npm install -g your-mcp-server and add it to their client config with the command set to the package name. For Python servers, publish to PyPI with a console_scripts entry point.

Documentation is the difference between a server people use and a server people abandon after five minutes. Your README needs four sections: what the server does (one paragraph), how to install it (one command), how to configure it (the exact JSON to paste into claude_desktop_config.json or config.toml), and what tools are available (name, description, and example inputs for each). If your server needs environment variables or API keys, document exactly which ones and how to obtain them.

{
  "name": "@yourorg/mcp-weather",
  "version": "1.0.0",
  "description": "MCP server for weather data",
  "type": "module",
  "bin": {
    "mcp-weather": "./dist/index.js"
  },
  "files": ["dist"],
  "scripts": {
    "build": "tsc",
    "prepare": "npm run build"
  },
  "keywords": ["mcp", "mcp-server", "weather"],
  "engines": {
    "node": ">=20"
  },
  "dependencies": {
    "@modelcontextprotocol/sdk": "^1.0.0"
  }
}
  1. Add the bin field Point it to your compiled entry point. Add a shebang (#!/usr/bin/env node) to the top of your source file so it runs as a CLI. Add "files": ["dist"] to publish only built output.
  2. Write the config snippet Include the exact JSON users paste into their MCP client config. Show both stdio and npx-based configurations. Test the snippet yourself before publishing — a typo in the config example wastes hours of user time.
  3. Publish and verify Run `npm publish`. Then test installation from scratch: `npm install -g your-package`, configure a client, and call every tool. The fresh-install experience is the only test that matters.