Skip to content

Commit d2ac614

Browse files
authored
fix(amazonq): fix for mcp server permissions to prefer workspace agent config files (aws#2038)
1 parent cffc5ce commit d2ac614

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpEventHandler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,14 +1145,17 @@ export class McpEventHandler {
11451145

11461146
try {
11471147
// Skip server config check for Built-in server
1148+
const serverConfig = McpManager.instance.getAllServerConfigs().get(serverName)
11481149
if (serverName !== 'Built-in') {
1149-
const serverConfig = McpManager.instance.getAllServerConfigs().get(serverName)
11501150
if (!serverConfig) {
11511151
throw new Error(`Server '${serverName}' not found`)
11521152
}
11531153
}
11541154

1155-
const mcpServerPermission = await this.#processPermissionUpdates(updatedPermissionConfig)
1155+
const mcpServerPermission = await this.#processPermissionUpdates(
1156+
updatedPermissionConfig,
1157+
serverConfig?.__configPath__
1158+
)
11561159

11571160
// Store the permission config instead of applying it immediately
11581161
this.#pendingPermissionConfig = {
@@ -1347,10 +1350,7 @@ export class McpEventHandler {
13471350
/**
13481351
* Processes permission updates from the UI
13491352
*/
1350-
async #processPermissionUpdates(updatedPermissionConfig: any) {
1351-
// Get the appropriate agent path
1352-
const agentPath = await this.#getAgentPath()
1353-
1353+
async #processPermissionUpdates(updatedPermissionConfig: any, agentPath: string | undefined) {
13541354
const perm: MCPServerPermission = {
13551355
enabled: true,
13561356
toolPerms: {},

0 commit comments

Comments
 (0)