Skip to content

fix(amazonq): update mcp and persona config to agent config #1897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ashishrp-aws
Copy link
Contributor

Problem

We need to update the mcp config and persona config to the new agent config format for Agent building and parity with Q CLI

Solution

  • Update to use agent config
  • migrate mcp and persona config to agent during initialization
  • Remove disable button for now to support agent config.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ashishrp-aws ashishrp-aws requested a review from a team as a code owner July 15, 2025 06:55
@ashishrp-aws ashishrp-aws reopened this Jul 15, 2025
// Get agent paths
const wsAgentPaths = getWorkspaceAgentConfigPaths(wsUris)
const globalAgentPath = getGlobalAgentConfigPath(workspace.fs.getUserHomeDir())
const allAgentPaths = [...wsAgentPaths, globalAgentPath]

const wsPersonaPaths = getWorkspacePersonaConfigPaths(wsUris)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused, why we still keep the persona? could you shared the final decision that Chay's aligned?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not keeping persona at all. removed this

"report_issue",
"use_aws"
],
"allowedTools": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will only control ask/always right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


// Initialize permissions for this server
// Check if server is enabled (either as @server or has specific tools like @server/tool)
const serverPrefix = `@${name}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we don't support enable/disable anymore? also, do we expect to have any tools in the allowedtools section if the server is missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't. removed the isEnabled check in toolPerms

const toolId = `${serverPrefix}/${toolName}`

if (permission === McpPermissionType.deny) {
// For deny: if server is enabled as a whole, we need to switch to individual tools
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deny is pretty much the disable before, so currently we remove the server level enable/disable, but still keep the tool level ones right? is this aligned with Chay and Matt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, deny is not disable at server level. we check deny for tool permissions, so we enable rest of the tools and deny/remove the denied tools.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I mean is deny is the tool level disable right? do we need to block it from been adding to the Agent and memory?

@@ -825,7 +998,9 @@ export class McpManager {
* Check if a tool requires approval.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need to two mutate method above? if yes, it means there are some changes needed right? all CRUD methods shouldn't touch both mcp and persona files anymore right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not touching mcp and persona files at all. i removed the mutate functions for both


// Convert tools and permissions
if (persona.toolPerms) {
// Track which servers have specific tools enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should handle * in persona as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • for mcp servers right. since we don't have disbaled anymore. there are way to many edge cases, so far migration i'm keeping all tools default to Ask unless it it alwaysAllowed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the current customer, it could has persona that contains * right?, just want to make sure it will be handled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter if it *, we just enable all tools for all servers. Since there is no disable server anymore


// Read MCP server configs directly from files
const serverConfigs: Record<string, MCPServerConfig> = {}
for (const configPath of configPaths) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still care about handling the conflicts? like same server in all 4 files with different settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't....we should gloabl at global level.

Copy link
Contributor

@bywang56 bywang56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mentioned you have some other changes needed right? or all of them are included in this PR already, also, do we need a custom build for regression tests before merging to main?

@ashishrp-aws
Copy link
Contributor Author

ashishrp-aws commented Jul 18, 2025

You mentioned you have some other changes needed right?

All the changes are here in this PR.

do we need a custom build for regression tests before merging to main?

Yes, want to test with a custom build to test before with team. can arrange one on friday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants