Skip to content

[Refactor] Add a small factory for MCP test clients #66

@Robbo-lab

Description

@Robbo-lab

Issue Type

  • Bug report
  • Feature request
  • Documentation update
  • Other (please specify)

Other: factory / test-infrastructure improvement

Description

The MCP test setup already has reusable client code, but the request setup is still fairly manual. A small factory would make test setup cleaner and easier to extend. This is a good fit for v0.0.1 because it improves infrastructure now and helps later work in v0.0.2.

Steps to Reproduce (for bugs)

  1. Open tests/mcp/conftest.py
  2. Review how the MCP test client and request defaults are set up
  3. Note that common setup values are still handled fairly manually
  4. Observe that a small factory would make reuse and extension easier

Expected behaviour

Test infrastructure should have one small factory/helper for creating MCP test clients with shared defaults.

Actual behaviour

The current setup works, but common test-client setup details are more manual than they need to be.

Screenshots

Not applicable.

Additional context

Proposed scope:

  • Add a small factory/helper for creating MCP test clients
  • Include the common request defaults in one place
  • Keep it focused on test infrastructure only
  • Do not change production code behavior

Out of scope:

  • A full dependency injection system
  • Refactoring the whole test suite at once
  • Changing MCP protocol behavior
  • Production client factories

Acceptance criteria:

  • A small MCP test client factory exists in test infrastructure
  • Common setup values are defined in one place
  • Tests can use the factory instead of repeating setup details
  • Production behavior stays unchanged

Possible Solution

Add one small helper like build_mcp_test_client() that creates the client with default headers, protocol version, and initialization values. Start by using it in one or two tests first.

Your Environment (for bugs):

  • Operating System: N/A
  • Browser (if applicable): N/A
  • Version of the software: current main branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Test infrastructureFeature request or issue with the Test infrastructureenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    Status
    In progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions