mcp-new 1.2.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/dist/{chunk-3JG4FVS2.js → chunk-LJNMSDBU.js} +1157 -212
- package/dist/cli.js +1287 -18
- package/dist/index.d.ts +43 -10
- package/dist/index.js +22 -35
- package/package.json +4 -2
- package/templates/ci/circleci/config.yml.ejs +219 -0
- package/templates/ci/github/ci.yml.ejs +184 -0
- package/templates/ci/gitlab/.gitlab-ci.yml.ejs +233 -0
- package/templates/csharp/.env.example +6 -0
- package/templates/csharp/.gitignore.ejs +53 -0
- package/templates/csharp/McpServer.csproj.ejs +19 -0
- package/templates/csharp/README.md.ejs +136 -0
- package/templates/csharp/src/Program.cs.ejs +117 -0
- package/templates/elixir/.env.example +6 -0
- package/templates/elixir/.gitignore.ejs +33 -0
- package/templates/elixir/README.md.ejs +154 -0
- package/templates/elixir/config/config.exs.ejs +9 -0
- package/templates/elixir/config/dev.exs.ejs +3 -0
- package/templates/elixir/config/prod.exs.ejs +3 -0
- package/templates/elixir/lib/application.ex.ejs +19 -0
- package/templates/elixir/lib/cli.ex.ejs +17 -0
- package/templates/elixir/lib/server.ex.ejs +112 -0
- package/templates/elixir/mix.exs.ejs +32 -0
- package/templates/java/gradle/.env.example +6 -0
- package/templates/java/gradle/.gitignore.ejs +48 -0
- package/templates/java/gradle/README.md.ejs +132 -0
- package/templates/java/gradle/build.gradle.ejs +46 -0
- package/templates/java/gradle/settings.gradle.ejs +1 -0
- package/templates/java/gradle/src/main/java/com/example/mcp/McpServer.java.ejs +149 -0
- package/templates/java/gradle/src/main/resources/logback.xml +13 -0
- package/templates/java/maven/.env.example +6 -0
- package/templates/java/maven/.gitignore.ejs +53 -0
- package/templates/java/maven/README.md.ejs +131 -0
- package/templates/java/maven/pom.xml.ejs +86 -0
- package/templates/java/maven/src/main/java/com/example/mcp/McpServer.java.ejs +149 -0
- package/templates/java/maven/src/main/resources/logback.xml +13 -0
- package/templates/kotlin/gradle/.env.example +6 -0
- package/templates/kotlin/gradle/.gitignore.ejs +45 -0
- package/templates/kotlin/gradle/README.md.ejs +138 -0
- package/templates/kotlin/gradle/build.gradle.kts.ejs +48 -0
- package/templates/kotlin/gradle/settings.gradle.kts.ejs +1 -0
- package/templates/kotlin/gradle/src/main/kotlin/com/example/mcp/McpServer.kt.ejs +141 -0
- package/templates/kotlin/gradle/src/main/resources/logback.xml +13 -0
- package/templates/kotlin/maven/.env.example +6 -0
- package/templates/kotlin/maven/.gitignore.ejs +50 -0
- package/templates/kotlin/maven/README.md.ejs +96 -0
- package/templates/kotlin/maven/pom.xml.ejs +105 -0
- package/templates/kotlin/maven/src/main/kotlin/com/example/mcp/McpServer.kt.ejs +141 -0
- package/templates/kotlin/maven/src/main/resources/logback.xml +13 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# <%= name %>
|
|
2
|
+
|
|
3
|
+
<%= description || 'MCP Server generated by mcp-new' %>
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- JDK 17 or higher
|
|
8
|
+
- Gradle 8.0+ (or use included Gradle wrapper)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Install dependencies and build
|
|
14
|
+
./gradlew build
|
|
15
|
+
|
|
16
|
+
# Or on Windows
|
|
17
|
+
gradlew.bat build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Running the Server
|
|
21
|
+
|
|
22
|
+
### Development
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Run directly with Gradle
|
|
26
|
+
./gradlew run
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Production
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Build executable JAR (shadow JAR with all dependencies)
|
|
33
|
+
./gradlew shadowJar
|
|
34
|
+
|
|
35
|
+
# Run the JAR
|
|
36
|
+
java -jar build/libs/<%= name %>-1.0.0.jar
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration with Claude Desktop
|
|
40
|
+
|
|
41
|
+
Add this to your Claude Desktop config file:
|
|
42
|
+
|
|
43
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
44
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"<%= name %>": {
|
|
50
|
+
"command": "java",
|
|
51
|
+
"args": ["-jar", "/path/to/<%= name %>/build/libs/<%= name %>-1.0.0.jar"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Available Tools
|
|
58
|
+
|
|
59
|
+
<% if (includeExampleTool) { %>
|
|
60
|
+
### example_tool
|
|
61
|
+
An example tool that echoes the input
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
- `query` (string, required): The query to echo
|
|
65
|
+
<% } %>
|
|
66
|
+
|
|
67
|
+
<% tools.forEach(function(tool) { %>
|
|
68
|
+
### <%= tool.name %>
|
|
69
|
+
<%= tool.description %>
|
|
70
|
+
|
|
71
|
+
**Parameters:**
|
|
72
|
+
<% tool.parameters.forEach(function(param) { %>
|
|
73
|
+
- `<%= param.name %>` (<%= param.type %><%= param.required ? ', required' : '' %>): <%= param.description %>
|
|
74
|
+
<% }); %>
|
|
75
|
+
<% }); %>
|
|
76
|
+
|
|
77
|
+
## Project Structure
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
<%= name %>/
|
|
81
|
+
├── build.gradle.kts # Gradle configuration (Kotlin DSL)
|
|
82
|
+
├── settings.gradle.kts # Project settings
|
|
83
|
+
├── src/
|
|
84
|
+
│ └── main/
|
|
85
|
+
│ ├── kotlin/
|
|
86
|
+
│ │ └── com/example/mcp/
|
|
87
|
+
│ │ └── McpServer.kt # Main server file
|
|
88
|
+
│ └── resources/
|
|
89
|
+
│ └── logback.xml # Logging configuration
|
|
90
|
+
├── .gitignore
|
|
91
|
+
├── .env.example
|
|
92
|
+
└── README.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
### Adding a New Tool
|
|
98
|
+
|
|
99
|
+
1. Open `src/main/kotlin/com/example/mcp/McpServer.kt`
|
|
100
|
+
2. Add a new tool registration in the `registerTools` function:
|
|
101
|
+
|
|
102
|
+
```kotlin
|
|
103
|
+
server.addTool(
|
|
104
|
+
McpSchema.Tool.builder()
|
|
105
|
+
.name("my_new_tool")
|
|
106
|
+
.description("Description of my tool")
|
|
107
|
+
.inputSchema(
|
|
108
|
+
mapOf(
|
|
109
|
+
"type" to "object",
|
|
110
|
+
"properties" to mapOf(
|
|
111
|
+
"param1" to mapOf(
|
|
112
|
+
"type" to "string",
|
|
113
|
+
"description" to "Parameter description"
|
|
114
|
+
)
|
|
115
|
+
),
|
|
116
|
+
"required" to listOf("param1")
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
.build()
|
|
120
|
+
) { request ->
|
|
121
|
+
val param1 = request.arguments["param1"] as? String
|
|
122
|
+
// Your tool logic here
|
|
123
|
+
McpSchema.CallToolResult.builder()
|
|
124
|
+
.content(
|
|
125
|
+
listOf(
|
|
126
|
+
McpSchema.TextContent.builder()
|
|
127
|
+
.type("text")
|
|
128
|
+
.text("Result: $param1")
|
|
129
|
+
.build()
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
.build()
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
kotlin("jvm") version "1.9.22"
|
|
3
|
+
application
|
|
4
|
+
id("com.github.johnrengelman.shadow") version "8.1.1"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
group = "com.example"
|
|
8
|
+
version = "1.0.0"
|
|
9
|
+
|
|
10
|
+
repositories {
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
dependencies {
|
|
15
|
+
// MCP SDK
|
|
16
|
+
implementation("io.modelcontextprotocol:sdk:0.8.0")
|
|
17
|
+
|
|
18
|
+
// Kotlin coroutines
|
|
19
|
+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
|
20
|
+
|
|
21
|
+
// Logging
|
|
22
|
+
implementation("org.slf4j:slf4j-api:2.0.9")
|
|
23
|
+
implementation("ch.qos.logback:logback-classic:1.4.14")
|
|
24
|
+
|
|
25
|
+
// JSON processing
|
|
26
|
+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.16.1")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
kotlin {
|
|
30
|
+
jvmToolchain(17)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
application {
|
|
34
|
+
mainClass.set("com.example.mcp.McpServerKt")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
tasks.shadowJar {
|
|
38
|
+
archiveBaseName.set("<%= name %>")
|
|
39
|
+
archiveClassifier.set("")
|
|
40
|
+
archiveVersion.set("1.0.0")
|
|
41
|
+
manifest {
|
|
42
|
+
attributes["Main-Class"] = "com.example.mcp.McpServerKt"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
tasks.build {
|
|
47
|
+
dependsOn(tasks.shadowJar)
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rootProject.name = "<%= name %>"
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
package com.example.mcp
|
|
2
|
+
|
|
3
|
+
import io.modelcontextprotocol.server.McpServer
|
|
4
|
+
import io.modelcontextprotocol.server.McpServerOptions
|
|
5
|
+
import io.modelcontextprotocol.server.ServerCapabilities
|
|
6
|
+
<% if (transport === 'stdio') { %>
|
|
7
|
+
import io.modelcontextprotocol.server.transport.StdioServerTransport
|
|
8
|
+
<% } else { %>
|
|
9
|
+
import io.modelcontextprotocol.server.transport.SseServerTransport
|
|
10
|
+
<% } %>
|
|
11
|
+
import io.modelcontextprotocol.spec.McpSchema
|
|
12
|
+
import org.slf4j.LoggerFactory
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* <%= name %> MCP Server
|
|
16
|
+
* <%= description || 'Generated by mcp-new' %>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
private val logger = LoggerFactory.getLogger("McpServer")
|
|
20
|
+
|
|
21
|
+
fun main() {
|
|
22
|
+
try {
|
|
23
|
+
// Create server options
|
|
24
|
+
val options = McpServerOptions.builder()
|
|
25
|
+
.name("<%= name %>")
|
|
26
|
+
.version("1.0.0")
|
|
27
|
+
.capabilities(
|
|
28
|
+
ServerCapabilities.builder()
|
|
29
|
+
.tools(true)
|
|
30
|
+
.build()
|
|
31
|
+
)
|
|
32
|
+
.build()
|
|
33
|
+
|
|
34
|
+
// Create server instance
|
|
35
|
+
val server = McpServer(options)
|
|
36
|
+
|
|
37
|
+
// Register tools
|
|
38
|
+
registerTools(server)
|
|
39
|
+
|
|
40
|
+
<% if (transport === 'stdio') { %>
|
|
41
|
+
// Create STDIO transport
|
|
42
|
+
val transport = StdioServerTransport()
|
|
43
|
+
server.connect(transport)
|
|
44
|
+
logger.info("<%= name %> MCP server running on stdio")
|
|
45
|
+
<% } else { %>
|
|
46
|
+
// Create SSE transport
|
|
47
|
+
val transport = SseServerTransport(8080, "/messages")
|
|
48
|
+
server.connect(transport)
|
|
49
|
+
logger.info("<%= name %> MCP server running on SSE at http://localhost:8080")
|
|
50
|
+
<% } %>
|
|
51
|
+
|
|
52
|
+
// Keep server running
|
|
53
|
+
Thread.currentThread().join()
|
|
54
|
+
|
|
55
|
+
} catch (e: Exception) {
|
|
56
|
+
logger.error("Fatal error: ", e)
|
|
57
|
+
System.exit(1)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private fun registerTools(server: McpServer) {
|
|
62
|
+
<% if (includeExampleTool) { %>
|
|
63
|
+
// Register example_tool
|
|
64
|
+
server.addTool(
|
|
65
|
+
McpSchema.Tool.builder()
|
|
66
|
+
.name("example_tool")
|
|
67
|
+
.description("An example tool that echoes the input")
|
|
68
|
+
.inputSchema(
|
|
69
|
+
mapOf(
|
|
70
|
+
"type" to "object",
|
|
71
|
+
"properties" to mapOf(
|
|
72
|
+
"query" to mapOf(
|
|
73
|
+
"type" to "string",
|
|
74
|
+
"description" to "The query to echo"
|
|
75
|
+
)
|
|
76
|
+
),
|
|
77
|
+
"required" to listOf("query")
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
.build()
|
|
81
|
+
) { request ->
|
|
82
|
+
val query = request.arguments["query"] as String
|
|
83
|
+
McpSchema.CallToolResult.builder()
|
|
84
|
+
.content(
|
|
85
|
+
listOf(
|
|
86
|
+
McpSchema.TextContent.builder()
|
|
87
|
+
.type("text")
|
|
88
|
+
.text("Echo: $query")
|
|
89
|
+
.build()
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
.build()
|
|
93
|
+
}
|
|
94
|
+
<% } %>
|
|
95
|
+
|
|
96
|
+
<% tools.forEach(function(tool) { %>
|
|
97
|
+
// Register <%= tool.name %>
|
|
98
|
+
server.addTool(
|
|
99
|
+
McpSchema.Tool.builder()
|
|
100
|
+
.name("<%= tool.name %>")
|
|
101
|
+
.description("<%= tool.description %>")
|
|
102
|
+
.inputSchema(
|
|
103
|
+
mapOf(
|
|
104
|
+
"type" to "object",
|
|
105
|
+
"properties" to mapOf(
|
|
106
|
+
<% tool.parameters.forEach(function(param, index) { %>
|
|
107
|
+
"<%= param.name %>" to mapOf(
|
|
108
|
+
"type" to "<%= param.type %>",
|
|
109
|
+
"description" to "<%= param.description %>"
|
|
110
|
+
)<%= index < tool.parameters.length - 1 ? ',' : '' %>
|
|
111
|
+
<% }); %>
|
|
112
|
+
),
|
|
113
|
+
"required" to listOf(<%= tool.parameters.filter(p => p.required).map(p => '"' + p.name + '"').join(', ') %>)
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
.build()
|
|
117
|
+
) { request ->
|
|
118
|
+
// TODO: Implement <%= tool.name %> logic
|
|
119
|
+
<% tool.parameters.forEach(function(param) { %>
|
|
120
|
+
<% if (param.type === 'number') { %>
|
|
121
|
+
val <%= param.name %> = request.arguments["<%= param.name %>"] as? Number
|
|
122
|
+
<% } else if (param.type === 'boolean') { %>
|
|
123
|
+
val <%= param.name %> = request.arguments["<%= param.name %>"] as? Boolean
|
|
124
|
+
<% } else { %>
|
|
125
|
+
val <%= param.name %> = request.arguments["<%= param.name %>"] as? String
|
|
126
|
+
<% } %>
|
|
127
|
+
<% }); %>
|
|
128
|
+
|
|
129
|
+
McpSchema.CallToolResult.builder()
|
|
130
|
+
.content(
|
|
131
|
+
listOf(
|
|
132
|
+
McpSchema.TextContent.builder()
|
|
133
|
+
.type("text")
|
|
134
|
+
.text("<%= tool.name %> called with: ${request.arguments}")
|
|
135
|
+
.build()
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
.build()
|
|
139
|
+
}
|
|
140
|
+
<% }); %>
|
|
141
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<configuration>
|
|
3
|
+
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
|
|
4
|
+
<target>System.err</target>
|
|
5
|
+
<encoder>
|
|
6
|
+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
|
7
|
+
</encoder>
|
|
8
|
+
</appender>
|
|
9
|
+
|
|
10
|
+
<root level="INFO">
|
|
11
|
+
<appender-ref ref="STDERR"/>
|
|
12
|
+
</root>
|
|
13
|
+
</configuration>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Compiled class files
|
|
2
|
+
*.class
|
|
3
|
+
|
|
4
|
+
# Log files
|
|
5
|
+
*.log
|
|
6
|
+
|
|
7
|
+
# Package Files
|
|
8
|
+
*.jar
|
|
9
|
+
*.war
|
|
10
|
+
*.nar
|
|
11
|
+
*.ear
|
|
12
|
+
*.zip
|
|
13
|
+
*.tar.gz
|
|
14
|
+
*.rar
|
|
15
|
+
|
|
16
|
+
# Maven
|
|
17
|
+
target/
|
|
18
|
+
pom.xml.tag
|
|
19
|
+
pom.xml.releaseBackup
|
|
20
|
+
pom.xml.versionsBackup
|
|
21
|
+
pom.xml.next
|
|
22
|
+
release.properties
|
|
23
|
+
dependency-reduced-pom.xml
|
|
24
|
+
buildNumber.properties
|
|
25
|
+
.mvn/timing.properties
|
|
26
|
+
.mvn/wrapper/maven-wrapper.jar
|
|
27
|
+
|
|
28
|
+
# Kotlin
|
|
29
|
+
*.kotlin_module
|
|
30
|
+
|
|
31
|
+
# IDE
|
|
32
|
+
.idea/
|
|
33
|
+
*.iml
|
|
34
|
+
*.ipr
|
|
35
|
+
*.iws
|
|
36
|
+
.project
|
|
37
|
+
.classpath
|
|
38
|
+
.settings/
|
|
39
|
+
.vscode/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
*~
|
|
43
|
+
|
|
44
|
+
# OS
|
|
45
|
+
.DS_Store
|
|
46
|
+
Thumbs.db
|
|
47
|
+
|
|
48
|
+
# Environment
|
|
49
|
+
.env
|
|
50
|
+
.env.local
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# <%= name %>
|
|
2
|
+
|
|
3
|
+
<%= description || 'MCP Server generated by mcp-new' %>
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- JDK 17 or higher
|
|
8
|
+
- Maven 3.8+
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Install dependencies and build
|
|
14
|
+
mvn install
|
|
15
|
+
|
|
16
|
+
# Or just compile
|
|
17
|
+
mvn compile
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Running the Server
|
|
21
|
+
|
|
22
|
+
### Development
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Run directly with Maven
|
|
26
|
+
mvn exec:java -Dexec.mainClass="com.example.mcp.McpServerKt"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Production
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Build executable JAR
|
|
33
|
+
mvn package
|
|
34
|
+
|
|
35
|
+
# Run the JAR
|
|
36
|
+
java -jar target/<%= name %>-1.0.0.jar
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration with Claude Desktop
|
|
40
|
+
|
|
41
|
+
Add this to your Claude Desktop config file:
|
|
42
|
+
|
|
43
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
44
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"<%= name %>": {
|
|
50
|
+
"command": "java",
|
|
51
|
+
"args": ["-jar", "/path/to/<%= name %>/target/<%= name %>-1.0.0.jar"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Available Tools
|
|
58
|
+
|
|
59
|
+
<% if (includeExampleTool) { %>
|
|
60
|
+
### example_tool
|
|
61
|
+
An example tool that echoes the input
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
- `query` (string, required): The query to echo
|
|
65
|
+
<% } %>
|
|
66
|
+
|
|
67
|
+
<% tools.forEach(function(tool) { %>
|
|
68
|
+
### <%= tool.name %>
|
|
69
|
+
<%= tool.description %>
|
|
70
|
+
|
|
71
|
+
**Parameters:**
|
|
72
|
+
<% tool.parameters.forEach(function(param) { %>
|
|
73
|
+
- `<%= param.name %>` (<%= param.type %><%= param.required ? ', required' : '' %>): <%= param.description %>
|
|
74
|
+
<% }); %>
|
|
75
|
+
<% }); %>
|
|
76
|
+
|
|
77
|
+
## Project Structure
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
<%= name %>/
|
|
81
|
+
├── pom.xml # Maven configuration
|
|
82
|
+
├── src/
|
|
83
|
+
│ └── main/
|
|
84
|
+
│ ├── kotlin/
|
|
85
|
+
│ │ └── com/example/mcp/
|
|
86
|
+
│ │ └── McpServer.kt # Main server file
|
|
87
|
+
│ └── resources/
|
|
88
|
+
│ └── logback.xml # Logging configuration
|
|
89
|
+
├── .gitignore
|
|
90
|
+
├── .env.example
|
|
91
|
+
└── README.md
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
5
|
+
<modelVersion>4.0.0</modelVersion>
|
|
6
|
+
|
|
7
|
+
<groupId>com.example</groupId>
|
|
8
|
+
<artifactId><%= name %></artifactId>
|
|
9
|
+
<version>1.0.0</version>
|
|
10
|
+
<packaging>jar</packaging>
|
|
11
|
+
|
|
12
|
+
<name><%= name %></name>
|
|
13
|
+
<description><%= description || 'MCP Server generated by mcp-new' %></description>
|
|
14
|
+
|
|
15
|
+
<properties>
|
|
16
|
+
<kotlin.version>1.9.22</kotlin.version>
|
|
17
|
+
<maven.compiler.source>17</maven.compiler.source>
|
|
18
|
+
<maven.compiler.target>17</maven.compiler.target>
|
|
19
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
20
|
+
<mcp.sdk.version>0.8.0</mcp.sdk.version>
|
|
21
|
+
</properties>
|
|
22
|
+
|
|
23
|
+
<dependencies>
|
|
24
|
+
<!-- Kotlin -->
|
|
25
|
+
<dependency>
|
|
26
|
+
<groupId>org.jetbrains.kotlin</groupId>
|
|
27
|
+
<artifactId>kotlin-stdlib</artifactId>
|
|
28
|
+
<version>${kotlin.version}</version>
|
|
29
|
+
</dependency>
|
|
30
|
+
<dependency>
|
|
31
|
+
<groupId>org.jetbrains.kotlinx</groupId>
|
|
32
|
+
<artifactId>kotlinx-coroutines-core</artifactId>
|
|
33
|
+
<version>1.7.3</version>
|
|
34
|
+
</dependency>
|
|
35
|
+
|
|
36
|
+
<!-- MCP SDK -->
|
|
37
|
+
<dependency>
|
|
38
|
+
<groupId>io.modelcontextprotocol</groupId>
|
|
39
|
+
<artifactId>sdk</artifactId>
|
|
40
|
+
<version>${mcp.sdk.version}</version>
|
|
41
|
+
</dependency>
|
|
42
|
+
|
|
43
|
+
<!-- Logging -->
|
|
44
|
+
<dependency>
|
|
45
|
+
<groupId>org.slf4j</groupId>
|
|
46
|
+
<artifactId>slf4j-api</artifactId>
|
|
47
|
+
<version>2.0.9</version>
|
|
48
|
+
</dependency>
|
|
49
|
+
<dependency>
|
|
50
|
+
<groupId>ch.qos.logback</groupId>
|
|
51
|
+
<artifactId>logback-classic</artifactId>
|
|
52
|
+
<version>1.4.14</version>
|
|
53
|
+
</dependency>
|
|
54
|
+
|
|
55
|
+
<!-- JSON processing -->
|
|
56
|
+
<dependency>
|
|
57
|
+
<groupId>com.fasterxml.jackson.module</groupId>
|
|
58
|
+
<artifactId>jackson-module-kotlin</artifactId>
|
|
59
|
+
<version>2.16.1</version>
|
|
60
|
+
</dependency>
|
|
61
|
+
</dependencies>
|
|
62
|
+
|
|
63
|
+
<build>
|
|
64
|
+
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
|
65
|
+
<plugins>
|
|
66
|
+
<plugin>
|
|
67
|
+
<groupId>org.jetbrains.kotlin</groupId>
|
|
68
|
+
<artifactId>kotlin-maven-plugin</artifactId>
|
|
69
|
+
<version>${kotlin.version}</version>
|
|
70
|
+
<executions>
|
|
71
|
+
<execution>
|
|
72
|
+
<id>compile</id>
|
|
73
|
+
<phase>compile</phase>
|
|
74
|
+
<goals>
|
|
75
|
+
<goal>compile</goal>
|
|
76
|
+
</goals>
|
|
77
|
+
</execution>
|
|
78
|
+
</executions>
|
|
79
|
+
</plugin>
|
|
80
|
+
|
|
81
|
+
<!-- Create executable JAR with dependencies -->
|
|
82
|
+
<plugin>
|
|
83
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
84
|
+
<artifactId>maven-shade-plugin</artifactId>
|
|
85
|
+
<version>3.5.1</version>
|
|
86
|
+
<executions>
|
|
87
|
+
<execution>
|
|
88
|
+
<phase>package</phase>
|
|
89
|
+
<goals>
|
|
90
|
+
<goal>shade</goal>
|
|
91
|
+
</goals>
|
|
92
|
+
<configuration>
|
|
93
|
+
<transformers>
|
|
94
|
+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
95
|
+
<mainClass>com.example.mcp.McpServerKt</mainClass>
|
|
96
|
+
</transformer>
|
|
97
|
+
</transformers>
|
|
98
|
+
<createDependencyReducedPom>false</createDependencyReducedPom>
|
|
99
|
+
</configuration>
|
|
100
|
+
</execution>
|
|
101
|
+
</executions>
|
|
102
|
+
</plugin>
|
|
103
|
+
</plugins>
|
|
104
|
+
</build>
|
|
105
|
+
</project>
|