Detekt configuration (#501)

- generate detekt config
- enable several rules
- disable ktlint backing property check

## Motivation and Context
Centralized control of detekt rules. Using detekt 2 configuration

## How Has This Been Tested?
locally

## Breaking Changes
-

## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update

## Checklist
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed
This commit is contained in:
Pavel Gorgulov 2026-02-04 16:02:58 +01:00 • committed by GitHub
commit 6f1c120c27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 856 additions and 25 deletions

View file

@ -74,7 +74,6 @@ public class ServerOptions(public val capabilities: ServerCapabilities, enforceS
* this server. The provider is called each time a new session is started to support dynamic instructions.
* @param block A block to configure the mcp server.
*/
@Suppress("TooManyFunctions")
public open class Server(
protected val serverInfo: Implementation,
protected val options: ServerOptions,
@ -96,13 +95,10 @@ public open class Server(
block: Server.() -> Unit = {},
) : this(serverInfo, options, { instructions }, block)
@Suppress("ktlint:standard:backing-property-naming")
private var _onInitialized: (() -> Unit) = {}
@Suppress("ktlint:standard:backing-property-naming")
private var _onConnect: (() -> Unit) = {}
@Suppress("ktlint:standard:backing-property-naming")
private var _onClose: () -> Unit = {}
@OptIn(ExperimentalTime::class)
@ -320,7 +316,6 @@ public open class Server(
* @param handler A suspend function that handles executing the tool when called by the client.
* @throws IllegalStateException If the server does not support tools.
*/
@Suppress("LongParameterList")
public fun addTool(
name: String,
description: String,
@ -575,7 +570,6 @@ public open class Server(
)
}
@Suppress("TooGenericExceptionCaught")
// Execute the tool handler and catch any errors
return try {
logger.trace { "Executing tool ${requestParams.name} with input: ${requestParams.arguments}" }

View file

@ -43,7 +43,6 @@ private val logger = KotlinLogging.logger {}
/**
* Represents a server session.
*/
@Suppress("TooManyFunctions")
public open class ServerSession(
protected val serverInfo: Implementation,
options: ServerOptions,
@ -53,10 +52,8 @@ public open class ServerSession(
@OptIn(ExperimentalUuidApi::class)
public val sessionId: String = Uuid.random().toString()
@Suppress("ktlint:standard:backing-property-naming")
private var _onInitialized: (() -> Unit) = {}
@Suppress("ktlint:standard:backing-property-naming")
private var _onClose: () -> Unit = {}
/**