Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
49 changes: 49 additions & 0 deletions .github/workflows/apidocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Publish API Docs to GitHub Pages

on:
release:
types:
- published
# Allow running this workflow manually from the Actions tab
workflow_dispatch:

jobs:
deploy:

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Docker image pinning is actually recommended for security reasons.
We can skip it today since the Renovate is not configured.
https://docs.renovatebot.com/docker/#digest-pinning
https://docs.renovatebot.com/modules/manager/github-actions/#digest-pinning-and-updating


- name: Generate Dokka Site
run: |-
./gradlew :docs:clean :docs:dokkaGenerate

- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: build/dokka/html

- name: Deploy to GitHub Pages
Copy link
Contributor

Choose a reason for hiding this comment

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

Do I understand correctly that the deploy will be from github actions instead of main/docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. But I can test it only once workflow is merged to default branch

id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ build/
.idea/compiler.xml
.idea/libraries/
.idea
!.idea/icon.png
*.iws
*.iml
*.ipr
Expand Down
13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id("mcp.dokka")
alias(libs.plugins.ktlint)
alias(libs.plugins.kover)
}
Expand All @@ -9,6 +10,10 @@ allprojects {
}

dependencies {
dokka(project(":kotlin-sdk-core"))
dokka(project(":kotlin-sdk-client"))
dokka(project(":kotlin-sdk-server"))

kover(project(":kotlin-sdk-core"))
kover(project(":kotlin-sdk-client"))
kover(project(":kotlin-sdk-server"))
Expand All @@ -20,6 +25,14 @@ subprojects {
apply(plugin = "org.jetbrains.kotlinx.kover")
}

dokka {
moduleName = "MCP Kotlin SDK"

dokkaPublications.html {
includes.from("docs/moduledoc.md")
}
}

kover {
reports {
filters {
Expand Down
26 changes: 21 additions & 5 deletions buildSrc/src/main/kotlin/mcp.dokka.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@ plugins {
}

dokka {
moduleName.set("MCP Kotlin SDK - ${project.name}")

dokkaSourceSets.configureEach {
includes.from("Module.md")

pluginsConfiguration.html {
footerMessage = "Copyright © 2024-2025 Anthropic, PBC"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should change the copyright, for example like in C#?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a question, but not to me :) I took it from here for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I understand
it's a general question, mb we should change it in License as well

}

sourceLink {
localDirectory = projectDir.resolve("src")
remoteUrl("https://github.com/modelcontextprotocol/kotlin-sdk/tree/main/${project.name}/src")
remoteLineSuffix = "#L"
}

documentedVisibilities(VisibilityModifier.Public)
}

dokkaPublications.html {
outputDirectory = rootProject.layout.projectDirectory.dir("docs/${project.name}")
externalDocumentationLinks.register("ktor-client") {
url("https://api.ktor.io/ktor-client/")
packageListUrl("https://api.ktor.io/package-list")
}

externalDocumentationLinks.register("kotlinx-coroutines") {
url("https://kotlinlang.org/api/kotlinx.coroutines/")
packageListUrl("https://kotlinlang.org/api/kotlinx.coroutines/package-list")
}

externalDocumentationLinks.register("kotlinx-serialization") {
url("https://kotlinlang.org/api/kotlinx.serialization/")
packageListUrl("https://kotlinlang.org/api/kotlinx.serialization/package-list")
}
}
}
}

This file was deleted.

This file was deleted.

Loading
Loading