modelcontextprotocol / modelcontextprotocol/kotlin-sdk

refactor: Unify workflow across server transports

Open
#518 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3 ready for work refactoring
Dominant language
Kotlin
Stars
1.5k
Forks
248
Avg merge
1d 20h
Merged PRs (30d)
23

Description

refactor: Unify workflow across server transports

Currently, there is duplication of workflow-management logic in server transports: atomic booleans for initialized/closed state, session management, etc

Similar to #517, but for server transports.

  • Consider unifying the client/server TransportState enum.
  • Consider moving more logic to AbstractTransport

Todo

  • Introduce AbstractServerTransport for handling common workflow logic, similar to AbstractClientTransport
  • WebSocket transport hierarchy should be refactored
  • Introduce transport state + state machine (FSM) for possible transitions
  • [TBD]
  • Profit

Definition of done

  • Current integration tests pass. Exception types might be changed for unification.
  • Unit test for edge cases, especially for the state machine

See #517

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing server transport implementations with AbstractClientTransport, then review the WebSocket transport hierarchy and the related work in #517. Define the shared transport states and valid transitions, refactor the common workflow into an AbstractServerTransport, and verify that integration tests and new state-machine edge-case tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
networking
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.