Skip to content

Add unit tests for mcp-client.ts #166

@ryoppippi

Description

@ryoppippi

Summary

The src/mcp-client.ts module currently lacks dedicated unit tests. While it is indirectly tested through integration tests in src/toolsets/tests/stackone.mcp-fetch.spec.ts, having unit tests would improve test coverage and make it easier to catch regressions.

Current State

  • mcp-client.ts is a thin wrapper around MCP SDK's Client and StreamableHTTPClientTransport
  • The createMCPClient function creates and returns these instances along with an asyncDispose method
  • No dedicated unit tests exist for this module

Suggested Tests

  • Verify Client and Transport are correctly initialised with provided options
  • Test that asyncDispose properly calls close() on both client and transport
  • Test header passing to transport
  • Test error handling for invalid URLs

Related Files

  • src/mcp-client.ts
  • src/toolsets/tests/stackone.mcp-fetch.spec.ts (integration tests)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions