modelcontextprotocol / modelcontextprotocol/php-sdk

Proposal: Extract Discovery module from core SDK for better modularity

Abierto
#44 4 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

needs confirmation
Lenguaje dominante
PHP
Estrellas
1.6k
Forks
173
Merge medio
2 d 49 min
PR fusionados (30 d)
23

Descripción

Hey team,

I can see a lot of thought went into making the developer experience smooth with the Discovery module. The automatic scanning and registration is definitely a nice convenience feature.

I was reviewing the SDK architecture and noticed that the Discovery functionality is currently bundled directly into the core SDK package. While this makes getting started really easy, I'm wondering if we might want to consider a different approach for the long-term health of the project.

Here's what I'm thinking about:

Maintenance and Release Complexity

The Discovery module brings in some pretty heavy dependencies like symfony/finder and phpdocumentor/reflection-docblock, plus it includes custom tokenization logic. This means the SDK's release cycle could get tangled up with Discovery-related updates.

Framework Integration Challenges

I've been looking at how this would integrate with frameworks like Spiral, Laravel, and Symfony, and they already have really mature discovery systems with optimized caching and pre-compilation. It seems like we might be asking framework developers to choose between using their battle-tested discovery systems or staying compatible with our SDK approach.

Architectural Separation

What do you think about splitting this into separate concerns? Something like:

  • Keep the SDK focused on the core MCP protocol implementation (message handling, JSON-RPC transport, tool schemas)
  • Move Discovery into either a separate mcp/discovery package or framework-specific integrations
  • Let applications choose the discovery approach that fits their architecture

This way:

  • The core SDK stays lightweight with minimal dependencies
  • Framework integrations can use their native discovery systems
  • Standalone apps can still use convenient auto-discovery if they want
  • We can evolve Discovery independently from protocol updates

Specific Benefits

For microservices that just need manual tool registration, they wouldn't carry the file scanning dependencies. Framework developers could contribute optimized integrations for their specific ecosystems. And SDK maintenance could focus on what it does best - implementing the MCP protocol cleanly.

I might be missing some context about the design decisions here, so I'd love to hear your thoughts! Is there a specific reason Discovery needs to be in the core SDK, or would a more modular approach work better?

Happy to discuss this further or help with any refactoring if the team thinks this direction makes sense.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se nombran archivos ni pruebas específicos. Empieza revisando el módulo Discovery del SDK principal, incluidas sus dependencias symfony/finder, phpdocumentor/reflection-docblock y las dependencias de tokenización personalizadas, y después compara el límite de paquete propuesto para mcp/discovery con las integraciones para Spiral, Laravel y Symfony. La tarea estará terminada cuando el equipo haya acordado un diseño de extracción y los límites de su integración con los frameworks.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
backend-api-design
Tipo de issue
Refactorización
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.