Skip to main content
Glama

access

Manage npm package access levels and permissions. Set visibility to public or restricted, grant or revoke team permissions, and view current access settings.

Instructions

Set or view access level on published packages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform
packageNoPackage name
levelNoAccess level (for set action)
teamNoTeam name in org:team format (for grant/revoke)
permissionNoPermission level (for grant action)
otpNoOne-time password for 2FA

Implementation Reference

  • Registration and handler implementation for the "access" tool, which manages npm package access levels using the npm CLI.
    server.tool(
      "access",
      "Set or view access level on published packages",
      {
        action: z.enum(["list", "get", "set", "grant", "revoke"]).describe("Action to perform"),
        package: z.string().optional().describe("Package name"),
        level: z
          .enum(["public", "restricted"])
          .optional()
          .describe("Access level (for set action)"),
        team: z.string().optional().describe("Team name in org:team format (for grant/revoke)"),
        permission: z
          .enum(["read-only", "read-write"])
          .optional()
          .describe("Permission level (for grant action)"),
        otp: z.string().optional().describe("One-time password for 2FA"),
      },
      async ({ action, package: pkg, level, team, permission, otp }) => {
        const args = ["access"];
        switch (action) {
          case "list":
            args.push("list", "packages");
            if (pkg) args.push(pkg);
            break;
          case "get":
            args.push("get", "status");
            if (pkg) args.push(pkg);
            break;
          case "set":
            if (level === "public") args.push("public");
            else args.push("restricted");
            if (pkg) args.push(pkg);
            break;
          case "grant":
            args.push("grant", permission || "read-only");
            if (team) args.push(team);
            if (pkg) args.push(pkg);
            break;
          case "revoke":
            args.push("revoke");
            if (team) args.push(team);
            if (pkg) args.push(pkg);
            break;
        }
        if (otp) args.push("--otp", otp);
        try {
          const { stdout } = await run(args);
          return { content: [{ type: "text", text: stdout || "Done" }] };
        } 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