To create your own MCP server installer based on this template:
- Clone this repository:
git clone https://github.com/yourorg/mcp-server-installer-template.git cd mcp-server-installer-template - Edit
src/install.ts:- Update the
SERVER_CONFIGobject at the top with your server's name and endpoint. - (Optional) Update the
CLI_NAMEconstant to match your desired CLI command.pg-mcp-server-installeris the generic name which is generally fine.
- Update the
- Edit
package.json:- Change the
"bin"field to your desired CLI command name (should matchCLI_NAMEinsrc/install.ts). - Update
"name"and other metadata as needed.
- Change the
- Build the project:
npm run build
- Test locally:
npm link your-cli-name install
- Publish to npm (optional):
npm publish
Now your installer is ready for your MCP server!
| What to Change | Where to Change | Example |
|---|---|---|
| Server name/endpoint | src/install.ts |
SERVER_CONFIG object |
| CLI command name | package.json (bin) |
"my-mcp-server-installer" |
| Package metadata | package.json |
"name", "author", etc. |
This project provides a CLI installer for configuring Claude Desktop to use a custom MCP server with bearer token authentication.
package.jsondefines the CLI command name (via thebinfield) and points to the compiled JavaScript entry point (e.g.,dist/install.js).src/install.tscontains the installer logic and server-specific configuration constants (such as server name and endpoint).- The CLI command (e.g.,
my-mcp-server-installer) is set inpackage.jsonand referenced in help messages ininstall.ts. - Server-specific values (like the Claude config entry name and endpoint) are set as constants in
install.ts.
-
Edit
src/install.ts- Set your server name and endpoint at the top of the file:
const SERVER_NAME = 'Your Server Name'; const ENDPOINT = 'https://your-endpoint.example.com/sse';
- Set your server name and endpoint at the top of the file:
-
Edit
package.json- Set the CLI command name in the
binfield:"bin": { "my-mcp-server-installer": "./dist/install.js" }
- This makes the CLI available as
npx my-mcp-server-installerafter publishing or linking.
- Set the CLI command name in the
-
Build the Installer
npm run build # or npx tsc
- Run the installer directly with ts-node:
npx ts-node src/install.ts install
- Or, build and run the compiled JS:
npm run build node dist/install.js install
- Install globally for local testing:
npm link my-mcp-server-installer install
- Or use npx (after publishing to npm):
npx my-mcp-server-installer install
- Prompts for a bearer token.
- Adds or updates an entry in your Claude Desktop config (e.g.,
claude_desktop_config.json) with the specified server name and endpoint. - The config entry will look like:
"Your Server Name": { "command": "npx", "args": [ "mcp-remote", "https://your-endpoint.example.com/sse", "--header", "Authorization: Bearer <YOUR_TOKEN>" ], "env": {} }
- To create a new installer for a different server, just update the constants at the top of
src/install.tsand the CLI name inpackage.jsonif desired.
- The CLI command name is set in
package.jsonand should be referenced in help messages in your code for consistency. - Server-specific values only need to be set in
src/install.ts.
For more details, see the comments in src/install.ts and package.json.
# Install the MCP server
npx my-mcp-server-installer install
# Check installation status
npx my-mcp-server-installer status
# Uninstall the MCP server
npx my-mcp-server-installer uninstallThis installer:
- Prompts for your bearer token
- Finds your Claude Desktop config file automatically
- Adds your MCP server configuration with token authentication
- Works across macOS, Windows, and Linux
The installer automatically finds your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
├── src/
│ └── install.ts # Main installer logic (TypeScript)
├── dist/ # Compiled JavaScript (generated)
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file
- Tokens are stored in your local Claude Desktop config file
- The config file is only readable by your user account
- No tokens are transmitted or stored elsewhere
- Node.js 18 or higher
- Claude Desktop installed
- Valid bearer token for your MCP server
# Install dependencies
npm install
# Build TypeScript
npm run build
# Test locally
node dist/install.js installMIT