Skip to main content
Glama

unpublish

Remove a package version from the npm registry using the npm-mcp server. Specify package name with optional version, force option for entire packages, and OTP for 2FA authentication.

Instructions

Remove a package version from the registry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYesPackage name with optional version (e.g. pkg@1.0.0)
forceNoForce unpublish (required for entire package)
otpNoOne-time password for 2FA

Implementation Reference

  • Implementation of the 'unpublish' tool handler.
    server.tool(
      "unpublish",
      "Remove a package version from the registry",
      {
        package: z.string().describe("Package name with optional version (e.g. pkg@1.0.0)"),
        force: z.boolean().optional().describe("Force unpublish (required for entire package)"),
        otp: z.string().optional().describe("One-time password for 2FA"),
      },
      async ({ package: pkg, force, otp }) => {
        const args = ["unpublish", pkg];
        if (force) args.push("--force");
        if (otp) args.push("--otp", otp);
        try {
          const { stdout, stderr } = await run(args);
          return { content: [{ type: "text", text: stdout + stderr }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikusnuz/npm-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server