Skip to content

Conversation

@peppescg
Copy link
Collaborator

@peppescg peppescg commented May 26, 2025

Add MSW, msw-endpoint and fixtures

Sample config for msw-endpoint


function mockMCPServers() {
  server.use(
    http.get(mswEndpoint("/api/v1beta/servers"), () => {
      return HttpResponse.json(fakeMCPs);
    }),
  );
}

@peppescg peppescg self-assigned this May 26, 2025
@peppescg peppescg linked an issue May 26, 2025 that may be closed by this pull request
@kantord
Copy link
Member

kantord commented May 26, 2025

I have a question. What is the point of the mswEndpoint helper? I was looking at the changes, but I cannot find any current usage of it either 🤔

could it be reused for some of the current examples?

@peppescg
Copy link
Collaborator Author

peppescg commented May 26, 2025

I have a question. What is the point of the mswEndpoint helper? I was looking at the changes, but I cannot find any current usage of it either 🤔

could it be reused for some of the current examples?

basically we used it in codegate for mocking a specific response of an endpoint in a test case, it is not implemented cause we don't have components that are calling thv APIs and we don't have tests on that. The idea is to add the all the configuration that we will need in future, and build the UI once we completed the requirements overview. So after tomorrow I would expect we can work on UI stuff too

@alex-mcgovern
Copy link
Contributor

I have a question. What is the point of the mswEndpoint helper? I was looking at the changes, but I cannot find any current usage of it either 🤔

could it be reused for some of the current examples?

It is a utility copied from the Codegate UI repo — basically, it infers a template literal type based on a path in the OpenAPI spec, so you get type-hints & type-checking.

We added this after we had some bugs where we were mocking non-existent endpoints (they had been renamed, I think), and it was messing with tests.

});
}),

http.get("*/api/v1beta/version", () => {
Copy link
Contributor

@alex-mcgovern alex-mcgovern May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the mswEndpoint helper here? (throughout entire file)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. I added it later but I forgot that I can replace the handlers path

@peppescg peppescg merged commit 37a0046 into main May 27, 2025
@alex-mcgovern alex-mcgovern deleted the issues/3 branch June 27, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Configure MSW

4 participants