set_credentials
Configure API credentials for the Fastly Next-Gen Web Application Firewall to enable security management through AI assistants.
Instructions
Set Fastly NGWAF API credentials (email and access token)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Your Fastly NGWAF email address | ||
| token | Yes | Your Fastly NGWAF API access token |
Implementation Reference
- server.js:847-860 (handler)MCP tool handler for 'set_credentials': instantiates FastlyNGWAFClient, sets credentials via client.setCredentials(), tests connection with testConnection(), and prepares result with success/validation info.case 'set_credentials': client = new FastlyNGWAFClient(); result = client.setCredentials(typedArgs.email, typedArgs.token); // Test the connection to validate the credentials try { const connectionTest = await client.testConnection(); result.message = `Credentials set and validated successfully. Access to ${connectionTest.corporationsCount} corporations.`; result.email = connectionTest.email; } catch (error) { result.success = false; result.error = error.message; } break;
- server.js:398-408 (schema)Tool definition including name, description, and input schema (JSON Schema object with required email and token strings). Used for registration in ListTools response.name: 'set_credentials', description: 'Set Fastly NGWAF API credentials (email and access token)', inputSchema: { type: 'object', properties: { email: { type: 'string', description: 'Your Fastly NGWAF email address' }, token: { type: 'string', description: 'Your Fastly NGWAF API access token' }, }, required: ['email', 'token'], }, },
- server.js:24-29 (helper)FastlyNGWAFClient.setCredentials method: stores email/token instance properties and sets axios default headers for authentication.setCredentials(email, token) { this.email = email; this.token = token; this.api.defaults.headers.common['x-api-user'] = email; this.api.defaults.headers.common['x-api-token'] = token; return { success: true, authenticated: true };
- server.js:814-816 (registration)Registers the list tools handler which returns the tools array containing 'set_credentials' definition.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });