@j222/mcp-proxy-cli
v0.0.3
Published
Tool for make MCP proxy package
Downloads
5
Readme
mcp-npm-proxy
An NPX tool for deploying STDIO-based MCP (Model Context Protocol) servers to a hosted environment while publishing proxy packages to npm.
Overview
When you create a STDIO-based MCP server as an npm package, your source code becomes publicly visible. This tool solves that problem by:
- Hosting your MCP server privately on a secure server infrastructure
- Publishing a proxy package to npm that calls your hosted server
- Keeping your source code private while maintaining npm package compatibility
How It Works
- Upload: Your MCP server source code is uploaded to a private hosting service
- Build & Deploy: The server builds and deploys your MCP server in a secure environment
- Proxy Generation: A proxy npm package is automatically generated and published
- Client Connection: Users install your npm package, which proxies requests to your hosted server
Features
- 🔒 Private Source Code: Keep your MCP server implementation private
- 📦 NPM Compatibility: Publish as a standard npm package
- 🚀 Automatic Deployment: Seamless build and deployment process
- ✅ NPM Validation: Validates package permissions and version compatibility
- 📋 Smart File Detection: Automatically detects necessary files for deployment
- 🧹 Clean Process: Handles temporary files and cleanup automatically
Installation
npm install -g mcp-npm-toolSetup
1. Create Environment Configuration
Create a .tool-env file in your project root with the required tokens:
AUTH_TOKEN=your_deployment_auth_token
NPM_TOKEN=your_npm_auth_token2. Configure NPM Authentication
Create a .npmrc file in your project root:
//registry.npmjs.org/:_authToken=YOUR_NPM_TOKEN_HERE3. Project Requirements
Your project must have:
- A valid
package.jsonwith abinfield (required for MCP servers) - A
tsconfig.jsonortsconfig.build.jsonfile - Source code in directories specified by your TypeScript configuration
Usage
Navigate to your MCP server project directory and run:
npx mcp-npm-toolProcess Flow
- 🔍 Environment Validation: Reads authentication tokens from
.tool-env - 📦 Package Analysis: Parses
package.jsonand TypeScript configuration - ✅ NPM Validation:
- Checks if package exists on npm registry
- Validates version is higher than existing versions
- Verifies publish permissions
- 📋 File Collection: Automatically detects files needed for deployment
- 📦 Compression: Creates a zip archive of necessary files
- 📤 Upload: Securely uploads to the hosting service
- 🧹 Cleanup: Removes temporary files
File Inclusion
The tool automatically includes:
Always Included
package.jsontsconfig.jsonortsconfig.build.json
Source Code (from TypeScript config)
- Files matching
includepatterns (default:src/**/*) - Excludes files matching
excludepatterns
Additional Files (if present)
README.md,LICENSE,CHANGELOG.md.npmignore,.gitignore- Build configuration files:
jest.config.js/ts,webpack.config.js,rollup.config.jsvite.config.js/ts,babel.config.js/json,.babelrceslint.config.js,.eslintrc.js/jsonprettier.config.js,.prettierrc
Excluded Files
dist/**/*(build artifacts)node_modules/**/*(dependencies).git/**/*(git history)- Other temporary files and build outputs
API Endpoint
The tool uploads to: https://package.wildcoder.me/api/upload
Example MCP Server Package Structure
my-mcp-server/
├── package.json # Must include "bin" field
├── tsconfig.json
├── .tool-env # AUTH_TOKEN and NPM_TOKEN
├── .npmrc # NPM authentication
├── src/
│ ├── index.ts # Your MCP server entry point
│ └── lib/
│ └── handlers.ts # Your MCP server logic
└── README.mdpackage.json Requirements
Your package.json must include a bin field for MCP servers:
{
"name": "my-mcp-server",
"version": "1.0.0",
"bin": {
"my-mcp-server": "./dist/index.js"
},
"main": "./dist/index.js",
"files": ["dist/**/*"],
"scripts": {
"build": "tsc",
"prepublishOnly": "npm run build"
}
}Development
# Install dependencies
pnpm install
# Build the tool
pnpm run build
# Test locally
node dist/index.jsError Handling
The tool provides comprehensive error messages for common issues:
- Missing authentication tokens
- Invalid package.json or TypeScript configuration
- NPM permission issues
- Version conflicts
- Network connectivity problems
Security
- Authentication tokens are never logged or exposed
- Source code is transmitted securely to the hosting service
- NPM tokens are validated before any operations
License
ISC
