Merge branch 'main' into fix-required
This commit is contained in:
commit
95975c58e7
2 changed files with 2188 additions and 354 deletions
|
|
@ -41,6 +41,7 @@ jest.mock("@modelcontextprotocol/sdk/client/auth.js", () => ({
|
|||
startAuthorization: jest.fn(),
|
||||
exchangeAuthorization: jest.fn(),
|
||||
discoverOAuthProtectedResourceMetadata: jest.fn(),
|
||||
selectResourceURL: jest.fn(),
|
||||
}));
|
||||
|
||||
// Import the functions to get their types
|
||||
|
|
@ -88,7 +89,7 @@ describe("AuthDebugger", () => {
|
|||
const defaultAuthState = EMPTY_DEBUGGER_STATE;
|
||||
|
||||
const defaultProps = {
|
||||
serverUrl: "https://example.com",
|
||||
serverUrl: "https://example.com/mcp",
|
||||
onBack: jest.fn(),
|
||||
authState: defaultAuthState,
|
||||
updateAuthState: jest.fn(),
|
||||
|
|
@ -203,7 +204,7 @@ describe("AuthDebugger", () => {
|
|||
|
||||
// Should first discover and save OAuth metadata
|
||||
expect(mockDiscoverOAuthMetadata).toHaveBeenCalledWith(
|
||||
new URL("https://example.com"),
|
||||
new URL("https://example.com/"),
|
||||
);
|
||||
|
||||
// Check that updateAuthState was called with the right info message
|
||||
|
|
@ -320,6 +321,7 @@ describe("AuthDebugger", () => {
|
|||
isInitiatingAuth: false,
|
||||
resourceMetadata: null,
|
||||
resourceMetadataError: null,
|
||||
resource: null,
|
||||
oauthTokens: null,
|
||||
oauthStep: "metadata_discovery",
|
||||
latestError: null,
|
||||
|
|
@ -361,7 +363,7 @@ describe("AuthDebugger", () => {
|
|||
});
|
||||
|
||||
expect(mockDiscoverOAuthMetadata).toHaveBeenCalledWith(
|
||||
new URL("https://example.com"),
|
||||
new URL("https://example.com/"),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -496,11 +498,11 @@ describe("AuthDebugger", () => {
|
|||
it("should successfully fetch and display protected resource metadata", async () => {
|
||||
const updateAuthState = jest.fn();
|
||||
const mockResourceMetadata = {
|
||||
resource: "https://example.com/api",
|
||||
resource: "https://example.com/mcp",
|
||||
authorization_servers: ["https://custom-auth.example.com"],
|
||||
bearer_methods_supported: ["header", "body"],
|
||||
resource_documentation: "https://example.com/api/docs",
|
||||
resource_policy_uri: "https://example.com/api/policy",
|
||||
resource_documentation: "https://example.com/mcp/docs",
|
||||
resource_policy_uri: "https://example.com/mcp/policy",
|
||||
};
|
||||
|
||||
// Mock successful metadata discovery
|
||||
|
|
@ -538,7 +540,7 @@ describe("AuthDebugger", () => {
|
|||
// Wait for the metadata to be fetched
|
||||
await waitFor(() => {
|
||||
expect(mockDiscoverOAuthProtectedResourceMetadata).toHaveBeenCalledWith(
|
||||
"https://example.com",
|
||||
"https://example.com/mcp",
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -584,7 +586,7 @@ describe("AuthDebugger", () => {
|
|||
// Wait for the metadata fetch to fail
|
||||
await waitFor(() => {
|
||||
expect(mockDiscoverOAuthProtectedResourceMetadata).toHaveBeenCalledWith(
|
||||
"https://example.com",
|
||||
"https://example.com/mcp",
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -594,7 +596,7 @@ describe("AuthDebugger", () => {
|
|||
expect.objectContaining({
|
||||
resourceMetadataError: mockError,
|
||||
// Should use the original server URL as fallback
|
||||
authServerUrl: new URL("https://example.com"),
|
||||
authServerUrl: new URL("https://example.com/"),
|
||||
oauthStep: "client_registration",
|
||||
}),
|
||||
);
|
||||
|
|
@ -602,7 +604,7 @@ describe("AuthDebugger", () => {
|
|||
|
||||
// Verify that regular OAuth metadata discovery was still called
|
||||
expect(mockDiscoverOAuthMetadata).toHaveBeenCalledWith(
|
||||
new URL("https://example.com"),
|
||||
new URL("https://example.com/"),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -519,6 +519,7 @@ describe("Sidebar Environment Variables", () => {
|
|||
label: "Request Timeout",
|
||||
description: "Timeout for requests to the MCP server (ms)",
|
||||
value: 5000,
|
||||
is_session_item: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -544,6 +545,7 @@ describe("Sidebar Environment Variables", () => {
|
|||
description:
|
||||
"Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
|
||||
value: "http://localhost:8080",
|
||||
is_session_item: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -569,6 +571,7 @@ describe("Sidebar Environment Variables", () => {
|
|||
description:
|
||||
"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",
|
||||
value: 10000,
|
||||
is_session_item: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -591,6 +594,7 @@ describe("Sidebar Environment Variables", () => {
|
|||
label: "Request Timeout",
|
||||
description: "Timeout for requests to the MCP server (ms)",
|
||||
value: 0,
|
||||
is_session_item: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -637,6 +641,7 @@ describe("Sidebar Environment Variables", () => {
|
|||
label: "Request Timeout",
|
||||
description: "Timeout for requests to the MCP server (ms)",
|
||||
value: 3000,
|
||||
is_session_item: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue