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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:285-295 (handler)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.", {},