Merge pull request #270 from leoshimo/leo/269-show-initialize-request-in-history
feat: Show initialize request/response in History panel (#269)
This commit is contained in:
@@ -17,6 +17,8 @@ const mockClient = {
|
|||||||
connect: jest.fn().mockResolvedValue(undefined),
|
connect: jest.fn().mockResolvedValue(undefined),
|
||||||
close: jest.fn(),
|
close: jest.fn(),
|
||||||
getServerCapabilities: jest.fn(),
|
getServerCapabilities: jest.fn(),
|
||||||
|
getServerVersion: jest.fn(),
|
||||||
|
getInstructions: jest.fn(),
|
||||||
setNotificationHandler: jest.fn(),
|
setNotificationHandler: jest.fn(),
|
||||||
setRequestHandler: jest.fn(),
|
setRequestHandler: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -335,8 +335,19 @@ export function useConnection({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let capabilities;
|
||||||
try {
|
try {
|
||||||
await client.connect(clientTransport);
|
await client.connect(clientTransport);
|
||||||
|
|
||||||
|
capabilities = client.getServerCapabilities();
|
||||||
|
const initializeRequest = {
|
||||||
|
method: "initialize",
|
||||||
|
};
|
||||||
|
pushHistory(initializeRequest, {
|
||||||
|
capabilities,
|
||||||
|
serverInfo: client.getServerVersion(),
|
||||||
|
instructions: client.getInstructions(),
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to connect to MCP Server via the MCP Inspector Proxy: ${mcpProxyServerUrl}:`,
|
`Failed to connect to MCP Server via the MCP Inspector Proxy: ${mcpProxyServerUrl}:`,
|
||||||
@@ -353,8 +364,6 @@ export function useConnection({
|
|||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const capabilities = client.getServerCapabilities();
|
|
||||||
setServerCapabilities(capabilities ?? null);
|
setServerCapabilities(capabilities ?? null);
|
||||||
setCompletionsSupported(true); // Reset completions support on new connection
|
setCompletionsSupported(true); // Reset completions support on new connection
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user