File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,14 @@ export function activate(context: vscode.ExtensionContext) {
8484 console . dir ( "Logged out of PearAI:" )
8585 context . secrets . delete ( "pearai-token" )
8686 context . secrets . delete ( "pearai-refresh" )
87+ // Clear MCP server token
88+ const provider = await ClineProvider . getInstance ( )
89+ if ( provider ) {
90+ const mcpHub = provider . getMcpHub ( )
91+ if ( mcpHub ) {
92+ await mcpHub . clearPearAiApiKey ( )
93+ }
94+ }
8795 } ) ,
8896 )
8997
Original file line number Diff line number Diff line change @@ -505,6 +505,29 @@ export class McpHub {
505505 } )
506506 }
507507
508+ public async clearPearAiApiKey ( ) : Promise < void > {
509+ try {
510+ const settingsPath = await this . getMcpSettingsFilePath ( )
511+ const content = await fs . readFile ( settingsPath , "utf-8" )
512+ const config = JSON . parse ( content )
513+
514+ if ( config . mcpServers ?. pearai ) {
515+ config . mcpServers . pearai = {
516+ ...config . mcpServers . pearai ,
517+ args : [ "pearai-mcp" , "<PEARAI_API_KEY>" ] ,
518+ }
519+
520+ await fs . writeFile ( settingsPath , JSON . stringify ( config , null , 2 ) )
521+ await this . updateServerConnections ( config . mcpServers )
522+ vscode . window . showInformationMessage ( "PearAI API key cleared successfully" )
523+ }
524+ } catch ( error ) {
525+ console . error ( "Failed to clear PearAI API key:" , error )
526+ vscode . window . showErrorMessage ( "Failed to clear PearAI API key" )
527+ throw error
528+ }
529+ }
530+
508531 public async updatePearAiApiKey ( apiKey : string ) : Promise < void > {
509532 try {
510533 const settingsPath = await this . getMcpSettingsFilePath ( )
You can’t perform that action at this time.
0 commit comments