configure_api_token
Set or update the Railway API token for authentication in railway-mcp server. Use this tool during initial setup or token changes to enable secure API access.
Instructions
[UTILITY] Configure the Railway API token for authentication (only needed if not set in environment variables)
⚡️ Best for: ✓ Initial setup ✓ Token updates ✓ Authentication configuration
⚠️ Not for: × Project configuration × Service settings × Environment variables
→ Next steps: project_list, service_list
→ Related: project_create
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Railway API token (create one at https://railway.app/account/tokens) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"token": {
"description": "Railway API token (create one at https://railway.app/account/tokens)",
"type": "string"
}
},
"required": [
"token"
],
"type": "object"
}
Implementation Reference
- src/tools/config.tool.ts:29-51 (handler)The async handler function that implements the 'configure_api_token' tool logic. It sets the API token via railwayClient.setToken and returns a success or error message.async ({ token }) => { try { await railwayClient.setToken(token); return { content: [ { type: "text" as const, text: `✅ Successfully connected to Railway API`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `❌ Failed to connect to Railway API: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }
- src/tools/config.tool.ts:27-29 (schema)The Zod input schema for the tool, requiring a 'token' string parameter.token: z.string().describe("Railway API token (create one at https://railway.app/account/tokens)") }, async ({ token }) => {
- src/tools/config.tool.ts:6-52 (registration)The tool 'configure_api_token' is registered/created using createTool, which defines its name, description, schema, and handler. This is part of the exported configTools array.createTool( "configure_api_token", formatToolDescription({ type: 'UTILITY', description: "Configure the Railway API token for authentication (only needed if not set in environment variables)", bestFor: [ "Initial setup", "Token updates", "Authentication configuration" ], notFor: [ "Project configuration", "Service settings", "Environment variables" ], relations: { nextSteps: ["project_list", "service_list"], related: ["project_create"] } }), { token: z.string().describe("Railway API token (create one at https://railway.app/account/tokens)") }, async ({ token }) => { try { await railwayClient.setToken(token); return { content: [ { type: "text" as const, text: `✅ Successfully connected to Railway API`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `❌ Failed to connect to Railway API: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } )