modelcontextprotocol / modelcontextprotocol/java-sdk

Allow custom or numeric request ID generation (Snowflake MCP server rejects string IDs)

オープン
#703 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement P3
主要言語
Java
スター
3.7k
フォーク
1.1k
平均マージ
1日 15時間
マージ済み PR(30日)
9

説明

Expected Behavior

The Java SDK should provide a way to configure how request IDs are generated. This could include:

  • A public interface or callback for supplying a custom RequestIdGenerator.
  • Configuration options to choose between UUID-based, string-based, or numeric-only IDs.

This would help support MCP servers that require strict numeric IDs or forbid UUID/string-based request IDs.

Current Behavior

Currently, the Java SDK:

  • Uses a private generateRequestId() method.
  • Uses an internal private counter.
  • Produces UUID-counter formatted IDs like "62d0970d-0".
  • Provides no public extension point to override or customize ID generation.

This causes compatibility issues with MCP servers (such as Snowflake's MCP implementation) that accept only numeric IDs.

Example (hypothetical API):

McpClient client = McpClient.builder()
    .withRequestIdGenerator(() -> String.valueOf(counter.incrementAndGet()))
    .build();

Context

When integrating with the Snowflake MCP server, requests are rejected because the Java SDK always generates UUID-based IDs.

Workarounds include:

  • Implementing a custom transport such as SimpleHttpTransport.
  • Remapping request and response IDs manually.

These solutions work but duplicate SDK logic and introduce unnecessary complexity. Providing a built-in, configurable ID generation mechanism would make the SDK more flexible and easier to use.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、private な generateRequestId() メソッドと内部カウンターを追跡し、次に McpClient の builder と transport が request ID をどのように渡しているかを調べます。SDK が既存の動作を維持したまま数値 ID を生成できる設定可能なジェネレーターを公開し、request ID と response ID の互換性が維持されていることを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。