feat(cli): display MCP servers in agent permission dialog

Updates NewAgentsNotification to inspect the local agent definition and list any MCP servers that the agent introduces, providing users with the necessary visibility before enabling.
This commit is contained in:
Akhilesh Kumar
2026-03-12 19:06:42 +00:00
parent 164abf9d9b
commit 7a08a4fbd5
3 changed files with 43 additions and 11 deletions
@@ -22,9 +22,21 @@ describe('NewAgentsNotification', () => {
{
name: 'Agent B',
description: 'Description B',
kind: 'remote' as const,
agentCardUrl: '',
kind: 'local' as const,
inputConfig: { inputSchema: {} },
promptConfig: {},
modelConfig: {},
runConfig: {},
mcpServers: {
github: {
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-github'],
},
postgres: {
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-postgres'],
},
},
},
];
const onSelect = vi.fn();
@@ -80,16 +80,35 @@ export const NewAgentsNotification = ({
borderStyle="single"
padding={1}
>
{displayAgents.map((agent) => (
<Box key={agent.name}>
<Box flexShrink={0}>
<Text bold color={theme.text.primary}>
- {agent.name}:{' '}
</Text>
{displayAgents.map((agent) => {
const mcpServers =
agent.kind === 'local' ? agent.mcpServers : undefined;
const hasMcpServers =
mcpServers && Object.keys(mcpServers).length > 0;
return (
<Box key={agent.name} flexDirection="column">
<Box>
<Box flexShrink={0}>
<Text bold color={theme.text.primary}>
- {agent.name}:{' '}
</Text>
</Box>
<Text color={theme.text.secondary}>
{' '}
{agent.description}
</Text>
</Box>
{hasMcpServers && (
<Box marginLeft={2}>
<Text color={theme.text.secondary}>
(Includes MCP servers:{' '}
{Object.keys(mcpServers).join(', ')})
</Text>
</Box>
)}
</Box>
<Text color={theme.text.secondary}> {agent.description}</Text>
</Box>
))}
);
})}
{remaining > 0 && (
<Text color={theme.text.secondary}>
... and {remaining} more.
@@ -10,6 +10,7 @@ exports[`NewAgentsNotification > renders agent list 1`] = `
│ │ │ │
│ │ - Agent A: Description A │ │
│ │ - Agent B: Description B │ │
│ │ (Includes MCP servers: github, postgres) │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────────────────────────────────────┘ │
│ │