deprecate
Mark npm package versions as deprecated to warn users about outdated or insecure releases. Specify version ranges and add custom messages to guide users toward better alternatives.
Instructions
Deprecate a version of a package
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package | Yes | Package@version range (e.g. pkg@<1.0.0) | |
| message | Yes | Deprecation message (empty string to undeprecate) | |
| otp | No | One-time password for 2FA |
Implementation Reference
- src/index.ts:189-200 (handler)The handler function that executes the `npm deprecate` command using the provided arguments and returns the result.
async ({ package: pkg, message, otp }) => { const args = ["deprecate", pkg, message]; if (otp) args.push("--otp", otp); try { const { stdout, stderr } = await run(args); return { content: [{ type: "text", text: stdout + stderr || (message ? "Deprecated successfully" : "Undeprecated successfully") }], }; } catch (e: any) { return { content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }], isError: true, - src/index.ts:184-188 (schema)Zod schema defining the input arguments for the "deprecate" tool.
{ package: z.string().describe("Package@version range (e.g. pkg@<1.0.0)"), message: z.string().describe("Deprecation message (empty string to undeprecate)"), otp: z.string().optional().describe("One-time password for 2FA"), }, - src/index.ts:181-183 (registration)Registration of the "deprecate" tool on the MCP server.
server.tool( "deprecate", "Deprecate a version of a package",