Skip to content

Commit d027469

Browse files
committed
Refactor dokka configuration
- remove docs gradle module - remove trigger docs on push - add main page for dokka documentation
1 parent 0117233 commit d027469

File tree

8 files changed

+118
-24
lines changed

8 files changed

+118
-24
lines changed

.github/workflows/apidocs.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
release:
55
types:
66
- published
7-
push:
8-
branches: [ "main" ]
97
# Allow running this workflow manually from the Actions tab
108
workflow_dispatch:
119

@@ -35,7 +33,7 @@ jobs:
3533
cache: gradle
3634

3735
- name: Setup Gradle
38-
uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3
36+
uses: gradle/actions/setup-gradle@v4
3937

4038
- name: Generate Dokka Site
4139
run: |-
@@ -44,7 +42,7 @@ jobs:
4442
- name: Upload artifact
4543
uses: actions/upload-pages-artifact@v4
4644
with:
47-
path: docs/build/dokka/html
45+
path: build/dokka/html
4846

4947
- name: Deploy to GitHub Pages
5048
id: deployment

.idea/icon.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
plugins {
2+
id("mcp.dokka")
23
alias(libs.plugins.ktlint)
34
alias(libs.plugins.kover)
45
}
@@ -9,6 +10,10 @@ allprojects {
910
}
1011

1112
dependencies {
13+
dokka(project(":kotlin-sdk-core"))
14+
dokka(project(":kotlin-sdk-client"))
15+
dokka(project(":kotlin-sdk-server"))
16+
1217
kover(project(":kotlin-sdk-core"))
1318
kover(project(":kotlin-sdk-client"))
1419
kover(project(":kotlin-sdk-server"))
@@ -20,6 +25,14 @@ subprojects {
2025
apply(plugin = "org.jetbrains.kotlinx.kover")
2126
}
2227

28+
dokka {
29+
moduleName = "MCP Kotlin SDK"
30+
31+
dokkaPublications.html {
32+
includes.from("docs/moduledoc.md")
33+
}
34+
}
35+
2336
kover {
2437
reports {
2538
filters {

docs/build.gradle.kts

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/icon.png

-3.81 KB
Binary file not shown.

docs/moduledoc.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# MCP Kotlin SDK
2+
3+
Kotlin SDK for the Model Context Protocol (MCP).
4+
This is a Kotlin Multiplatform library that helps you build MCP clients and servers that speak the same protocol and
5+
share the same types.
6+
The SDK focuses on clarity, small building blocks, and first‑class coroutine support.
7+
8+
Use the umbrella `kotlin-sdk` artifact when you want a single dependency that brings the core types plus both client and
9+
server toolkits. If you only need one side, depend on `kotlin-sdk-client` or `kotlin-sdk-server` directly.
10+
11+
Gradle (Kotlin DSL):
12+
13+
```kotlin
14+
dependencies {
15+
// Convenience bundle with everything you need to start
16+
implementation("io.modelcontextprotocol:kotlin-sdk:<version>")
17+
18+
// Or pick modules explicitly
19+
implementation("io.modelcontextprotocol:kotlin-sdk-client:<version>")
20+
implementation("io.modelcontextprotocol:kotlin-sdk-server:<version>")
21+
}
22+
```
23+
24+
---
25+
26+
## Module kotlin-sdk-core
27+
28+
Foundational, platform‑agnostic pieces:
29+
30+
- Protocol data model and JSON serialization (kotlinx.serialization)
31+
- Request/response and notification types used by both sides of MCP
32+
- Coroutine‑friendly protocol engine and utilities
33+
- Transport abstractions shared by client and server
34+
35+
You typically do not use `core` directly in application code; it is pulled in by the client/server modules. Use it
36+
explicitly if you only need the protocol types or plan to implement a custom transport.
37+
38+
---
39+
40+
## Module kotlin-sdk-client
41+
42+
High‑level client API for connecting to an MCP server and invoking its tools, prompts, and resources. Ships with several
43+
transports:
44+
45+
- WebSocketClientTransport – low latency, full‑duplex
46+
- SSEClientTransport – Server‑Sent Events over HTTP
47+
- StdioClientTransport – CLI‑friendly stdio bridge
48+
- StreamableHttpClientTransport – simple HTTP streaming
49+
50+
A minimal client:
51+
52+
```kotlin
53+
val client = Client(
54+
clientInfo = Implementation(name = "sample-client", version = "1.0.0")
55+
)
56+
57+
client.connect(WebSocketClientTransport("ws://localhost:8080/mcp"))
58+
59+
val tools = client.listTools()
60+
val result = client.callTool(
61+
name = "echo",
62+
arguments = mapOf("text" to "Hello, MCP!")
63+
)
64+
```
65+
66+
---
67+
68+
## Module kotlin-sdk-server
69+
70+
Lightweight server toolkit for hosting MCP tools, prompts, and resources. It provides a small, composable API and
71+
ready‑to‑use transports:
72+
73+
- StdioServerTransport – integrates well with CLIs and editors
74+
- SSE/WebSocket helpers for Ktor – easy HTTP deployment
75+
76+
Register tools and run over stdio:
77+
78+
```kotlin
79+
80+
val server = Server(
81+
serverInfo = Implementation(name = "sample-server", version = "1.0.0"),
82+
options = ServerOptions(ServerCapabilities())
83+
)
84+
85+
server.addTool(
86+
name = "echo",
87+
description = "Echoes the provided text"
88+
) { request ->
89+
// Build and return a CallToolResult from request.arguments
90+
// (see CallToolResult and related types in kotlin-sdk-core)
91+
/* ... */
92+
}
93+
94+
// Bridge the protocol over stdio
95+
val transport = StdioServerTransport(
96+
inputStream = kotlinx.io.files.Path("/dev/stdin").source(),
97+
outputStream = kotlinx.io.files.Path("/dev/stdout").sink()
98+
)
99+
// Start transport and wire it with the server using provided helpers in the SDK.
100+
```
101+
102+
For HTTP deployments, use the Ktor extensions included in the module to expose an MCP WebSocket or SSE endpoint with a
103+
few lines of code.

kotlin-sdk/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id("mcp.multiplatform")
33
id("mcp.publishing")
4-
id("mcp.dokka")
54
id("mcp.jreleaser")
65
}
76

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ include(
2323
":kotlin-sdk-server",
2424
":kotlin-sdk",
2525
":kotlin-sdk-test",
26-
":docs",
2726
)
2827

2928
// Include sample projects as composite builds

0 commit comments

Comments
 (0)