Proposal: Schema Generation Separation from Core SDK
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- php
- Ambito
- backend-api-design
Direzione di ricerca
Non vengono indicati file o test. Inizia esaminando la capacità Discovery e l’utilizzo di McpServer::addTool descritti nella proposta, quindi determina se la generazione dello schema può essere separata senza modificare il comportamento del protocollo; il lavoro sarebbe considerato completato solo con un’architettura e un piano di implementazione concordati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hey team!
The core protocol implementation is solid and provides exactly what developers need for building MCP servers.
Architectural Question I've Been Thinking About
I've been working with the SDK on some complex projects, and it got me thinking about the overall architecture. Currently, schema generation is built into the core SDK through the Discovery capability, but I'm wondering if we might want to consider a more modular approach.
Current State
Right now, the SDK handles both:
- ✅ Core MCP Protocol - JSON-RPC transport, message handling, server lifecycle
- ✅ Schema Generation - Converting PHP types to JSON Schema for tool discovery
This works great for getting started, but I'm noticing it creates some coupling between the protocol layer and schema generation logic.
What I'm Proposing
What if we moved toward a philosophy where the SDK focuses purely on being an excellent MCP protocol implementation, and schema generation becomes a separate concern handled by dedicated packages?
Core SDK Responsibilities
// Pure protocol focus
$server = new McpServer($transport);
$server->addTool('my_tool', $callable, $schema); // Schema provided externally
$server->run();
Schema Generation as Separate Packages
// Developer chooses their preferred schema generator
use McpSchemaGenerators\Spiral\SchemaGenerator;
use McpSchemaGenerators\JsonMapper\SchemaGenerator;
use McpSchemaGenerators\Custom\MySchemaGenerator;
$generator = new SpiralSchemaGenerator();
$schema = $generator->generateFromCallable($myToolMethod);
$server->addTool('my_tool', $myToolMethod, $schema);
Benefits I See
🎯 Single Responsibility: Core SDK just handles MCP protocol brilliantly
🔧 Flexibility: Developers pick schema generators that fit their needs
📦 Smaller Core: SDK stays lightweight and focused
🚀 Innovation: Schema generation can evolve independently
🧪 Experimentation: Easy to try different approaches without SDK changes
Questions for Discussion
- Does this architectural direction make sense for the project's goals?
- Would this approach make the SDK more or less approachable for newcomers?
- Are there any protocol-level reasons why schema generation needs to be tightly coupled?
- Should we consider this for a future major version, or could it work as an evolution?
I think this could make the SDK both more powerful for complex use cases and simpler for developers who just want the protocol handling. The current implementation could become the "batteries included" reference implementation in a separate package.
What are your thoughts on this direction? I'd be happy to explore a proof of concept if it seems like something worth investigating.
Context
I've been building task management and workflow tools where I need rich schema generation for complex nested objects, but I also want the flexibility to integrate with existing validation systems in my applications. Having the choice of schema generators would solve both problems cleanly.
- Lingua principale
- PHP
- Stelle
- 1.6k
- Fork
- 173
- Merge medio
- 2g 49m
- PR unite (30g)
- 23
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.
Altre issue di modelcontextprotocol/php-sdk
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan ApertaServer
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
modelcontextprotocol/php-sdk#468 · 2 commenti ·
-
needs confirmation needs maintainer action Server
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/php-sdk#398 · 1 reazione ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/php-sdk#370 ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
modelcontextprotocol/php-sdk#510 · 1 commento ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
modelcontextprotocol/php-sdk#504 ·
Tutte le issue di modelcontextprotocol/php-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
getgrav/grav-plugin-form#656 ·
-
customer-support needs-triage Platform(Default)
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Перевод устарел
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100