@@ -181,12 +181,6 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
181181
182182 try {
183183 await this . _configManager . loadConfig ( ) ;
184- const securityConfig = this . _configManager . getSecurityConfig ( ) ;
185- const validationConfig = this . _configManager . getValidationConfig ( ) ;
186- console . log ( '[RemixMCPServer] Middlewares connected:' ) ;
187- console . log ( ` - SecurityMiddleware: using ${ securityConfig . excludeTools ?. length || 0 } excluded tools` ) ;
188- console . log ( ` - ValidationMiddleware: strictMode=${ validationConfig . strictMode } , ${ Object . keys ( validationConfig . toolValidation || { } ) . length } tool-specific rules` ) ;
189-
190184 } catch ( error ) {
191185 console . log ( `[RemixMCPServer] Failed to load MCP config: ${ error . message } , using defaults` ) ;
192186 }
@@ -331,17 +325,21 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
331325
332326 // Get current user (default to 'default' role)
333327 const currentUser = 'default' ; // Can be extended to get from plugin context
334- console . log ( "checking permissions" )
335328 const permissionCheckResult = await this . checkPermissions ( call . name , currentUser ) ;
336- console . log ( "permissions checked" , permissionCheckResult )
329+
330+ const timestamp = Date . now ( ) ;
331+ const [ workspace , currentFile ] = await Promise . all ( [
332+ this . getCurrentWorkspace ( ) ,
333+ this . getCurrentFile ( )
334+ ] ) ;
337335
338336 const execution : ToolExecutionStatus = {
339337 id : executionId ,
340338 toolName : call . name ,
341339 startTime,
342340 status : 'running' ,
343341 context : {
344- workspace : await this . getCurrentWorkspace ( ) ,
342+ workspace,
345343 user : currentUser ,
346344 permissions : permissionCheckResult . userPermissions
347345 }
@@ -352,28 +350,22 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
352350
353351 try {
354352 const context = {
355- workspace : execution . context . workspace ,
356- currentFile : await this . getCurrentFile ( ) ,
353+ workspace,
354+ currentFile,
357355 permissions : permissionCheckResult . userPermissions ,
358- timestamp : Date . now ( ) ,
356+ timestamp,
359357 requestId : executionId
360358 } ;
361359
362- // STEP 1: Security Validation (uses MCPConfigManager for dynamic config)
363- console . log ( `[RemixMCPServer] Step 1: Security validation for tool '${ call . name } ' (using MCPConfigManager)` ) ;
364360 const securityResult = await this . _securityMiddleware . validateToolCall ( call , context , this . _plugin ) ;
365361
366362 if ( ! securityResult . allowed ) {
367363 console . log ( `[RemixMCPServer] Security validation FAILED for tool '${ call . name } ': ${ securityResult . reason } ` ) ;
368364 throw new Error ( `Security validation failed: ${ securityResult . reason } ` ) ;
369365 }
370- console . log ( `[RemixMCPServer] Security validation PASSED for tool '${ call . name } '` ) ;
371366
372- // STEP 2: Input Validation (uses MCPConfigManager for dynamic config)
373- console . log ( `[RemixMCPServer] Step 2: Input validation for tool '${ call . name } ' (using MCPConfigManager)` ) ;
374367 const toolDefinition = this . _tools . get ( call . name ) ;
375368 const inputSchema = toolDefinition ?. inputSchema ;
376-
377369 const validationResult = await this . _validationMiddleware . validateToolCall (
378370 call ,
379371 inputSchema ,
@@ -391,14 +383,12 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
391383 if ( validationResult . warnings . length > 0 ) {
392384 const warnings = validationResult . warnings . map ( w => w . message ) . join ( ', ' ) ;
393385 console . log ( `[RemixMCPServer] Input validation warnings for tool '${ call . name } ': ${ warnings } ` ) ;
394- } else {
395- console . log ( `[RemixMCPServer] Input validation PASSED for tool '${ call . name } '` ) ;
396386 }
397387
398- // STEP 3: File Write Permission Check (for file_write and file_create tools )
399- if ( call . name === 'file_write' || call . name === 'file_create' ) {
400- console . log ( `[RemixMCPServer] Step 3: File write permission check for tool ' ${ call . name } '` ) ;
401- const filePath = call . arguments ?. path || call . arguments ?. filePath ;
388+ // STEP 3: File Permision Check (for file operations )
389+ const fileOperations = [ 'file_write' , 'file_create' , 'file_delete' , 'file_move' , 'file_copy' ] ;
390+ if ( fileOperations . includes ( call . name ) ) {
391+ const filePath = call . arguments ?. path || call . arguments ?. filePath || call . arguments ?. from || call . arguments ?. source ;
402392
403393 if ( filePath ) {
404394 const permissionResult = await this . _filePermissionMiddleware . checkFileWritePermission (
@@ -407,10 +397,10 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
407397 ) ;
408398
409399 if ( ! permissionResult . allowed ) {
410- console . log ( `[RemixMCPServer] File write permission DENIED for '${ filePath } ': ${ permissionResult . reason } ` ) ;
411- throw new Error ( `File write permission denied: ${ permissionResult . reason || 'User denied the operation' } ` ) ;
400+ console . log ( `[RemixMCPServer] File operation permission DENIED for '${ filePath } ': ${ permissionResult . reason } ` ) ;
401+ throw new Error ( `File operation permission denied: ${ permissionResult . reason || 'User denied the operation' } ` ) ;
412402 }
413- console . log ( `[RemixMCPServer] File write permission GRANTED for '${ filePath } '` ) ;
403+ console . log ( `[RemixMCPServer] File operation permission GRANTED for '${ filePath } '` ) ;
414404 }
415405 }
416406
@@ -429,7 +419,6 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
429419 this . _stats . totalToolCalls ++ ;
430420
431421 trackMatomoEvent ( 'ai' , 'remixAI' , `mcp_tool_executed_${ call . name } ` ) ;
432- console . log ( `[RemixMCPServer] Tool '${ call . name } ' executed successfully` ) ;
433422 this . emit ( 'tool-executed' , execution ) ;
434423 return result ;
435424
@@ -491,8 +480,6 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
491480 async checkPermissions ( operation : string , user : string , resource ?: string ) : Promise < PermissionCheckResult > {
492481 try {
493482 const securityConfig = this . _configManager . getSecurityConfig ( ) ;
494- console . log ( "securityConfig" , securityConfig )
495- // If permissions
496483
497484 if ( ! securityConfig . permissions . requirePermissions ) {
498485 return {
@@ -504,9 +491,7 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
504491 }
505492
506493 const userPermissions = this . getUserPermissions ( user , securityConfig ) ;
507- console . log ( "userPermissions" , userPermissions )
508494 const requiredPermissions = this . getOperationPermissions ( operation ) ;
509- console . log ( "requiredPermissions" , requiredPermissions )
510495
511496 if ( userPermissions . includes ( '*' ) ) {
512497 return {
@@ -555,7 +540,6 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
555540 // Additional resource-specific checks
556541 if ( resource ) {
557542 const resourceCheck = this . checkResourcePermissions ( resource , userPermissions , securityConfig ) ;
558- console . log ( "Resource check:" , resourceCheck )
559543 if ( ! resourceCheck . allowed ) {
560544 // Log denied resource access
561545 this . logAuditEntry ( {
@@ -647,7 +631,6 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
647631 }
648632
649633 private getUserPermissions ( user : string , securityConfig : any ) : string [ ] {
650- console . log ( 'security config' , securityConfig )
651634 const permissions : string [ ] = [ ] ;
652635
653636 if ( securityConfig . permissions ?. defaultPermissions ) {
@@ -701,10 +684,14 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
701684 // Analysis
702685 'analyze_code' : [ 'analysis:static' ] ,
703686 'security_scan' : [ 'analysis:security' ] ,
704- 'estimate_gas' : [ 'analysis:gas' ]
687+ 'estimate_gas' : [ 'analysis:gas' ] ,
688+
689+ // Additional tools
690+ 'run_script' : [ 'transaction:send' ] ,
691+ 'simulate_transaction' : [ 'transaction:simulate' ]
705692 } ;
706693
707- return defaultPermissionMap [ operation ] || [ '*' ] ;
694+ return defaultPermissionMap [ operation ] || [ `tool: ${ operation } ` ] ;
708695 }
709696
710697 private checkResourcePermissions ( resource : string , userPermissions : string [ ] , securityConfig : any ) : { allowed : boolean ; reason ?: string } {
@@ -779,10 +766,7 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
779766 */
780767 async reloadConfig ( ) : Promise < void > {
781768 try {
782- console . log ( '[RemixMCPServer] Reloading MCP configuration...' ) ;
783769 const mcpConfig = await this . _configManager . reloadConfig ( ) ;
784- console . log ( '[RemixMCPServer] Configuration reloaded successfully' ) ;
785- console . log ( '[RemixMCPServer] Configuration summary:' , this . _configManager . getConfigSummary ( ) ) ;
786770 this . emit ( 'config-reloaded' , mcpConfig ) ;
787771 } catch ( error ) {
788772 console . log ( `[RemixMCPServer] Failed to reload config: ${ error . message } ` ) ;
@@ -796,7 +780,6 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
796780
797781 updateMCPConfig ( partialConfig : Partial < any > ) : void {
798782 this . _configManager . updateConfig ( partialConfig ) ;
799- console . log ( '[RemixMCPServer] Configuration updated at runtime' ) ;
800783 this . emit ( 'config-updated' , this . _configManager . getConfig ( ) ) ;
801784 }
802785
@@ -894,19 +877,13 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
894877 this . _resources . register ( compilationProvider ) ;
895878
896879 // Register deployment resource provider
897- const deploymentProvider = new DeploymentResourceProvider ( ) ;
880+ const deploymentProvider = new DeploymentResourceProvider ( this . _plugin ) ;
898881 this . _resources . register ( deploymentProvider ) ;
899882
900883 // Register tutorial resource provider
901884 const tutorialsProvider = new TutorialsResourceProvider ( this . _plugin ) ;
902885 this . _resources . register ( tutorialsProvider ) ;
903886
904- // Register Amp resource provider
905- /*
906- const ampProvider = new AmpResourceProvider(this._plugin);
907- this._resources.register(ampProvider);
908- */
909-
910887 // Register debugging resource provider
911888 const debuggingProvider = new DebuggingResourceProvider ( this . _plugin ) ;
912889 this . _resources . register ( debuggingProvider ) ;
0 commit comments