Skip to content

feat: add support to run a hook in the initialize #633

@afucher

Description

@afucher

Today the implementation of the initialize method is exclusive done by the java-sdk, without the possibility of the developer to customize it or run any code before the mcp server answer to the mcp client.

An example is to add some metrics about usage (telemetry):
As a developer that is creating an internal mcp server for my company,
I want to be able to run a custom code inside the initialize
So I can get metrics about the usage and improve it.

It can be a hook that will be called every time that the initialize is called. I saw 2 options:

  1. Allow the hook to change the InitializeResult
  2. Just run a hook that returns Void

Right now I don't need the first option, but it is more flexible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions