kotlin-sdk/kotlin-sdk-server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Maria Tigina 4645ebfd17
Server feature list changed and resource updated notifications (#441)
<!-- Provide a brief summary of your changes -->

## Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->
Implemented thread-safe notification service following eventual
consistency principle.
Fixes https://github.com/modelcontextprotocol/kotlin-sdk/issues/249
Contracts:
* If the client connection and feature update happened in the same
thread, the timestamps of the events will be consequent
```
server.connect(client)
server.add(feature)
// client will receive the notification
```

```
server.add(feature)
server.connect(client)
// client will NOT receive the notification
```
* If the client connection and feature update happened in the different
threads, both options can be possible

The flow of the notification is explained in the diagram:

<img width="663" height="413" alt="image"
src="https://github.com/user-attachments/assets/e2c4c108-53dd-408d-97ef-97110ce5c979"
/>

Documentation references:

https://modelcontextprotocol.io/specification/2025-06-18/server/prompts#list-changed-notification

https://modelcontextprotocol.io/specification/2025-06-18/server/tools#list-changed-notification

https://modelcontextprotocol.io/specification/2025-06-18/server/resources#list-changed-notification

https://modelcontextprotocol.io/specification/2025-06-18/server/resources#subscriptions

Questions:
* I haven't found the subscription confirmed response message content
docs, how it should look like?

## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->
Multiple tests with various notification scenarios were added

## Breaking Changes
<!-- Will users need to update their code or configurations? -->

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->
2025-12-03 17:38:33 +02:00
..
api Server feature list changed and resource updated notifications (#441) 2025-12-03 17:38:33 +02:00
src Server feature list changed and resource updated notifications (#441) 2025-12-03 17:38:33 +02:00
build.gradle.kts Kotlin-MCP can't be used without ktor-bom starting from 0.7.5 (#390) (#392) 2025-11-12 15:32:54 +02:00
Module.md Add module documentation and enhance Dokka configuration (#261) 2025-09-15 17:44:43 +02:00