mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-18 10:01:29 -07:00
Update mcp's list function to check for disablement. (#21148)
This commit is contained in:
@@ -16,7 +16,6 @@ describe('McpStatus', () => {
|
||||
servers: {
|
||||
'server-1': {
|
||||
url: 'http://localhost:8080',
|
||||
name: 'server-1',
|
||||
description: 'A test server',
|
||||
},
|
||||
},
|
||||
@@ -200,6 +199,38 @@ describe('McpStatus', () => {
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('renders correctly with both blocked and unblocked servers', async () => {
|
||||
const { lastFrame, unmount, waitUntilReady } = render(
|
||||
<McpStatus
|
||||
{...baseProps}
|
||||
servers={{
|
||||
...baseProps.servers,
|
||||
'server-2': {
|
||||
url: 'http://localhost:8081',
|
||||
description: 'A blocked server',
|
||||
},
|
||||
}}
|
||||
blockedServers={[{ name: 'server-2', extensionName: 'test-extension' }]}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('renders only blocked servers when no configured servers exist', async () => {
|
||||
const { lastFrame, unmount, waitUntilReady } = render(
|
||||
<McpStatus
|
||||
{...baseProps}
|
||||
servers={{}}
|
||||
blockedServers={[{ name: 'server-1', extensionName: 'test-extension' }]}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('renders correctly with a connecting server', async () => {
|
||||
const { lastFrame, unmount, waitUntilReady } = render(
|
||||
<McpStatus {...baseProps} connectingServers={['server-1']} />,
|
||||
|
||||
@@ -48,7 +48,12 @@ export const McpStatus: React.FC<McpStatusProps> = ({
|
||||
showDescriptions,
|
||||
showSchema,
|
||||
}) => {
|
||||
const serverNames = Object.keys(servers);
|
||||
const serverNames = Object.keys(servers).filter(
|
||||
(serverName) =>
|
||||
!blockedServers.some(
|
||||
(blockedServer) => blockedServer.name === serverName,
|
||||
),
|
||||
);
|
||||
|
||||
if (serverNames.length === 0 && blockedServers.length === 0) {
|
||||
return (
|
||||
@@ -82,7 +87,6 @@ export const McpStatus: React.FC<McpStatusProps> = ({
|
||||
|
||||
<Text bold>Configured MCP servers:</Text>
|
||||
<Box height={1} />
|
||||
|
||||
{serverNames.map((serverName) => {
|
||||
const server = servers[serverName];
|
||||
const serverTools = tools.filter(
|
||||
|
||||
@@ -17,12 +17,6 @@ A test server
|
||||
exports[`McpStatus > renders correctly with a blocked server 1`] = `
|
||||
"Configured MCP servers:
|
||||
|
||||
🟢 server-1 - Ready (1 tool)
|
||||
A test server
|
||||
Tools:
|
||||
- tool-1
|
||||
A test tool
|
||||
|
||||
🔴 server-1 (from test-extension) - Blocked
|
||||
"
|
||||
`;
|
||||
@@ -83,6 +77,19 @@ A test server
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`McpStatus > renders correctly with both blocked and unblocked servers 1`] = `
|
||||
"Configured MCP servers:
|
||||
|
||||
🟢 server-1 - Ready (1 tool)
|
||||
A test server
|
||||
Tools:
|
||||
- tool-1
|
||||
A test tool
|
||||
|
||||
🔴 server-2 (from test-extension) - Blocked
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`McpStatus > renders correctly with expired OAuth status 1`] = `
|
||||
"Configured MCP servers:
|
||||
|
||||
@@ -172,3 +179,10 @@ A test server
|
||||
A test tool
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`McpStatus > renders only blocked servers when no configured servers exist 1`] = `
|
||||
"Configured MCP servers:
|
||||
|
||||
🔴 server-1 (from test-extension) - Blocked
|
||||
"
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user