Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ad049240b |
246 changed files with 3358 additions and 19692 deletions
|
|
@ -1,81 +0,0 @@
|
|||
---
|
||||
name: kdoc
|
||||
description: "Add KDoc documentation to Kotlin public API. Use whenever the user asks to document Kotlin code, add KDoc, generate API docs, mentions undocumented public declarations, or wants to improve existing documentation. Also trigger when the user says 'add docs', 'document this class/file/module', 'write KDoc', or asks about missing documentation in Kotlin code."
|
||||
---
|
||||
|
||||
# KDoc Generator
|
||||
|
||||
Add KDoc to all public Kotlin declarations (classes, interfaces, objects, functions, properties, enums, type aliases, annotations — including `@Deprecated`). Read the implementation, not just the signature, to write accurate descriptions.
|
||||
|
||||
## Tag placement
|
||||
|
||||
| Where the declaration lives | Tag |
|
||||
|---|---|
|
||||
| Primary-ctor `val` / `var` (public, internal, or protected) | `@property` in class KDoc |
|
||||
| Primary-ctor `name: Type` (no `val`/`var`) | `@param` in class KDoc |
|
||||
| Primary-ctor `private val` / `private var` | `@param` in class KDoc |
|
||||
| Body of class/object/interface/sealed interface | inline `/** */` above the declaration |
|
||||
| Function parameter | `@param` |
|
||||
| Non-Unit return type | `@return` |
|
||||
|
||||
## Style
|
||||
|
||||
- Summary: one concise sentence, third-person verb ("Creates", "Returns", "Represents"). Expand to 2-3 sentences only when genuinely complex.
|
||||
- **Example block**: mandatory for DSL builders (show full receiver-scope usage); add for complex functions or non-obvious extension functions; skip for one-liners and simple getters.
|
||||
- KDoc links (`[ClassName]`, `[methodName]`) only where they add navigational value.
|
||||
- Don't write `@throws` or "suspend" notes.
|
||||
- Rewrite existing KDoc if incomplete or low quality.
|
||||
|
||||
## Examples
|
||||
|
||||
**Class with mixed primary-constructor parameters:**
|
||||
|
||||
````kotlin
|
||||
/**
|
||||
* Manages active client sessions and their lifecycle.
|
||||
*
|
||||
* @property maxSessions upper limit on concurrent sessions
|
||||
* @param scope coroutine scope for session lifecycle tasks
|
||||
* @param secret used internally for session token signing
|
||||
*/
|
||||
public class SessionManager(
|
||||
public val maxSessions: Int, // public val → @property
|
||||
scope: CoroutineScope, // no val/var → @param
|
||||
private val secret: ByteArray, // private val → @param
|
||||
)
|
||||
````
|
||||
|
||||
**Body and interface properties (inline `/** */`):**
|
||||
|
||||
````kotlin
|
||||
/** Represents an entity that includes additional metadata. */
|
||||
public interface WithMeta {
|
||||
/** Optional metadata attached to this entity. */
|
||||
public val meta: JsonObject?
|
||||
}
|
||||
|
||||
public class Connection(public val id: String) {
|
||||
/** Capabilities negotiated during the handshake, or `null` before initialize completes. */
|
||||
public val capabilities: ServerCapabilities? get() = ...
|
||||
}
|
||||
````
|
||||
|
||||
**Function with Example block:**
|
||||
|
||||
````kotlin
|
||||
/**
|
||||
* Registers a new tool with the given handler.
|
||||
*
|
||||
* Example:
|
||||
* ```kotlin
|
||||
* server.addTool(name = "echo", description = "Echoes input back") { request ->
|
||||
* CallToolResult(content = listOf(TextContent("Echo: ${request.arguments}")))
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param name unique tool identifier
|
||||
* @param description human-readable tool description
|
||||
* @param handler suspend function invoked when the tool is called
|
||||
* @return the registered tool definition
|
||||
*/
|
||||
````
|
||||
93
.github/dependabot.yml
vendored
93
.github/dependabot.yml
vendored
|
|
@ -1,109 +1,20 @@
|
|||
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
|
||||
# Configuration: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
# Configuration options:
|
||||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file
|
||||
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
# Root Gradle project (includes buildSrc)
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
commit-message:
|
||||
prefix: "chore(deps):"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "kotlin"
|
||||
open-pull-requests-limit: 10
|
||||
groups:
|
||||
ktor:
|
||||
patterns:
|
||||
- "io.ktor:*"
|
||||
kotlinx:
|
||||
patterns:
|
||||
- "org.jetbrains.kotlinx:*"
|
||||
kotlin:
|
||||
patterns:
|
||||
- "org.jetbrains.kotlin:*"
|
||||
kotest:
|
||||
patterns:
|
||||
- "io.kotest:*"
|
||||
testing:
|
||||
patterns:
|
||||
- "io.mockk:*"
|
||||
- "dev.mokksy:*"
|
||||
- "org.awaitility:*"
|
||||
- "org.junit.jupiter:*"
|
||||
infrastructure:
|
||||
patterns:
|
||||
- "io.netty:*"
|
||||
- "io.github.oshai:*"
|
||||
- "org.slf4j:*"
|
||||
gradle-plugins:
|
||||
patterns:
|
||||
- "dev.detekt"
|
||||
- "org.jetbrains.kotlinx.kover"
|
||||
- "org.jlleitschuh.gradle.ktlint"
|
||||
- "org.jetbrains.kotlinx.knit"
|
||||
- "org.jetbrains.kotlinx.binary-compatibility-validator"
|
||||
- "org.openapi.generator"
|
||||
- "org.jetbrains.dokka:*"
|
||||
- "com.vanniktech:*"
|
||||
|
||||
# Samples (independent Gradle builds)
|
||||
- package-ecosystem: "gradle"
|
||||
directories:
|
||||
- "/samples/*"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
commit-message:
|
||||
prefix: "chore(deps):"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "kotlin"
|
||||
- "samples"
|
||||
open-pull-requests-limit: 10
|
||||
groups:
|
||||
other-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
exclude-patterns:
|
||||
- "io.ktor*"
|
||||
- "org.jetbrains.kotlin*"
|
||||
- "io.modelcontextprotocol*"
|
||||
|
||||
# npm (integration tests)
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/integration-test/src/jvmTest/typescript"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
commit-message:
|
||||
prefix: "chore(deps):"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "javascript"
|
||||
open-pull-requests-limit: 10
|
||||
groups:
|
||||
all-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
# GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
commit-message:
|
||||
prefix: "chore(deps):"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "github-actions"
|
||||
open-pull-requests-limit: 10
|
||||
groups:
|
||||
all-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
|
|
|
|||
10
.github/workflows/apidocs.yaml
vendored
10
.github/workflows/apidocs.yaml
vendored
|
|
@ -24,27 +24,27 @@ jobs:
|
|||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK ${{ env.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
cache: gradle
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
|
||||
- name: Generate Dokka Site
|
||||
run: |-
|
||||
./gradlew knit docs:classes docs:knitCheck dokkaGenerate
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
path: build/dokka/html
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v5
|
||||
uses: actions/deploy-pages@v4
|
||||
|
|
|
|||
4
.github/workflows/automations.yml
vendored
4
.github/workflows/automations.yml
vendored
|
|
@ -27,7 +27,7 @@ jobs:
|
|||
name: Mark/unmark stale PRs and issues
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v11
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
debug-only: ${{ env.DRY_RUN }}
|
||||
exempt-draft-pr: true
|
||||
|
|
@ -66,7 +66,7 @@ jobs:
|
|||
name: Close stale PRs and issues
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v11
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
debug-only: ${{ env.DRY_RUN }}
|
||||
only-labels: 'stale'
|
||||
|
|
|
|||
36
.github/workflows/build.yml
vendored
36
.github/workflows/build.yml
vendored
|
|
@ -43,17 +43,17 @@ jobs:
|
|||
max-workers: 2
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK ${{ env.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Set up Node.js
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
uses: actions/setup-node@v7
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '22' # increase only after https://github.com/nodejs/node/issues/56645 will be fixed
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ jobs:
|
|||
run: npm ci
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
validate-wrappers: true
|
||||
add-job-summary: 'always'
|
||||
|
|
@ -104,6 +104,22 @@ jobs:
|
|||
report_paths: '**/test-results/**/TEST-*.xml'
|
||||
truncate_stack_traces: false
|
||||
|
||||
- name: Upload coverage reports to Codecov
|
||||
if: ${{ !cancelled() && matrix.os == 'ubuntu-latest' }}
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
report_type: coverage
|
||||
directory: ./build/reports/kover
|
||||
files: report.xml
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() && matrix.os == 'ubuntu-latest' }}
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
report_type: test_results
|
||||
|
||||
|
||||
- name: Archive Maven Local Repository
|
||||
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
|
||||
|
|
@ -126,16 +142,16 @@ jobs:
|
|||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK ${{ env.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
validate-wrappers: true
|
||||
add-job-summary: 'always'
|
||||
|
|
@ -168,16 +184,16 @@ jobs:
|
|||
name: "Build Sample: ${{ matrix.sample }}"
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK ${{ env.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
add-job-summary: 'always'
|
||||
cache-read-only: true
|
||||
|
|
|
|||
10
.github/workflows/codeql.yml
vendored
10
.github/workflows/codeql.yml
vendored
|
|
@ -25,22 +25,22 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v7
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK ${{ env.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4.38.0
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: java-kotlin
|
||||
build-mode: manual
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
validate-wrappers: true
|
||||
cache-read-only: true
|
||||
|
|
@ -52,6 +52,6 @@ jobs:
|
|||
--no-daemon --rerun-tasks --stacktrace
|
||||
|
||||
- name: Analyze
|
||||
uses: github/codeql-action/analyze@v4.38.0
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: '/language:java-kotlin'
|
||||
|
|
|
|||
32
.github/workflows/conformance.yml
vendored
32
.github/workflows/conformance.yml
vendored
|
|
@ -25,16 +25,16 @@ jobs:
|
|||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ jobs:
|
|||
done
|
||||
|
||||
- name: Run conformance tests
|
||||
uses: modelcontextprotocol/conformance@v0.1.16
|
||||
uses: modelcontextprotocol/conformance@v0.1.15
|
||||
with:
|
||||
mode: server
|
||||
url: http://localhost:3001/mcp
|
||||
|
|
@ -76,16 +76,16 @@ jobs:
|
|||
- sse-retry
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ jobs:
|
|||
run: ./gradlew :conformance-test:installDist
|
||||
|
||||
- name: Run conformance tests
|
||||
uses: modelcontextprotocol/conformance@v0.1.16
|
||||
uses: modelcontextprotocol/conformance@v0.1.15
|
||||
with:
|
||||
mode: client
|
||||
command: conformance-test/build/install/conformance-test/bin/conformance-client
|
||||
|
|
@ -107,16 +107,16 @@ jobs:
|
|||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ jobs:
|
|||
run: ./gradlew :conformance-test:installDist
|
||||
|
||||
- name: Run conformance tests
|
||||
uses: modelcontextprotocol/conformance@v0.1.16
|
||||
uses: modelcontextprotocol/conformance@v0.1.15
|
||||
with:
|
||||
mode: client
|
||||
command: conformance-test/build/install/conformance-test/bin/conformance-client
|
||||
|
|
@ -146,16 +146,16 @@ jobs:
|
|||
- auth/cross-app-access-complete-flow
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ jobs:
|
|||
run: ./gradlew :conformance-test:installDist
|
||||
|
||||
- name: Run conformance tests
|
||||
uses: modelcontextprotocol/conformance@v0.1.16
|
||||
uses: modelcontextprotocol/conformance@v0.1.15
|
||||
with:
|
||||
mode: client
|
||||
command: conformance-test/build/install/conformance-test/bin/conformance-client
|
||||
|
|
|
|||
23
.github/workflows/dependabot-auto-merge.yml
vendored
23
.github/workflows/dependabot-auto-merge.yml
vendored
|
|
@ -1,23 +0,0 @@
|
|||
name: Auto-merge Dependabot
|
||||
|
||||
on: pull_request
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
auto-merge:
|
||||
if: github.actor == 'dependabot[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dependabot/fetch-metadata@v3
|
||||
id: metadata
|
||||
|
||||
- if: >-
|
||||
steps.metadata.outputs.package-ecosystem == 'github_actions' ||
|
||||
steps.metadata.outputs.package-ecosystem == 'npm_and_yarn'
|
||||
run: gh pr merge --auto --squash "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
15
.github/workflows/gradle-publish.yml
vendored
15
.github/workflows/gradle-publish.yml
vendored
|
|
@ -17,23 +17,18 @@ jobs:
|
|||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: '22' # increase only after https://github.com/nodejs/node/issues/56645 will be fixed
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
|
||||
- name: Check
|
||||
run: ./gradlew check --no-configuration-cache
|
||||
- name: Build
|
||||
run: ./gradlew build --rerun-tasks --max-workers 2 --continue
|
||||
|
||||
- name: Publish to Maven Central Portal
|
||||
id: publish
|
||||
|
|
|
|||
6
.github/workflows/samples.yml
vendored
6
.github/workflows/samples.yml
vendored
|
|
@ -36,16 +36,16 @@ jobs:
|
|||
name: Build Sample (${{ matrix.sample }})
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK ${{ env.JAVA_VERSION }}
|
||||
uses: actions/setup-java@v6
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
distribution: ${{ env.JAVA_DISTRIBUTION }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v6.3.0
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
validate-wrappers: true
|
||||
add-job-summary: 'always'
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -56,7 +56,7 @@ node_modules
|
|||
dist
|
||||
|
||||
### SWE agents ###
|
||||
.claude/
|
||||
.claude/settings.local.json
|
||||
.junie/
|
||||
|
||||
### Conformance test results ###
|
||||
|
|
|
|||
9
.idea/detekt.xml
generated
Normal file
9
.idea/detekt.xml
generated
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DetektPluginSettings">
|
||||
<option name="enableDetekt" value="true" />
|
||||
<option name="enableForProjectResult" value="Accepted" />
|
||||
<option name="redirectChannels" value="true" />
|
||||
<option name="treatAsErrors" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/externalDependencies.xml
generated
Normal file
7
.idea/externalDependencies.xml
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalDependencies">
|
||||
<plugin id="detekt" />
|
||||
<plugin id="com.nbadal.ktlint" />
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/ktlint-plugin.xml
generated
Normal file
7
.idea/ktlint-plugin.xml
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="com.nbadal.ktlint.KtlintProjectSettings">
|
||||
<ktlintMode>DISTRACT_FREE</ktlintMode>
|
||||
<ktlintRulesetVersion>DEFAULT</ktlintRulesetVersion>
|
||||
</component>
|
||||
</project>
|
||||
89
README.md
89
README.md
|
|
@ -19,34 +19,34 @@ standardized protocol interface.
|
|||
|
||||
* [Overview](#overview)
|
||||
* [Installation](#installation)
|
||||
* [Artifacts](#artifacts)
|
||||
* [Gradle setup (JVM)](#gradle-setup-jvm)
|
||||
* [Multiplatform](#multiplatform)
|
||||
* [Ktor dependencies](#ktor-dependencies)
|
||||
* [Artifacts](#artifacts)
|
||||
* [Gradle setup (JVM)](#gradle-setup-jvm)
|
||||
* [Multiplatform](#multiplatform)
|
||||
* [Ktor dependencies](#ktor-dependencies)
|
||||
* [Quickstart](#quickstart)
|
||||
* [Creating a Client](#creating-a-client)
|
||||
* [Creating a Server](#creating-a-server)
|
||||
* [Creating a Client](#creating-a-client)
|
||||
* [Creating a Server](#creating-a-server)
|
||||
* [Core Concepts](#core-concepts)
|
||||
* [MCP Primitives](#mcp-primitives)
|
||||
* [Capabilities](#capabilities)
|
||||
* [Server Capabilities](#server-capabilities)
|
||||
* [Client Capabilities](#client-capabilities)
|
||||
* [Server Features](#server-features)
|
||||
* [Prompts](#prompts)
|
||||
* [Resources](#resources)
|
||||
* [Tools](#tools)
|
||||
* [Completion](#completion)
|
||||
* [Logging](#logging)
|
||||
* [Pagination](#pagination)
|
||||
* [Client Features](#client-features)
|
||||
* [Roots](#roots)
|
||||
* [Sampling](#sampling)
|
||||
* [MCP Primitives](#mcp-primitives)
|
||||
* [Capabilities](#capabilities)
|
||||
* [Server Capabilities](#server-capabilities)
|
||||
* [Client Capabilities](#client-capabilities)
|
||||
* [Server Features](#server-features)
|
||||
* [Prompts](#prompts)
|
||||
* [Resources](#resources)
|
||||
* [Tools](#tools)
|
||||
* [Completion](#completion)
|
||||
* [Logging](#logging)
|
||||
* [Pagination](#pagination)
|
||||
* [Client Features](#client-features)
|
||||
* [Roots](#roots)
|
||||
* [Sampling](#sampling)
|
||||
* [Transports](#transports)
|
||||
* [STDIO Transport](#stdio-transport)
|
||||
* [Streamable HTTP Transport](#streamable-http-transport)
|
||||
* [SSE Transport](#sse-transport)
|
||||
* [WebSocket Transport](#websocket-transport)
|
||||
* [ChannelTransport (testing)](#channeltransport-testing)
|
||||
* [STDIO Transport](#stdio-transport)
|
||||
* [Streamable HTTP Transport](#streamable-http-transport)
|
||||
* [SSE Transport](#sse-transport)
|
||||
* [WebSocket Transport](#websocket-transport)
|
||||
* [ChannelTransport (testing)](#channeltransport-testing)
|
||||
* [Connecting your server](#connecting-your-server)
|
||||
* [Examples](#examples)
|
||||
* [Documentation](#documentation)
|
||||
|
|
@ -188,19 +188,24 @@ the [simple-streamable-server](samples/simple-streamable-server) sample.
|
|||
<!--- CLEAR -->
|
||||
|
||||
```kotlin
|
||||
import io.ktor.serialization.kotlinx.json.json
|
||||
import io.ktor.server.application.install
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.plugins.contentnegotiation.ContentNegotiation
|
||||
import io.modelcontextprotocol.kotlin.sdk.server.Server
|
||||
import io.modelcontextprotocol.kotlin.sdk.server.ServerOptions
|
||||
import io.modelcontextprotocol.kotlin.sdk.server.mcpStreamableHttp
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.CallToolResult
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.Implementation
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.McpJson
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.ServerCapabilities
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.TextContent
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.ToolSchema
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlinx.serialization.json.put
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val port = args.firstOrNull()?.toIntOrNull() ?: 3000
|
||||
val mcpServer = Server(
|
||||
|
|
@ -226,8 +231,11 @@ fun main(args: Array<String>) {
|
|||
) { request ->
|
||||
CallToolResult(content = listOf(TextContent("Hello, world!")))
|
||||
}
|
||||
|
||||
|
||||
embeddedServer(CIO, host = "127.0.0.1", port = port) {
|
||||
install(ContentNegotiation) {
|
||||
json(McpJson)
|
||||
}
|
||||
mcpStreamableHttp {
|
||||
mcpServer
|
||||
}
|
||||
|
|
@ -729,7 +737,7 @@ val client = Client(
|
|||
)
|
||||
|
||||
client.setRequestHandler<CreateMessageRequest>(Method.Defined.SamplingCreateMessage) { request, _ ->
|
||||
val content = request.messages.lastOrNull()?.content?.firstOrNull()
|
||||
val content = request.messages.lastOrNull()?.content
|
||||
val prompt = if (content is TextContent) content.text else "your topic"
|
||||
CreateMessageResult(
|
||||
model = "gpt-4o-mini",
|
||||
|
|
@ -766,10 +774,8 @@ CLI tooling that spawns a helper process. No networking setup is required.
|
|||
|
||||
`StreamableHttpClientTransport` and the Ktor `mcpStreamableHttp()` / `mcpStatelessStreamableHttp()` helpers expose MCP
|
||||
over a single HTTP endpoint with optional JSON-only or SSE streaming responses. This is the recommended choice for
|
||||
remote deployments and integrates nicely with proxies or service meshes.
|
||||
|
||||
These helpers automatically install `ContentNegotiation` with `McpJson` — do not install it yourself, or a warning will
|
||||
be logged. Both accept a `path` parameter (default: `"/mcp"`) to mount the endpoint at any URL:
|
||||
remote deployments and integrates nicely with proxies or service meshes. Both accept a `path` parameter (default:
|
||||
`"/mcp"`) to mount the endpoint at any URL:
|
||||
|
||||
<!--- CLEAR -->
|
||||
<!--- INCLUDE
|
||||
|
|
@ -803,30 +809,11 @@ embeddedServer(CIO, port = 3000) {
|
|||
-->
|
||||
<!--- KNIT example-server-routes-01.kt -->
|
||||
|
||||
**CORS for browser-based clients (e.g. MCP Inspector):** if you connect from a browser-based
|
||||
client you need to install the Ktor CORS plugin so that MCP-specific headers are allowed and exposed:
|
||||
|
||||
```kotlin
|
||||
install(CORS) {
|
||||
anyHost() // restrict to specific origins in production
|
||||
allowMethod(HttpMethod.Options)
|
||||
allowMethod(HttpMethod.Get)
|
||||
allowMethod(HttpMethod.Post)
|
||||
allowMethod(HttpMethod.Delete)
|
||||
allowNonSimpleContentTypes = true
|
||||
allowHeader("Mcp-Session-Id")
|
||||
allowHeader("Mcp-Protocol-Version")
|
||||
exposeHeader("Mcp-Session-Id")
|
||||
exposeHeader("Mcp-Protocol-Version")
|
||||
}
|
||||
```
|
||||
|
||||
### SSE Transport
|
||||
|
||||
Server-Sent Events remain available for backwards compatibility with older MCP clients. Two Ktor helpers are provided:
|
||||
|
||||
- **`Application.mcp { }`** — installs SSE and `ContentNegotiation` with `McpJson` automatically, then registers MCP
|
||||
endpoints at `/`. Do not install `ContentNegotiation` yourself — the SDK handles it.
|
||||
- **`Application.mcp { }`** — installs the SSE plugin automatically and registers MCP endpoints at `/`.
|
||||
- **`Route.mcp { }`** — registers MCP endpoints at the current route path; requires `install(SSE)` in the application
|
||||
first. Use this to host MCP alongside other routes or under a path prefix:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import dev.detekt.gradle.extensions.FailOnSeverity
|
||||
|
||||
plugins {
|
||||
id("mcp.dokka")
|
||||
alias(libs.plugins.detekt)
|
||||
alias(libs.plugins.ktlint)
|
||||
alias(libs.plugins.kover)
|
||||
}
|
||||
|
|
@ -20,6 +23,16 @@ dependencies {
|
|||
subprojects {
|
||||
apply(plugin = "org.jlleitschuh.gradle.ktlint")
|
||||
apply(plugin = "org.jetbrains.kotlinx.kover")
|
||||
|
||||
if (name != "conformance-test" && name != "docs") {
|
||||
apply(plugin = "dev.detekt")
|
||||
|
||||
detekt {
|
||||
config = files("$rootDir/config/detekt/detekt.yml")
|
||||
buildUponDefaultConfig = true
|
||||
failOnSeverity.set(FailOnSeverity.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dokka {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.detekt.gradle)
|
||||
implementation(libs.kotlin.gradle)
|
||||
implementation(libs.kotlin.serialization)
|
||||
implementation(libs.kotlinx.atomicfu.gradle)
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
import dev.detekt.gradle.Detekt
|
||||
import dev.detekt.gradle.extensions.FailOnSeverity
|
||||
|
||||
plugins {
|
||||
id("dev.detekt")
|
||||
}
|
||||
|
||||
detekt {
|
||||
config = files("$rootDir/config/detekt/detekt.yml")
|
||||
buildUponDefaultConfig = false
|
||||
parallel = true
|
||||
failOnSeverity = FailOnSeverity.Error
|
||||
}
|
||||
|
||||
tasks.withType<Detekt>().configureEach {
|
||||
exclude("**/generated/**", "**/generated-sources/**", "**/build/**")
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||
tasks.named("detekt").configure {
|
||||
dependsOn("detektMainJvm")
|
||||
}
|
||||
}
|
||||
|
|
@ -45,8 +45,14 @@ kotlin {
|
|||
events("failed")
|
||||
}
|
||||
systemProperty("kotest.output.ansi", "true")
|
||||
reports {
|
||||
junitXml.required.set(true)
|
||||
junitXml.includeSystemOutLog.set(true)
|
||||
junitXml.includeSystemErrLog.set(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
macosX64()
|
||||
macosArm64()
|
||||
linuxX64()
|
||||
linuxArm64()
|
||||
|
|
@ -57,3 +63,12 @@ kotlin {
|
|||
explicitApi = ExplicitApiMode.Strict
|
||||
jvmToolchain(21)
|
||||
}
|
||||
|
||||
tasks.named("detekt").configure {
|
||||
dependsOn(
|
||||
"detektMainJvm",
|
||||
"detektCommonMainSourceSet",
|
||||
"detektTestJvm",
|
||||
"detektCommonTestSourceSet",
|
||||
)
|
||||
}
|
||||
|
|
|
|||
51
codecov.yml
Normal file
51
codecov.yml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Codecov configuration for Mokksy and AI-Mocks
|
||||
# https://docs.codecov.com/docs/codecov-yaml
|
||||
|
||||
codecov:
|
||||
require_ci_to_pass: yes
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
round: down
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: auto
|
||||
threshold: 1%
|
||||
patch:
|
||||
default:
|
||||
target: auto
|
||||
threshold: 1%
|
||||
|
||||
comment:
|
||||
layout: "header, diff, flags, components"
|
||||
behavior: default
|
||||
require_changes: true
|
||||
|
||||
component_management:
|
||||
default_rules:
|
||||
statuses:
|
||||
- type: project
|
||||
target: auto
|
||||
individual_components:
|
||||
|
||||
- component_id: kotlin-sdk-core
|
||||
name: SDK Core
|
||||
paths:
|
||||
- kotlin-sdk-core/**
|
||||
|
||||
- component_id: kotlin-sdk-client
|
||||
name: SDK Client
|
||||
paths:
|
||||
- kotlin-sdk-client/**
|
||||
|
||||
- component_id: kotlin-sdk-server
|
||||
name: SDK Server
|
||||
paths:
|
||||
- kotlin-sdk-server/**
|
||||
|
||||
- component_id: kotlin-sdk-testing
|
||||
name: SDK Testing
|
||||
paths:
|
||||
- kotlin-sdk-testing/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue