Skip to content

Litote/mastodon-ktor-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mastodon Ktor SDK

Plugin Version KDoc Quality Gate Status Coverage Bugs Vulnerabilities Code Smells Maintainability Rating Reliability Rating Security Rating Apache2 license

Kotlin Multiplatform SDK for the Mastodon API.

  • Group: org.litote.mastodon.ktor.sdk
  • License: Apache 2.0

Features

  • Ktor and kotlinx.serialization dependencies — fully KMP compatible
  • Granularity at the operation level: each API operation is a separate dependency/Gradle module
  • alpha stage SDK for operation composition (e.g. upload an image and post a media status)
  • alpha stage Gradle plugin for usage with Gradle projects
  • alpha stage CLI tools for command-line usage
  • alpha stage MCP server to expose Mastodon tools to AI assistants (Claude Desktop, Claude Code, etc.)

Using the generated clients

Each API operation has its own module in the client directory. Add only what you need:

// POST /api/v1/statuses
implementation("org.litote.mastodon.ktor.sdk:statuses-api-v1-statuses-post-client:<version>")

// POST /api/v2/media
implementation("org.litote.mastodon.ktor.sdk:media-api-v2-media-post-client:<version>")

Configure a ClientConfiguration with your server and access token:

val config = ClientConfiguration(
    baseUrl = "https://mastodon.example.com/",
    httpClientConfig = {
        install(ContentNegotiation) { json(Json { ignoreUnknownKeys = true }) }
        defaultRequest {
            header("Authorization", "Bearer $accessToken")
        }
    }
)

val client = StatusesApiV1StatusesPostClient(config)
val response = client.createStatus(TextStatus(status = "Hello Mastodon!"))

alpha stage SDK

For operation composition (e.g. upload an image and post a media status).

See sdk/README.md for usage.

alpha stage Gradle plugin

For projects that build with Gradle, the gradle-plugin module provides sendText and sendMedia tasks that call the SDK directly — no shell invocation needed.

See gradle-plugin/README.md for setup and usage.

alpha stage MCP Server

Expose Mastodon tools to any MCP client (Claude Desktop, Claude Code, etc.) via a STDIO transport.

See mcp-server/README.md for setup and usage.

alpha stage CLI

Command-line tools to post statuses to Mastodon.

See cli/README.md for usage.

About

Kotlin Multiplatform client & SDK for the Mastodon API. Provides also a gradle plugin and a CLI.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages