fix: update mock MCP server configuration in tests

- Add status: 'connected' to mock MCP server
- Add proper config object with transport details
- Update test snapshots to reflect connected MCP server state
- Fixes failing tests after MCP server filtering implementation
This commit is contained in:
Daniel Riccio 2025-08-05 17:35:34 -05:00
parent 1aa827450c
commit 7e92618e43
No known key found for this signature in database
GPG key ID: FFD5FD825F8E8209
4 changed files with 62 additions and 4 deletions

View file

@ -519,7 +519,7 @@ The Model Context Protocol (MCP) enables communication between the system and MC
When a server is connected, you can use the server's tools via the `use_mcp_tool` tool, and access the server's resources via the `access_mcp_resource` tool.
## test-server (`test-command`)
## Creating an MCP Server
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. If they do, you should obtain detailed instructions on this topic using the fetch_instructions tool, like this:

View file

@ -519,7 +519,7 @@ The Model Context Protocol (MCP) enables communication between the system and MC
When a server is connected, you can use the server's tools via the `use_mcp_tool` tool, and access the server's resources via the `access_mcp_resource` tool.
## test-server (`test-command`)
## Creating an MCP Server
The user may ask you something along the lines of "add a tool" that does some function, in other words to create an MCP server that provides tools and resources that may connect to external APIs for example. If they do, you should obtain detailed instructions on this topic using the fetch_instructions tool, like this:

View file

@ -170,7 +170,36 @@ const mockContext = {
// Instead of extending McpHub, create a mock that implements just what we need
const createMockMcpHub = (withServers: boolean = false): McpHub =>
({
getServers: () => (withServers ? [{ name: "test-server", disabled: false }] : []),
getServers: () =>
withServers
? [
{
name: "test-server",
disabled: false,
status: "connected",
config: JSON.stringify({ command: "test-command" }),
tools: [],
resourceTemplates: [],
resources: [],
instructions: undefined,
},
]
: [],
getAllServers: () =>
withServers
? [
{
name: "test-server",
disabled: false,
status: "connected",
config: JSON.stringify({ command: "test-command" }),
tools: [],
resourceTemplates: [],
resources: [],
instructions: undefined,
},
]
: [],
getMcpServersPath: async () => "/mock/mcp/path",
getMcpSettingsFilePath: async () => "/mock/settings/path",
dispose: async () => {},

View file

@ -170,7 +170,36 @@ const mockContext = {
// Instead of extending McpHub, create a mock that implements just what we need
const createMockMcpHub = (withServers: boolean = false): McpHub =>
({
getServers: () => (withServers ? [{ name: "test-server", disabled: false }] : []),
getServers: () =>
withServers
? [
{
name: "test-server",
disabled: false,
status: "connected",
config: JSON.stringify({ command: "test-command" }),
tools: [],
resourceTemplates: [],
resources: [],
instructions: undefined,
},
]
: [],
getAllServers: () =>
withServers
? [
{
name: "test-server",
disabled: false,
status: "connected",
config: JSON.stringify({ command: "test-command" }),
tools: [],
resourceTemplates: [],
resources: [],
instructions: undefined,
},
]
: [],
getMcpServersPath: async () => "/mock/mcp/path",
getMcpSettingsFilePath: async () => "/mock/settings/path",
dispose: async () => {},