Skip to main content
Glama

crafty_login

Authenticate to Crafty Controller using username and password credentials to obtain a bearer token for API access.

Instructions

Login with username and password to get a bearer token. Use this if you prefer username/password authentication over a pre-generated API token.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesCrafty Controller username
passwordYesCrafty Controller password
totpNoTOTP/2FA code (required if MFA is enabled on the account)

Implementation Reference

  • The handler function for the crafty_login tool.
    async ({ username, password, totp }) => {
      try {
        const data = await client.login(username, password, totp);
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
      }
    }
  • Zod schema definition for crafty_login input arguments.
    {
      username: z.string().describe("Crafty Controller username"),
      password: z.string().describe("Crafty Controller password"),
      totp: z
        .string()
        .optional()
        .describe("TOTP/2FA code (required if MFA is enabled on the account)"),
    },
  • src/tools/auth.ts:6-26 (registration)
    Registration of the crafty_login tool within the MCP server.
    server.tool(
      "crafty_login",
      "Login with username and password to get a bearer token. Use this if you prefer username/password authentication over a pre-generated API token.",
      {
        username: z.string().describe("Crafty Controller username"),
        password: z.string().describe("Crafty Controller password"),
        totp: z
          .string()
          .optional()
          .describe("TOTP/2FA code (required if MFA is enabled on the account)"),
      },
      async ({ username, password, totp }) => {
        try {
          const data = await client.login(username, password, totp);
          return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          return { content: [{ type: "text", text: `Error: ${msg}` }], 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/HadiCherkaoui/crafty-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server