modelcontextprotocol / modelcontextprotocol/java-sdk
Allow custom or numeric request ID generation (Snowflake MCP server rejects string IDs)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 3.7k
- Fork
- 1.1k
- Merge medio
- 1g 15h
- PR unite (30g)
- 9
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il metodo privato generateRequestId() e il contatore interno, quindi esamina come il builder di McpClient e il transport trasmettono gli ID delle richieste. Il lavoro è completato quando l'SDK espone un generatore configurabile in grado di produrre ID numerici preservando il comportamento esistente; verifica che gli ID delle richieste e delle risposte rimangano compatibili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- api
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100