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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ A Kotlin server application that analyzes GitHub repositories using AI models th
### Prerequisites

- JDK 23 or higher
- Kotlin 1.9.x
- Gradle 8.14 or higher
- Kotlin 2.2.x
- Gradle 9.0 or higher
- [Ollama](https://github.com/ollama/ollama) 3.2 or higher (for model API)
- [MCP Inspector](https://github.com/modelcontextprotocol/inspector) (for model context protocol)

Expand All @@ -32,13 +32,13 @@ A Kotlin server application that analyzes GitHub repositories using AI models th
3. Start Ollama server:

```bash
ollama run llama3.2
ollama run llama3.2:latest
```

4. Start the MCP Inspector:

```bash
npx @modelcontextprotocol/inspector
export DANGEROUSLY_OMIT_AUTH=true; npx @modelcontextprotocol/inspector@0.16.2
```

5. You can access the MCP Inspector at `http://127.0.0.1:6274/` and configure the `Arguments` to start the server:
Expand Down Expand Up @@ -114,10 +114,11 @@ Optional parameters:
- `config/`: Configuration classes
- `AppConfig.kt`: Immutable configuration data class
- `server/`: MCP server implementation
- `Server.kt`: Functional MCP server with multiple run modes
- `Mcp.kt`: Functional MCP server with multiple run modes
- `processor/`: MCP server implementation
- `CodeAnalyzer.kt`: Analyzes code structure
- `service/`: Core services for repository analysis
- `GitService.kt`: Handles repository cloning
- `CodeAnalyzer.kt`: Analyzes code structure
- `ModelContextService.kt`: Generates insights using AI models
- `RepositoryAnalysisService.kt`: Coordinates the analysis process

Expand Down
11 changes: 6 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ plugins {
`maven-publish`
signing
jacoco
kotlin("jvm") version "2.1.0"
kotlin("plugin.serialization") version "2.1.0"
kotlin("jvm") version "2.2.10"
kotlin("plugin.serialization") version "2.2.10"
id("com.diffplug.spotless") version "7.0.3"
id("io.kotest.multiplatform") version "5.0.2"
id("io.kotest.multiplatform") version "5.9.1"
id("org.jreleaser") version "1.17.0"
id("pl.allegro.tech.build.axion-release") version "1.18.7"
}
Expand All @@ -27,9 +27,10 @@ version = rootProject.scmVersion.version
description = "MCP Server for GitHub Code Repositories Analysis"

dependencies {
val ktorVersion = "3.0.2"
val ktorVersion = "3.2.0"
val coroutinesVersion = "1.10.2"
val kotestVersion = "5.9.1"
val mcpKotlinSdk = "0.6.0"

// Kotlin standard library
implementation(kotlin("stdlib"))
Expand All @@ -45,7 +46,7 @@ dependencies {
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")

// MCP SDK
implementation("io.modelcontextprotocol:kotlin-sdk:0.5.0")
implementation("io.modelcontextprotocol:kotlin-sdk:$mcpKotlinSdk")

// Logging
implementation("ch.qos.logback:logback-classic:1.5.18")
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.gradle.kotlin.dsl.maven

plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" }
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" }

rootProject.name = "mcp-github-code-analyzer"

Expand Down
12 changes: 6 additions & 6 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import java.io.IOException
import java.nio.file.Path
import java.nio.file.Paths
import mcp.code.analysis.config.AppConfig
import mcp.code.analysis.server.Server
import mcp.code.analysis.server.Mcp
import org.slf4j.Logger
import org.slf4j.LoggerFactory

Expand Down Expand Up @@ -88,7 +88,7 @@ fun runApplication(args: Array<String>): Result<Unit> = runCatching {
logger.error("Failed to create necessary directories, check previous errors")
throw IOException("Failed to create one or more required directories")
}
executeCommand(command, Server())
executeCommand(command, Mcp())
}

/**
Expand Down Expand Up @@ -160,13 +160,13 @@ fun createDirectoryWithFullPath(path: Path): Result<Pair<Path, Boolean>> = runCa
* @param server The Server instance to use for execution.
* @throws IllegalArgumentException If the command type is UNKNOWN.
*/
fun executeCommand(command: AppCommand, server: Server) {
fun executeCommand(command: AppCommand, server: Mcp) {
val logger = LoggerFactory.getLogger("Main")

when (command.type) {
CommandType.STDIO -> server.runMcpServerUsingStdio()
CommandType.SSE_KTOR -> server.runSseMcpServerUsingKtorPlugin(command.port)
CommandType.SSE_PLAIN -> server.runSseMcpServerWithPlainConfiguration(command.port)
CommandType.STDIO -> server.runUsingStdio()
CommandType.SSE_KTOR -> server.runSseUsingKtorPlugin(command.port)
CommandType.SSE_PLAIN -> server.runSseWithPlainConfiguration(command.port)
CommandType.UNKNOWN -> throw IllegalArgumentException("Unknown command: ${command.type}")
}.also { logger.info("Executed command: ${command.type}") }
}
Loading