create-container-registry-auth
Generate authentication credentials for private container registries to enable secure image pulls in RunPod deployments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the container registry auth | |
| username | Yes | Registry username | |
| password | Yes | Registry password |
Implementation Reference
- src/index.ts:788-803 (handler)Handler function that executes the tool by making an authenticated POST request to RunPod's /containerregistryauth endpoint with name, username, and password.async (params) => { const result = await runpodRequest( '/containerregistryauth', 'POST', params ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:783-787 (schema)Input schema defined using Zod for validating the tool parameters: name, username, and password.{ name: z.string().describe('Name for the container registry auth'), username: z.string().describe('Registry username'), password: z.string().describe('Registry password'), },
- src/index.ts:781-804 (registration)Registration of the 'create-container-registry-auth' tool on the MCP server using server.tool(), specifying name, input schema, and handler function.server.tool( 'create-container-registry-auth', { name: z.string().describe('Name for the container registry auth'), username: z.string().describe('Registry username'), password: z.string().describe('Registry password'), }, async (params) => { const result = await runpodRequest( '/containerregistryauth', 'POST', params ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } );
- src/index.ts:27-66 (helper)Shared helper function used by the handler (and other tools) to make authenticated API requests to the RunPod service.async function runpodRequest( endpoint: string, method: string = 'GET', body?: Record<string, unknown> ) { const url = `${API_BASE_URL}${endpoint}`; const headers = { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }; const options: NodeFetchRequestInit = { method, headers, }; if (body && (method === 'POST' || method === 'PATCH')) { options.body = JSON.stringify(body); } try { const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`RunPod API Error: ${response.status} - ${errorText}`); } // Some endpoints might not return JSON const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { return await response.json(); } return { success: true, status: response.status }; } catch (error) { console.error('Error calling RunPod API:', error); throw error; } }