# Publishing to NPM
## Prerequisites
1. Create an NPM account at https://www.npmjs.com
2. Have Node.js and npm installed
3. Ensure your package builds successfully
## Publishing Steps
### 1. Update Package Information
Before publishing, update these fields in `package.json`:
- `name`: Must be unique on NPM (check with `npm view package-name`)
- `author`: Your name and email
- `repository.url`: Your GitHub repository URL
- `bugs.url`: Your GitHub issues URL
- `homepage`: Your GitHub repository homepage
### 2. Check Package Name Availability
```bash
npm view typefully-mcp-server
# If it shows an error, the name is available
# If it shows package info, the name is taken
```
If the name is taken, consider these alternatives:
- `@your-username/typefully-mcp-server` (scoped package)
- `typefully-mcp`
- `mcp-typefully-server`
- `typefully-claude-mcp`
### 3. Login to NPM
```bash
npm login
# Enter your NPM credentials
```
Verify you're logged in:
```bash
npm whoami
```
### 4. Build and Test
```bash
# Build the project
npm run build
# Test the package structure
npm pack --dry-run
# Test locally
npm run test
```
### 5. Publish
```bash
npm publish
```
### 6. Verify Publication
After publishing, verify it worked:
```bash
# Check your package exists
npm view your-package-name
# Test installation
npx your-package-name --help
```
## Updating the Package
For future updates:
```bash
# Update version (patch: 1.0.0 -> 1.0.1)
npm version patch
# Or minor version (1.0.0 -> 1.1.0)
npm version minor
# Or major version (1.0.0 -> 2.0.0)
npm version major
# Rebuild and republish
npm run build
npm publish
```
## After Publishing
1. Update your README to reflect the new NPX installation method
2. Test the NPX command: `npx your-package-name`
3. Update Claude Desktop documentation with the NPX method
4. Consider creating a GitHub release
## NPX Usage
Once published, users can run your package with:
```bash
# Run directly without installation
npx your-package-name
# Or install globally
npm install -g your-package-name
your-package-name
```
## Troubleshooting
### Package Name Conflicts
If your desired name is taken, use a scoped package:
```bash
npm publish --access public
```
### 403 Forbidden Error
- Ensure you're logged in: `npm whoami`
- Check package name isn't taken
- For scoped packages, add `--access public`
### Build Errors
- Run `npm run build` first
- Check all files are included in `package.json` `files` array
- Verify `bin` field points to correct file