Skip to main content
Glama

setup_api_key

Authenticate with StacksFinder to generate an API key for accessing Pro and Team tier features, including tech stack recommendations and scoring.

Instructions

Authenticates with your StacksFinder account and creates an API key. Requires Pro or Team tier. The key is returned once and should be saved securely.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesYour StacksFinder account email
passwordYesYour StacksFinder account password
keyNameNoOptional name for the API key

Implementation Reference

  • Executes the setup_api_key tool: authenticates with StacksFinder API using email/password, creates a new API key, handles errors with specific messages, and returns formatted response with key and setup instructions.
    export async function executeSetupApiKey( input: SetupApiKeyInput ): Promise<{ text: string; isError?: boolean; apiKey?: string }> { const config = getConfig(); const { email, password, keyName } = input; debug('Setting up API key for', email); try { const response = await fetch(`${config.apiUrl}/api/v1/mcp/setup`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, password, keyName: keyName || 'MCP Auto-generated' }) }); const data = (await response.json()) as SetupApiResponse; if (!response.ok || !data.success) { let errorMessage = data.message || data.error || 'Failed to create API key'; // Add helpful context for common errors if (data.error === 'TIER_REQUIRED') { errorMessage = `Pro or Team tier required. Upgrade at ${config.apiUrl}/pricing`; } else if (data.error === 'LIMIT_EXCEEDED') { errorMessage = `API key limit reached. Manage keys at ${config.apiUrl}/account/developer/api-keys`; } else if (data.error === 'INVALID_CREDENTIALS') { errorMessage = 'Invalid email or password. Please check your credentials.'; } return { text: `**Error**: ${errorMessage}`, isError: true }; } info('API key created successfully'); // Return the key with instructions const text = `## API Key Created Successfully **Key**: \`${data.apiKey}\` **Key ID**: ${data.keyId} **Prefix**: ${data.prefix} **IMPORTANT**: Save this key now - it cannot be retrieved again! ### Configure in Claude Code Run this command to add the key: \`\`\`bash claude mcp add-json stacksfinder '{"command": "npx", "args": ["-y", "@stacksfinder/mcp-server"], "env": {"STACKSFINDER_API_KEY": "${data.apiKey}"}}' \`\`\` Or set the environment variable: \`\`\`bash export STACKSFINDER_API_KEY="${data.apiKey}" \`\`\` ### Manage Your Keys View and manage keys at: ${config.apiUrl}/account/developer/api-keys`; return { text, apiKey: data.apiKey }; } catch (err) { if (err instanceof McpError) { return { text: err.toResponseText(), isError: true }; } const errorMessage = err instanceof Error ? err.message : 'Failed to setup API key'; return { text: `**Error**: ${errorMessage}\n\nMake sure you can reach ${config.apiUrl}`, isError: true }; } }
  • Zod input schema for the setup_api_key tool parameters.
    export const SetupApiKeyInputSchema = z.object({ email: z.string().email().describe('Your StacksFinder account email'), password: z.string().min(1).describe('Your StacksFinder account password'), keyName: z.string().max(100).optional().describe('Optional name for the API key') });
  • src/server.ts:268-288 (registration)
    Registers the setup_api_key tool with the MCP server, defining title, description, input schema, and handler that parses input and calls executeSetupApiKey.
    server.registerTool( setupApiKeyToolDefinition.name, { title: 'Setup API Key', description: setupApiKeyToolDefinition.description, inputSchema: { email: z.string().email().describe('Your StacksFinder account email'), password: z.string().min(1).describe('Your StacksFinder account password'), keyName: z.string().max(100).optional().describe('Optional name for the API key') } }, async (args) => { debug('setup_api_key called', args.email); const input = SetupApiKeyInputSchema.parse(args); const { text, isError } = await executeSetupApiKey(input); return { content: [{ type: 'text', text }], isError }; } );
  • Tool definition object with name and description, used during server registration.
    export const setupApiKeyToolDefinition = { name: 'setup_api_key', description: 'Authenticates with your StacksFinder account and creates an API key. Requires Pro or Team tier. The key is returned once and should be saved securely.' };

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/hoklims/stacksfinder-mcp'

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