Skip to content

Allow custom annotations for MCP elements #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Clap404
Copy link

@Clap404 Clap404 commented Jul 31, 2025

I'd like to use custom annotations that extends the ones provided by php-mcp.

I've discovered that some of the annotations I'd like to inherit were final and that the provided Discoverer would not match subclasses of the annotations. I'm not sure if it's accidental or by design.

This change would allow me to use the default Discoverer with custom annotations instead of making my own.

@judus
Copy link

judus commented Jul 31, 2025

Out of curiosity — may I ask what concrete use case you’re trying to support with this?

I’ve been exploring this area myself, and I might be misunderstanding something, but from what I can tell, the MCP server maintains a fairly static registry. Either through attribute discovery or manual registration. The container seems focused on injecting dependencies into tool handlers, not on dynamically filtering or scoping tools — which makes sense, given how shallow PSR-11 is.

So if this PR is about enabling more dynamic resolution, I’m wondering whether this kind of logic really belongs at the attribute level or whether we might eventually need a more expressive registry or tool resolution layer instead?

If the goal is extensibility via attributes, I’d lean toward defining interfaces rather than relying on inheritance. That might offer a cleaner extension point while keeping the existing classes final and predictable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants