Skip to main content
Glama

whoami

Check which npm user is currently authenticated. If not logged in, set NPM_TOKEN environment variable in MCP configuration.

Instructions

Check which npm user is currently authenticated. If not logged in, set NPM_TOKEN env var in MCP config.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the 'whoami' MCP tool handler.
    async () => {
      try {
        const { stdout } = await run(["whoami"]);
        return { content: [{ type: "text", text: stdout.trim() }] };
      } catch (e: any) {
        const hint = NPM_TOKEN
          ? "Token is set but invalid."
          : "No NPM_TOKEN set. Add it to your MCP server config env, or run `npm login` first.";
        return {
          content: [{ type: "text", text: `Not logged in. ${hint}\n${e.stderr || e.message}` }],
          isError: true,
  • src/index.ts:281-284 (registration)
    Registration of the 'whoami' tool.
    server.tool(
      "whoami",
      "Check which npm user is currently authenticated. If not logged in, set NPM_TOKEN env var in MCP config.",
      {},

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