| Filename | Latest commit message | Latest commit date |
|---|---|---|
Bumps `mcp-kotlin` from 0.8.1 to 0.9.0. Updates `io.modelcontextprotocol:kotlin-sdk-client` from 0.8.1 to 0.9.0 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/modelcontextprotocol/kotlin-sdk/releases">io.modelcontextprotocol:kotlin-sdk-client's releases</a>.</em></p> <blockquote> <h2>0.9.0</h2> <h2>What's Changed</h2> <h3>Breaking Changes</h3> <ul> <li><strong>Server call handlers now receive a <code>RequestContext</code></strong> — handler lambdas for tools, prompts, and resources have a new <code>context</code> parameter providing access to request metadata (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/515">#515</a>) by <a href="https://github.com/rnett"><code>@rnett</code></a></li> <li><strong>Ktor extension functions moved from <code>Routing</code> to <code>Route</code></strong> — update call sites: <code>routing { mcpSse() }</code> → <code>route("/mcp") { mcpSse() }</code> or use directly in any <code>Route</code> block (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/531">#531</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> <li><strong><code>StdioServerTransport</code> rethrows <code>CancellationException</code></strong> — cancellation is no longer silently swallowed; <code>ReadBuffer</code> parsing was also fixed (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/571">#571</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> </ul> <h3>New Features</h3> <ul> <li><strong><code>kotlin-sdk-testing</code> module</strong> — new artifact providing an in-process, channel-based <code>TestClientTransport</code> / <code>TestServerTransport</code> for unit testing MCP servers and clients without network I/O (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/505">#505</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> <li><strong><code>StreamableHttpServerTransport.Configuration</code></strong> — configurable builder for the Streamable HTTP server transport (timeouts, session handling, etc.) (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/560">#560</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> <li><strong>Ktor extensions for Streamable HTTP</strong> — <code>mcpStreamableHttp()</code> Ktor plugin and routing DSL for mounting a Streamable HTTP MCP server (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/504">#504</a> by <a href="https://github.com/devcrocod"><code>@devcrocod</code></a>, <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/568">#568</a> by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a>)</li> <li><strong><code>$defs</code> support in <code>ToolSchema</code></strong> — JSON Schema <code>$defs</code> / definitions can now be expressed in tool input schemas (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/526">#526</a>) by <a href="https://github.com/i1bro"><code>@i1bro</code></a></li> </ul> <h3>Bug Fixes</h3> <ul> <li>Fixed SSE transport endpoint resolution for non-root mount paths (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/565">#565</a>) by <a href="https://github.com/Amaneusz"><code>@Amaneusz</code></a></li> <li>Fixed <code>StdioClientTransport</code> hanging indefinitely by adding proper read timeouts (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/528">#528</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> </ul> <h3>Improvements</h3> <ul> <li>Introduced <code>AbstractClientTransport</code> base class, simplifying client transport lifecycle management (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/516">#516</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> <li>Deprecation cycle started — annotated APIs scheduled for removal in a future release (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/498">#498</a>) by <a href="https://github.com/devcrocod"><code>@devcrocod</code></a></li> <li>Detekt static analysis integrated into CI (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/493">#493</a>, <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/507">#507</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> <li>Code coverage reporting added via Codecov (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/579">#579</a>, <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/580">#580</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> <li>Flaky <code>StdioClientTransport</code> tests replaced with real stdin pipe–based tests (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/508">#508</a>) by <a href="https://github.com/kpavlov"><code>@kpavlov</code></a></li> </ul> <h3>Dependency Updates</h3> <ul> <li>Kotest 6.1.2, MockK 1.14.9, AtomicFU 0.31.0, Gradle 9.3.1, Kover 0.9.7</li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/jskjw157"><code>@jskjw157</code></a> made their first contribution in <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/486">modelcontextprotocol/kotlin-sdk#486</a></li> <li><a href="https://github.com/i1bro"><code>@i1bro</code></a> made their first contribution in <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/526">modelcontextprotocol/kotlin-sdk#526</a></li> <li><a href="https://github.com/localden"><code>@localden</code></a> made their first contribution in <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/536">modelcontextprotocol/kotlin-sdk#536</a></li> <li><a href="https://github.com/aozherelyeva"><code>@aozherelyeva</code></a> made their first contribution in <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/551">modelcontextprotocol/kotlin-sdk#551</a></li> <li><a href="https://github.com/rnett"><code>@rnett</code></a> made their first contribution in <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/515">modelcontextprotocol/kotlin-sdk#515</a></li> <li><a href="https://github.com/Amaneusz"><code>@Amaneusz</code></a> made their first contribution in <a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/565">modelcontextprotocol/kotlin-sdk#565</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.4...0.9.0">https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.4...0.9.0</a></p> <h2>0.8.4</h2> <h2>Changes</h2> <ul> <li>feat: Ktor extensions for streamable http (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/504">#504</a>) by <a href="https://github.com/devcrocod"><code>@devcrocod</code></a></li> <li>fix: Add $defs to ToolSchema and tests (<a href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/526">#526</a>) by <a href="https://github.com/i1bro"><code>@i1bro</code></a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
| .. | ||
| gradle | ||
| src | ||
| build.gradle.kts | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| mcp-inspector-config.json | ||
| README.md | ||
| settings.gradle.kts | ||
Kotlin MCP Server
A sample MCP server demonstrating multiple transport modes: STDIO, SSE (plain), and SSE (Ktor plugin).
Note: The SSE transport modes are provided for backward compatibility. For new projects, consider using the simple-streamable-server sample, which uses the recommended Streamable HTTP transport.
Overview
This sample registers a prompt, a tool, and a resource, then lets you choose how to expose them.
STDIO mode is the default and is best for process-based clients. The two SSE modes show how to
serve MCP over HTTP using either a manual Ktor routing setup or the built-in mcp { } Ktor plugin.
Prerequisites
- JDK 17+
- MCP Inspector (optional, for testing)
Build & Run
STDIO mode (default)
./gradlew run
Or explicitly:
./gradlew run --args="--stdio"
Connect with the MCP Inspector:
npx @modelcontextprotocol/inspector --config samples/kotlin-mcp-server/mcp-inspector-config.json --server stdio-server
SSE with Ktor plugin
./gradlew run --args="--sse-server-ktor 3002"
Connect with the MCP Inspector:
npx @modelcontextprotocol/inspector --config samples/kotlin-mcp-server/mcp-inspector-config.json --server sse-ktor-server
SSE with plain configuration
Known issue: This mode may not work correctly at this time.
./gradlew run --args="--sse-server 3001"
Connect with the MCP Inspector:
npx @modelcontextprotocol/inspector --config samples/kotlin-mcp-server/mcp-inspector-config.json --server sse-server
MCP Capabilities
Tools
| Name | Description |
|---|---|
kotlin-sdk-tool |
A test tool that returns a "Hello, world!" greeting. |
Prompts
| Name | Description |
|---|---|
Kotlin Developer |
Generates a prompt to develop a small Kotlin application for a given project name. |
Resources
| Name | URI | Description |
|---|---|---|
Web Search |
https://search.com/ |
A placeholder resource demonstrating resource handling. |