Skip to main content
Glama

owner

Manage npm package ownership by listing, adding, or removing owners for specific packages using clear actions.

Instructions

Manage package owners

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform
packageYesPackage name
userNoUsername (required for add/rm)
otpNoOne-time password for 2FA

Implementation Reference

  • The handler function for the 'owner' tool, which constructs the npm command arguments and executes them.
    async ({ action, package: pkg, user, otp }) => {
      const args = ["owner", action, pkg];
      if (user && (action === "add" || action === "rm")) args.push(user);
      if (otp) args.push("--otp", otp);
      try {
        const { stdout } = await run(args);
        return { content: [{ type: "text", text: stdout }] };
      } catch (e: any) {
        return {
          content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
          isError: true,
        };
      }
    },
  • Zod schema definition for the 'owner' tool arguments.
    {
      action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
      package: z.string().describe("Package name"),
      user: z.string().optional().describe("Username (required for add/rm)"),
      otp: z.string().optional().describe("One-time password for 2FA"),
    },
  • src/index.ts:207-230 (registration)
    Full registration of the 'owner' tool using server.tool.
    server.tool(
      "owner",
      "Manage package owners",
      {
        action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
        package: z.string().describe("Package name"),
        user: z.string().optional().describe("Username (required for add/rm)"),
        otp: z.string().optional().describe("One-time password for 2FA"),
      },
      async ({ action, package: pkg, user, otp }) => {
        const args = ["owner", action, pkg];
        if (user && (action === "add" || action === "rm")) args.push(user);
        if (otp) args.push("--otp", otp);
        try {
          const { stdout } = await run(args);
          return { content: [{ type: "text", text: stdout }] };
        } 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