Deploxy is a REAL proxy for deploying Stdio MCP server to serverless platform.
- Deploying your Stdio MCP Server to NPM package with Deploxy.
- Transforming it into a secure, private MCP server.
- Keeping your source code safe while providing users with a lightweight proxy package to install.
git clone https://github.com/deploxy/quick-start.git
cd quick-startBefore you begin, you must have a .npmrc file in your project root that is configured for publishing packages to NPM.
@${YOUR_NPM_SCOPE}:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${YOUR_NPM_TOKEN}Important: Your NPM token should never be committed to version control. It is best practice to load it from an environment variable like
NPM_TOKEN.
First, ensure your project is ready to be published as a standard NPM package.
- Configure
package.json: Make sure yourpackage.jsonhas the requiredname,version,bin, andfilesproperties set correctly. - Build Your Project: Install dependencies and run your build script.
npm install npm run build
To understand the problem Deploxy solves, let's first publish the package the traditional way.
npm publish --access publicNow, go to your package's page on NPM (https://www.npmjs.com/package/YOUR_PACKAGE_NAME) and click on the "Code" tab. You will see that all your built code from the dist directory is publicly visible.
Important: This step is for this quick start demonstration only. In a real production, you will skip this step entirely.
-
Create the file
You have two options to create the
.deploxy.jsonfile.Option 1: Use the CLI
Run the following command in your project root:
npx @deploxy/cli init
Option 2: Use the Dashboard
Go to the Deploy new project to create a new project, then copy the generated JSON configuration into a
.deploxy.jsonfile in your project root. -
Add your Auth Token: Open the file and add your
authToken. If you don't have one, you can get it from the Tokens page.{ "authToken": "your-auth-token-here", "defaultDeployRegion": "us-east-1", "stdioArgsIndex": "--args", "mcpPath": "/mcp", "packageType": "js" "injectedEnv": {}, }
Now, instead of npm publish, run the deploy command.
Note: If you completed Step 4 and published a version to NPM, you must increment the
versionin yourpackage.jsonbefore runningdeploy. Both NPM and Deploxy require a new version for each deployment.
npx @deploxy/cli deployYou can monitor the deployment status on the Deploxy Dashboard.
Once deployment is complete, check your package page on NPM again. You will see that the code has been replaced with the Deploxy proxy client, which looks like this:
import { spawn } from "child_process";
import { configs } from "./configs.js";
import { parseConfigs } from "./lib.js";
function main() {
const options = parseConfigs(configs);
const mcp = spawn("npx", ["-y", "@deploxy/proxy@latest", ...options], {
stdio: "inherit",
});
mcp.stdout?.on("data", (data) => {
console.log(data.toString());
});
mcp.stderr?.on("data", (data) => {
console.error(data.toString());
});
mcp.on("error", (error) => {
console.error("MCP Proxy Error:");
console.error(error);
process.exit(1);
});
mcp.on("exit", process.exit);
}
main();That's it! Your package is now deployed with Deploxy, keeping your source code private while providing a secure proxy for your users.
When you deploy with Deploxy, you're not just publishing a package; you're creating a secure, private backend for your MCP server.
The code that end-users download and run via npx is a lightweight proxy client. This proxy client takes user requests (like a ToolCall) and streams them to your actual MCP server, which is running securely in the serverless cloud. This architecture allows you to focus on your core business logic without worrying about exposing sensitive information. You'll understand immediately once you inspect your published package on NPM after deployment.
-
authToken: This is the token required to authenticate and deploy your package to Deploxy. -
defaultDeployRegion: This is the default AWS region where your MCP server will run if the end-user does not specify a particular region. To give your end-users the fastest experience, they can specify a region using the--regionflag when they run your package (npx -y your-pkg --region us-east-1). If the flag is omitted, this default region is used.With the Deploxy Pro plan, the
--regionparameter is not needed. Requests are automatically routed to the nearest region for the end-user. -
stdioArgsIndex: This option specifies the arguments that are passed directly to your MCP server. For example, when an end-user runsnpx -y your-pkg --args user-api-key, your server can accessuser-api-keyfromprocess.argv. -
injectedEnv: This is an object of environment variables that are accessible only within your MCP server (e.g.,process.env.DATABASE_URL). These are completely hidden from the end-user because they only interact with the proxy client, not your secure server code. -
mcpPathandpackageType: You generally don't need to change these.
Security Warning: The
.deploxy.jsonfile contains your sensitiveauthToken. Never commit this file to a public repository. Ensure it is listed in your.gitignorefile.