Skip to content

Refactor: extract typed internal API clients for MCP tools #494

Description

@phernandez

Refactor: extract typed internal API clients for MCP tools

Why

Many MCP tools are thin HTTP clients + formatting with hardcoded paths. This duplicates URL construction, error mapping, and response validation across tools.

Scope

  • Introduce typed internal clients such as:
    • ProjectApi
    • KnowledgeApi
    • ResourceApi
    • SearchApi
  • Each client:
    • exposes typed methods (e.g. resolve_identifier, read_resource, recent_activity)
    • centralizes path building and error handling
  • MCP tools become adapters that call these clients and format results.

Acceptance criteria

  • No hardcoded API paths inside individual MCP tools (or significantly reduced).
  • Centralized error mapping produces consistent ToolError/user messaging.
  • MCP layer stays at 100% (practical) coverage.

Dependencies

  • Best after containers + config injection so tools get a client instance/factory.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions