clear_auth
Clear authentication tokens and sessions on CyberMCP to prevent unauthorized access and mitigate risks associated with authentication bypass vulnerabilities in backend APIs.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "clear_auth"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/authentication.ts:243-255 (handler)The inline handler function for the clear_auth MCP tool. It retrieves the AuthManager singleton instance and calls its clearAuth() method to reset the authentication state, then returns a confirmation message.
const authManager = AuthManager.getInstance(); authManager.clearAuth(); return { content: [ { type: "text", text: "Authentication cleared. The server is no longer authenticated.", }, ], }; } ); - src/tools/authentication.ts:239-256 (registration)Registers the clear_auth tool on the MCP server within the registerAuthenticationTools function. Uses empty schema (no inputs) and the inline handler above.
server.tool( "clear_auth", {}, async () => { const authManager = AuthManager.getInstance(); authManager.clearAuth(); return { content: [ { type: "text", text: "Authentication cleared. The server is no longer authenticated.", }, ], }; } ); - src/utils/authManager.ts:81-83 (helper)Supporting method in AuthManager class that implements the core logic of clearing authentication by resetting the authState to unauthenticated state.
public clearAuth(): void { this.authState = { type: 'none' }; }