Skip to content

Add define_custom_method to define custom methods (and notifications) #75

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 1 commit into
base: main
Choose a base branch
from

Conversation

atesgoral
Copy link
Contributor

@atesgoral atesgoral commented Jul 15, 2025

Closes #2

Adds define_custom_method to Server to allow definition of custom methods (outside the MCP spec). Method blocks that return nil become custom notifications.

Motivation and Context

MCP supports both servers and clients to send notifications. And notifications are not limited to what's defined by the spec.

This PR adds flexibility for servers to receive custom method calls and notifications from clients/hosts.

Servers can implement cutting-edge MCP methods before this gem implements them.

Custom notifications from host to server allow use cases like diagnostic logging, capturing of multimodal LLM transcripts, etc. by piggybacking on MCP instead of implementing custom endpoints.

How Has This Been Tested?

New unit tests

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@atesgoral atesgoral marked this pull request as ready for review July 15, 2025 00:12
Copy link
Member

@koic koic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were to raise one minor concern, it would be whether supporting methods outside the MCP specification is entirely suitable. That said, based on the explanation in the PR, it seems there’s a clear rationale for needing such functionality.

Both the documentation and the implementation look solid 👍

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.

support notifications
2 participants