Discover Awesome MCP Servers
Extend your agent with 84,517 capabilities via MCP servers.
- All84,517
- Developer Tools3,867
- Search1,714
- Research & Data1,557
- AI Integration Systems229
- Cloud Platforms219
- Data & App Analysis181
- Database Interaction177
- Remote Shell Execution165
- Browser Automation147
- Databases145
- Communication137
- AI Content Generation127
- OS Automation120
- Programming Docs Access109
- Content Fetching108
- Note Taking97
- File Systems96
- Version Control93
- Finance91
- Knowledge & Memory90
- Monitoring79
- Security71
- Image & Video Processing69
- Digital Note Management66
- AI Memory Systems62
- Advanced AI Reasoning59
- Git Management Tools58
- Cloud Storage51
- Entertainment & Media43
- Virtualization42
- Location Services35
- Web Automation & Stealth32
- Media Content Processing32
- Calendar Management26
- Ecommerce & Retail18
- Speech Processing18
- Customer Data Platforms16
- Travel & Transportation14
- Education & Learning Tools13
- Home Automation & IoT13
- Web Search Integration12
- Health & Wellness10
- Customer Support10
- Marketing9
- Games & Gamification8
- Google Cloud Integrations7
- Art & Culture4
- Language Translation3
- Legal & Compliance2
ActionKit MCP Starter
Okay, here's a basic starter code structure and explanation for an MCP (Minecraft Protocol) server powered by ActionKit (assuming you mean a Kotlin-based Minecraft server implementation using ActionKit for networking and packet handling). This is a simplified example to get you started. You'll need to adapt it to your specific needs and add more features. **Important Considerations:** * **ActionKit:** ActionKit is a Kotlin library for building high-performance network applications. You'll need to include it as a dependency in your project. I'll assume you're using Gradle for this example. * **Minecraft Protocol:** The Minecraft protocol is complex. You'll need to understand the protocol specifications to properly handle packets. Refer to the official Minecraft protocol documentation (wiki.vg is a good resource). * **Threading:** Minecraft servers are inherently multi-threaded. You'll need to manage threads carefully to avoid race conditions and ensure performance. ActionKit helps with asynchronous operations. * **Error Handling:** Robust error handling is crucial for a stable server. * **Logging:** Implement logging to help debug and monitor your server. **Gradle Dependencies (build.gradle.kts):** ```kotlin plugins { kotlin("jvm") version "1.9.22" // Or the latest Kotlin version id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22" } group = "your.group.id" // Replace with your group ID version = "1.0-SNAPSHOT" repositories { mavenCentral() maven("https://jitpack.io") // For ActionKit (if needed) } dependencies { implementation(kotlin("stdlib")) implementation("io.github.kotlin-action:action:1.0.0") // Or the latest ActionKit version implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.5") // For packet serialization/deserialization testImplementation("org.jetbrains.kotlin:kotlin-test") // Add any other dependencies you need (e.g., logging libraries) } kotlin { jvmToolchain(17) // Or the Java version you want to use } ``` **Kotlin Code (src/main/kotlin/Main.kt):** ```kotlin import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json import java.net.InetSocketAddress import java.nio.channels.AsynchronousServerSocketChannel import java.nio.channels.AsynchronousSocketChannel import java.util.concurrent.Executors import java.nio.ByteBuffer import java.nio.charset.StandardCharsets private val logger = KotlinLogging.logger {} @Serializable data class Handshake(val protocolVersion: Int, val serverAddress: String, val serverPort: Int, val nextState: Int) @Serializable data class StatusRequest(val request: String = "") @Serializable data class StatusResponse(val version: Version, val players: Players, val description: Description) { @Serializable data class Version(val name: String, val protocol: Int) @Serializable data class Players(val max: Int, val online: Int, val sample: List<Sample>) { @Serializable data class Sample(val name: String, val id: String) } @Serializable data class Description(val text: String) } @Serializable data class PingRequest(val payload: Long) fun main() = runBlocking { val port = 25565 // Default Minecraft port val address = InetSocketAddress("0.0.0.0", port) // Listen on all interfaces val serverChannel = AsynchronousServerSocketChannel.open().bind(address) logger.info { "Server started on ${address.hostString}:${address.port}" } while (true) { val clientChannel = serverChannel.accept().await() // Suspend until a client connects logger.info { "Client connected from ${clientChannel.remoteAddress}" } handleClient(clientChannel) } } suspend fun handleClient(clientChannel: AsynchronousSocketChannel) { val receiveChannel = Channel<ByteArray>(Channel.UNLIMITED) val sendChannel = Channel<ByteArray>(Channel.UNLIMITED) val scope = CoroutineScope(Dispatchers.IO) // Launch receive coroutine scope.launch { try { receiveData(clientChannel, receiveChannel) } catch (e: Exception) { logger.error(e) { "Error receiving data: ${e.message}" } clientChannel.close() } finally { receiveChannel.close() sendChannel.close() clientChannel.close() logger.info { "Client disconnected" } } } // Launch send coroutine scope.launch { try { sendData(clientChannel, sendChannel) } catch (e: Exception) { logger.error(e) { "Error sending data: ${e.message}" } clientChannel.close() } finally { receiveChannel.close() sendChannel.close() clientChannel.close() logger.info { "Client disconnected" } } } // Launch packet processing coroutine scope.launch { try { for (data in receiveChannel) { processPacket(data, sendChannel) } } catch (e: Exception) { logger.error(e) { "Error processing packet: ${e.message}" } clientChannel.close() } finally { receiveChannel.close() sendChannel.close() clientChannel.close() logger.info { "Client disconnected" } } } } suspend fun receiveData(clientChannel: AsynchronousSocketChannel, receiveChannel: Channel<ByteArray>) { val bufferSize = 4096 // Adjust as needed val buffer = ByteBuffer.allocate(bufferSize) while (clientChannel.isOpen) { buffer.clear() val bytesRead = clientChannel.read(buffer).await() if (bytesRead == -1) { // Client disconnected break } if (bytesRead > 0) { buffer.flip() val byteArray = ByteArray(bytesRead) buffer.get(byteArray) receiveChannel.send(byteArray) } } } suspend fun sendData(clientChannel: AsynchronousSocketChannel, sendChannel: Channel<ByteArray>) { for (data in sendChannel) { val buffer = ByteBuffer.wrap(data) while (buffer.hasRemaining()) { clientChannel.write(buffer).await() } } } suspend fun processPacket(data: ByteArray, sendChannel: Channel<ByteArray>) { // Implement packet processing logic here // This is where you'll decode the Minecraft protocol packets // and respond accordingly. // Example: Handle Handshake and Status requests try { val packetLength = readVarInt(data, 0).first val packetId = data[getVarIntSize(packetLength)] when (packetId.toInt()) { 0x00 -> { // Handshake logger.info { "Received Handshake packet" } val handshake = decodeHandshake(data.copyOfRange(getVarIntSize(packetLength) + 1, data.size)) if (handshake != null) { logger.info { "Handshake: $handshake" } if (handshake.nextState == 1) { // Status logger.info { "Switching to Status state" } } else if (handshake.nextState == 2) { // Login logger.info { "Switching to Login state (Not implemented)" } } } } 0x00 -> { // Status Request logger.info { "Received Status Request packet" } val statusResponse = createStatusResponse() val json = Json.encodeToString(StatusResponse.serializer(), statusResponse) val responsePacket = createStatusResponsePacket(json) sendChannel.send(responsePacket) } 0x01 -> { // Ping Request logger.info { "Received Ping Request packet" } val pingRequest = decodePing(data.copyOfRange(getVarIntSize(packetLength) + 1, data.size)) if (pingRequest != null) { val pongPacket = createPongPacket(pingRequest.payload) sendChannel.send(pongPacket) } } else -> { logger.warn { "Unknown packet ID: ${packetId.toInt()}" } } } } catch (e: Exception) { logger.error(e) { "Error processing packet: ${e.message}" } } } fun decodeHandshake(data: ByteArray): Handshake? { try { var offset = 0 val protocolVersionResult = readVarInt(data, offset) val protocolVersion = protocolVersionResult.first offset += protocolVersionResult.second val serverAddressLengthResult = readVarInt(data, offset) val serverAddressLength = serverAddressLengthResult.first offset += serverAddressLengthResult.second val serverAddressBytes = data.copyOfRange(offset, offset + serverAddressLength) val serverAddress = String(serverAddressBytes, StandardCharsets.UTF_8) offset += serverAddressLength val serverPort = ((data[offset].toInt() and 0xFF) shl 8) or (data[offset + 1].toInt() and 0xFF) offset += 2 val nextStateResult = readVarInt(data, offset) val nextState = nextStateResult.first return Handshake(protocolVersion, serverAddress, serverPort, nextState) } catch (e: Exception) { logger.error(e) { "Error decoding handshake: ${e.message}" } return null } } fun decodePing(data: ByteArray): PingRequest? { try { val payload = java.nio.ByteBuffer.wrap(data).long return PingRequest(payload) } catch (e: Exception) { logger.error(e) { "Error decoding ping: ${e.message}" } return null } } fun createStatusResponse(): StatusResponse { val version = StatusResponse.Version("My Kotlin Server", 754) // Example version and protocol val players = StatusResponse.Players( max = 100, online = 0, sample = listOf( StatusResponse.Players.Sample("Player1", "uuid1"), StatusResponse.Players.Sample("Player2", "uuid2") ) ) val description = StatusResponse.Description("A Kotlin Minecraft Server") return StatusResponse(version, players, description) } fun createStatusResponsePacket(json: String): ByteArray { val jsonBytes = json.toByteArray(StandardCharsets.UTF_8) val packetId = 0x00.toByte() // Status Response packet ID val dataLength = jsonBytes.size val dataLengthBytes = toVarInt(dataLength) val packet = ByteArray(dataLengthBytes.size + 1 + jsonBytes.size) System.arraycopy(dataLengthBytes, 0, packet, 0, dataLengthBytes.size) packet[dataLengthBytes.size] = packetId System.arraycopy(jsonBytes, 0, packet, dataLengthBytes.size + 1, jsonBytes.size) val packetLength = packet.size - toVarInt(0).size val packetLengthBytes = toVarInt(packetLength) val fullPacket = ByteArray(packetLengthBytes.size + packet.size) System.arraycopy(packetLengthBytes, 0, fullPacket, 0, packetLengthBytes.size) System.arraycopy(packet, 0, fullPacket, packetLengthBytes.size, packet.size) return fullPacket } fun createPongPacket(payload: Long): ByteArray { val packetId = 0x01.toByte() // Pong packet ID val payloadBytes = java.nio.ByteBuffer.allocate(8).putLong(payload).array() val packet = ByteArray(1 + payloadBytes.size) packet[0] = packetId System.arraycopy(payloadBytes, 0, packet, 1, payloadBytes.size) val packetLength = packet.size val packetLengthBytes = toVarInt(packetLength) val fullPacket = ByteArray(packetLengthBytes.size + packet.size) System.arraycopy(packetLengthBytes, 0, fullPacket, 0, packetLengthBytes.size) System.arraycopy(packet, 0, fullPacket, packetLengthBytes.size, packet.size) return fullPacket } fun toVarInt(value: Int): ByteArray { var numToWrite = value val output = mutableListOf<Byte>() while (true) { var byte = (numToWrite and 0x7F).toByte() numToWrite = numToWrite ushr 7 if (numToWrite != 0) { byte = (byte or 0x80).toByte() } output.add(byte) if (numToWrite == 0) { break } } return output.toByteArray() } fun readVarInt(data: ByteArray, offset: Int): Pair<Int, Int> { var numRead = 0 var result = 0 var currentByte: Byte var currentOffset = offset do { currentByte = data[currentOffset] val value = (currentByte.toInt() and 0x7F) result = result or (value shl (7 * numRead)) numRead++ currentOffset++ if (numRead > 5) { throw RuntimeException("VarInt is too big") } } while (currentByte.toInt() and 0x80 != 0) return Pair(result, numRead) } fun getVarIntSize(value: Int): Int { var size = 0 var numToWrite = value while (true) { numToWrite = numToWrite ushr 7 size++ if (numToWrite == 0) { break } } return size } ``` **Explanation:** 1. **Dependencies:** The `build.gradle.kts` file defines the dependencies, including Kotlin standard library, ActionKit, and kotlinx.serialization. 2. **Logging:** Uses KotlinLogging for logging. 3. **Data Classes:** Defines data classes for Handshake, Status Request, Status Response, and Ping Request packets using `kotlinx.serialization`. These represent the structure of the packets. 4. **`main` Function:** * Creates an `AsynchronousServerSocketChannel` to listen for incoming connections on port 25565. * Enters an infinite loop, accepting client connections using `serverChannel.accept().await()`. The `await()` function suspends the coroutine until a connection is established. * Calls `handleClient()` to process each client connection. 5. **`handleClient` Function:** * Creates two `Channel`s: `receiveChannel` for receiving data from the client and `sendChannel` for sending data to the client. * Launches three coroutines using `CoroutineScope(Dispatchers.IO).launch`: * **`receiveData`:** Reads data from the `clientChannel` and sends it to the `receiveChannel`. * **`sendData`:** Reads data from the `sendChannel` and writes it to the `clientChannel`. * **`processPacket`:** Reads data from the `receiveChannel`, decodes the Minecraft protocol packets, and responds accordingly. 6. **`receiveData` Function:** * Asynchronously reads data from the `clientChannel` into a `ByteBuffer`. * Sends the received data as a `ByteArray` to the `receiveChannel`. 7. **`sendData` Function:** * Asynchronously reads `ByteArray`s from the `sendChannel` and writes them to the `clientChannel`. 8. **`processPacket` Function:** * This is the core of the server logic. It's responsible for: * Decoding the Minecraft protocol packets. * Handling different packet types (e.g., Handshake, Status Request, Ping Request). * Generating appropriate responses. * The example code provides basic handling for Handshake, Status Request, and Ping Request packets. * **Important:** You'll need to implement the full Minecraft protocol decoding and handling logic here. 9. **`decodeHandshake`, `decodePing` Functions:** * These functions decode the Handshake and Ping packets from the byte array. 10. **`createStatusResponse`, `createStatusResponsePacket`, `createPongPacket` Functions:** * These functions create the Status Response and Pong packets to send back to the client. 11. **`toVarInt`, `readVarInt`, `getVarIntSize` Functions:** * These functions handle the Minecraft protocol's VarInt encoding. **How to Run:** 1. **Install Dependencies:** Make sure you have Kotlin and Gradle installed. 2. **Create Project:** Create a new Kotlin project in your IDE (IntelliJ IDEA is recommended). 3. **Add Code:** Copy the `build.gradle.kts` and `Main.kt` files into your project. 4. **Build:** Run `gradle build` in your terminal. 5. **Run:** Run `gradle run` in your terminal. **Next Steps:** * **Implement the Full Minecraft Protocol:** The provided code only handles a small subset of the Minecraft protocol. You'll need to implement the rest of the protocol to support login, world loading, player movement, and other game features. Refer to the Minecraft protocol documentation (wiki.vg). * **World Generation:** Implement world generation logic to create the game world. * **Entity Management:** Implement entity management to handle players, mobs, and other entities in the world. * **Command Handling:** Implement command handling to allow players to execute commands. * **Plugin API:** Consider creating a plugin API to allow other developers to extend your server's functionality. * **Optimization:** Optimize your code for performance to handle a large number of players. * **Security:** Implement security measures to protect your server from attacks. **Important Notes:** * **Asynchronous Operations:** ActionKit is designed for asynchronous operations. Use `await()` to suspend coroutines when waiting for I/O operations to complete. * **Error Handling:** Implement proper error handling to catch exceptions and prevent your server from crashing. * **Logging:** Use logging to help debug and monitor your server. * **Minecraft Protocol Documentation:** The Minecraft protocol is complex. Refer to the official documentation (wiki.vg) for details. * **Threading:** Be careful when working with threads. Use appropriate synchronization mechanisms to avoid race conditions. This starter code provides a basic foundation for building a Minecraft server with ActionKit. You'll need to add a lot more code to create a fully functional server. Good luck! **Japanese Translation:** ``` ActionKit を利用した MCP サーバーのスターターコード これは、ActionKit を使用した Kotlin ベースの Minecraft サーバー実装の基本的なスターターコードの構造と説明です (ActionKit はネットワークとパケット処理に使用すると仮定します)。 これは、開始するための簡略化された例です。 特定のニーズに合わせて調整し、より多くの機能を追加する必要があります。 **重要な考慮事項:** * **ActionKit:** ActionKit は、高性能ネットワークアプリケーションを構築するための Kotlin ライブラリです。 プロジェクトに依存関係として含める必要があります。 この例では Gradle を使用していると仮定します。 * **Minecraft プロトコル:** Minecraft プロトコルは複雑です。 パケットを適切に処理するには、プロトコルの仕様を理解する必要があります。 公式の Minecraft プロトコルドキュメント (wiki.vg が良いリソースです) を参照してください。 * **スレッド処理:** Minecraft サーバーは本質的にマルチスレッドです。 競合状態を回避し、パフォーマンスを確保するには、スレッドを慎重に管理する必要があります。 ActionKit は非同期操作を支援します。 * **エラー処理:** 安定したサーバーには、堅牢なエラー処理が不可欠です。 * **ロギング:** サーバーのデバッグと監視に役立つようにロギングを実装します。 **Gradle の依存関係 (build.gradle.kts):** ```kotlin plugins { kotlin("jvm") version "1.9.22" // または最新の Kotlin バージョン id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22" } group = "your.group.id" // グループ ID に置き換えてください version = "1.0-SNAPSHOT" repositories { mavenCentral() maven("https://jitpack.io") // ActionKit 用 (必要な場合) } dependencies { implementation(kotlin("stdlib")) implementation("io.github.kotlin-action:action:1.0.0") // または最新の ActionKit バージョン implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.5") // パケットのシリアル化/デシリアル化用 testImplementation("org.jetbrains.kotlin:kotlin-test") // その他必要な依存関係を追加してください (例: ロギングライブラリ) } kotlin { jvmToolchain(17) // または使用する Java バージョン } ``` **Kotlin コード (src/main/kotlin/Main.kt):** ```kotlin import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json import java.net.InetSocketAddress import java.nio.channels.AsynchronousServerSocketChannel import java.nio.channels.AsynchronousSocketChannel import java.util.concurrent.Executors import java.nio.ByteBuffer import java.nio.charset.StandardCharsets private val logger = KotlinLogging.logger {} @Serializable data class Handshake(val protocolVersion: Int, val serverAddress: String, val serverPort: Int, val nextState: Int) @Serializable data class StatusRequest(val request: String = "") @Serializable data class StatusResponse(val version: Version, val players: Players, val description: Description) { @Serializable data class Version(val name: String, val protocol: Int) @Serializable data class Players(val max: Int, val online: Int, val sample: List<Sample>) { @Serializable data class Sample(val name: String, val id: String) } @Serializable data class Description(val text: String) } @Serializable data class PingRequest(val payload: Long) fun main() = runBlocking { val port = 25565 // Minecraft のデフォルトポート val address = InetSocketAddress("0.0.0.0", port) // すべてのインターフェースでリッスン val serverChannel = AsynchronousServerSocketChannel.open().bind(address) logger.info { "サーバーが ${address.hostString}:${address.port} で起動しました" } while (true) { val clientChannel = serverChannel.accept().await() // クライアントが接続するまで一時停止 logger.info { "クライアントが ${clientChannel.remoteAddress} から接続しました" } handleClient(clientChannel) } } suspend fun handleClient(clientChannel: AsynchronousSocketChannel) { val receiveChannel = Channel<ByteArray>(Channel.UNLIMITED) val sendChannel = Channel<ByteArray>(Channel.UNLIMITED) val scope = CoroutineScope(Dispatchers.IO) // 受信コルーチンを起動 scope.launch { try { receiveData(clientChannel, receiveChannel) } catch (e: Exception) { logger.error(e) { "データ受信エラー: ${e.message}" } clientChannel.close() } finally { receiveChannel.close() sendChannel.close() clientChannel.close() logger.info { "クライアントが切断されました" } } } // 送信コルーチンを起動 scope.launch { try { sendData(clientChannel, sendChannel) } catch (e: Exception) { logger.error(e) { "データ送信エラー: ${e.message}" } clientChannel.close() } finally { receiveChannel.close() sendChannel.close() clientChannel.close() logger.info { "クライアントが切断されました" } } } // パケット処理コルーチンを起動 scope.launch { try { for (data in receiveChannel) { processPacket(data, sendChannel) } } catch (e: Exception) { logger.error(e) { "パケット処理エラー: ${e.message}" } clientChannel.close() } finally { receiveChannel.close() sendChannel.close() clientChannel.close() logger.info { "クライアントが切断されました" } } } } suspend fun receiveData(clientChannel: AsynchronousSocketChannel, receiveChannel: Channel<ByteArray>) { val bufferSize = 4096 // 必要に応じて調整 val buffer = ByteBuffer.allocate(bufferSize) while (clientChannel.isOpen) { buffer.clear() val bytesRead = clientChannel.read(buffer).await() if (bytesRead == -1) { // クライアントが切断されました break } if (bytesRead > 0) { buffer.flip() val byteArray = ByteArray(bytesRead) buffer.get(byteArray) receiveChannel.send(byteArray) } } } suspend fun sendData(clientChannel: AsynchronousSocketChannel, sendChannel: Channel<ByteArray>) { for (data in sendChannel) { val buffer = ByteBuffer.wrap(data) while (buffer.hasRemaining()) { clientChannel.write(buffer).await() } } } suspend fun processPacket(data: ByteArray, sendChannel: Channel<ByteArray>) { // ここにパケット処理ロジックを実装します // これは、Minecraft プロトコルパケットをデコードする場所です // それに応じて応答します。 // 例: ハンドシェイクとステータスリクエストを処理する try { val packetLength = readVarInt(data, 0).first val packetId = data[getVarIntSize(packetLength)] when (packetId.toInt()) { 0x00 -> { // ハンドシェイク logger.info { "ハンドシェイクパケットを受信しました" } val handshake = decodeHandshake(data.copyOfRange(getVarIntSize(packetLength) + 1, data.size)) if (handshake != null) { logger.info { "ハンドシェイク: $handshake" } if (handshake.nextState == 1) { // ステータス logger.info { "ステータス状態に切り替えます" } } else if (handshake.nextState == 2) { // ログイン logger.info { "ログイン状態に切り替えます (未実装)" } } } } 0x00 -> { // ステータスリクエスト logger.info { "ステータスリクエストパケットを受信しました" } val statusResponse = createStatusResponse() val json = Json.encodeToString(StatusResponse.serializer(), statusResponse) val responsePacket = createStatusResponsePacket(json) sendChannel.send(responsePacket) } 0x01 -> { // Ping リクエスト logger.info { "Ping リクエストパケットを受信しました" } val pingRequest = decodePing(data.copyOfRange(getVarIntSize(packetLength) + 1, data.size)) if (pingRequest != null) { val pongPacket = createPongPacket(pingRequest.payload) sendChannel.send(pongPacket) } } else -> { logger.warn { "不明なパケット ID: ${packetId.toInt()}" } } } } catch (e: Exception) { logger.error(e) { "パケット処理エラー: ${e.message}" } } } fun decodeHandshake(data: ByteArray): Handshake? { try { var offset = 0 val protocolVersionResult = readVarInt(data, offset) val protocolVersion = protocolVersionResult.first offset += protocolVersionResult.second val serverAddressLengthResult = readVarInt(data, offset) val serverAddressLength = serverAddressLengthResult.first offset += serverAddressLengthResult.second val serverAddressBytes = data.copyOfRange(offset, offset + serverAddressLength) val serverAddress = String(serverAddressBytes, StandardCharsets.UTF_8) offset += serverAddressLength val serverPort = ((data[offset].toInt() and 0xFF) shl 8) or (data[offset + 1].toInt() and 0xFF) offset += 2 val nextStateResult = readVarInt(data, offset) val nextState = nextStateResult.first return Handshake(protocolVersion, serverAddress, serverPort, nextState) } catch (e: Exception) { logger.error(e) { "ハンドシェイクのデコードエラー: ${e.message}" } return null } } fun decodePing(data: ByteArray): PingRequest? { try { val payload = java.nio.ByteBuffer.wrap(data).long return PingRequest(payload) } catch (e: Exception) { logger.error(e) { "Ping のデコードエラー: ${e.message}" } return null } } fun createStatusResponse(): StatusResponse { val version = StatusResponse.Version("My Kotlin Server", 754) // バージョンとプロトコルの例 val players = StatusResponse.Players( max = 100, online = 0, sample = listOf( StatusResponse.Players.Sample("Player1", "uuid1"), StatusResponse.Players.Sample("Player2", "uuid2") ) ) val description = StatusResponse.Description("Kotlin Minecraft サーバー") return StatusResponse(version, players, description) } fun createStatusResponsePacket(json: String): ByteArray { val jsonBytes = json.toByteArray(StandardCharsets.UTF_8) val packetId = 0x00.toByte() // ステータス応答パケット ID val dataLength = jsonBytes.size val dataLengthBytes = toVarInt(dataLength) val packet = ByteArray(dataLengthBytes.size + 1 + jsonBytes.size) System.arraycopy(dataLengthBytes, 0, packet, 0, dataLengthBytes.size) packet[dataLengthBytes.size] = packetId System.arraycopy(jsonBytes, 0, packet, dataLengthBytes.size + 1, jsonBytes.size) val packetLength = packet.size - toVarInt(0).size val packetLengthBytes = toVarInt(packetLength) val fullPacket = ByteArray(packetLengthBytes.size + packet.size) System.arraycopy(packetLengthBytes, 0, fullPacket, 0, packetLengthBytes.size) System.arraycopy(packet, 0, fullPacket, packetLengthBytes.size, packet.size) return fullPacket } fun createPongPacket(payload: Long): ByteArray { val packetId = 0x01.toByte() // Pong パケット ID val payloadBytes = java.nio.ByteBuffer.allocate(8).putLong(payload).array() val packet = ByteArray(1 + payloadBytes.size) packet[0] = packetId System.arraycopy(payloadBytes, 0, packet, 1, payloadBytes.size) val packetLength = packet.size val packetLengthBytes = toVarInt(packetLength) val fullPacket = ByteArray(packetLengthBytes.size + packet.size) System.arraycopy(packetLengthBytes, 0, fullPacket, 0, packetLengthBytes.size) System.arraycopy(packet, 0, fullPacket, packetLengthBytes.size, packet.size) return fullPacket } fun toVarInt(value: Int): ByteArray { var numToWrite = value val output = mutableListOf<Byte>() while (true) { var byte = (numToWrite and 0x7F).toByte() numToWrite = numToWrite ushr 7 if (numToWrite != 0) { byte = (byte or 0x80).toByte() } output.add(byte) if (numToWrite == 0) { break } } return output.toByteArray() } fun readVarInt(data: ByteArray, offset: Int): Pair<Int, Int> { var numRead = 0 var result = 0 var currentByte: Byte var currentOffset = offset do { currentByte = data[currentOffset] val value = (currentByte.toInt() and 0x7F) result = result or (value shl (7 * numRead)) numRead++ currentOffset++ if (numRead > 5) { throw RuntimeException("VarInt が大きすぎます") } } while (currentByte.toInt() and 0x80 != 0) return Pair(result, numRead) } fun getVarIntSize(value: Int): Int { var size = 0 var numToWrite = value while (true) { numToWrite = numToWrite ushr 7 size++ if (numToWrite == 0) { break } } return size } ``` **説明:** 1. **依存関係:** `build.gradle.kts` ファイルは、Kotlin 標準ライブラリ、ActionKit、および kotlinx.serialization を含む依存関係を定義します。 2. **ロギング:** KotlinLogging をロギングに使用します。 3. **データクラス:** `kotlinx.serialization` を使用して、ハンドシェイク、ステータスリクエスト、ステータスレスポンス、および Ping リクエストパケットのデータクラスを定義
Wisdom MCP Gateway
Enterpret の Wisdom MCP SSE サーバー用の stdio ゲートウェイ
Browserbase MCP Server
鏡 (Kagami)
LangGraph MCP Server
Pythonベースのモデルコンテキストプロトコル(MCP)サーバー。LLMが標準化されたインターフェースを通じて外部ツールやリソースにアクセスできるようにする。
Todoist MCP Server Enhanced
鏡 (Kagami)
Awesome MCP Servers
素晴らしい MCP サーバー - 厳選された Model Context Protocol サーバーリスト
KR-MCP-Server
これは、[MCP-Go] フレームワークに基づいて開発されたMCPサービスプロジェクトで、一連のツールと機能を提供します。
Multimodal Model Context Protocal Server
マルチモーダル MCP サーバー
MCP-DevTools
より良いカーソルのための pptr mcp サーバー
GitHub API MCP Server
これは GitHub 検索の MCP Server です。
Postman MCP Server
Cloudflare Workers で構築された、Claude やその他の AI アシスタントとの統合のためのモデルコンテキストプロトコル (MCP) サーバー
MCP Go 🚀
Model Context Protocol (MCP) の Go 実装。LLM アプリケーションと外部データソースやツールとのシームレスな統合を可能にします。
Deriv API Server
鏡 (Kagami)
Code Runner MCP Server
鏡 (Kagami)
MCP Server for Jira
Specifai MCP Server
MCPサーバーは、Specifaiプロジェクトの要件やタスクなどを、Hai BuildやCursorのようなMCPをサポートするAIツールに提供します。
Axiom MCP Server
Axiom用のMCPサーバー
Reader Server
Image Generation MCP Server
鏡 (Kagami)
Claude-LMStudio Bridge
LM Studioで動作するローカルLLMとClaudeを連携させ、ローカルモデルを通じてモデル一覧の表示、テキスト生成、チャット補完機能を利用できるようにするMCPサーバー。
OpenDota MCP Server
鏡 (Kagami)
Tutorial: Create an MCP Server in .NET using C#
これは、.NETでMCPサーバーを作成する非常に基本的な例です。
Meilisearch MCP Server (Go)
Meilisearch用のGo製MCPサーバーラッパー。ClaudeのようなLLMがModel Context Protocolを介して強力な検索機能にアクセスできるようにします。
Basecamp MCP Integration
MCPサーバーで、Basecamp 3+ APIと連携する
🚀 Model Context Protocol (MCP) Server Python Template 🐍
PythonでModel Context Protocolサーバーを構築するための合理化された基盤であり、MCPツールのAI支援開発をより簡単かつ効率的に行うように設計されています。
mcp
様々なタスクのためのMCPサーバーのコレクション
Example MCP Server + Client Implementation
MCPサーバー(ダミーAPIを使用)と基本的なクライアントのデモ実装。
Unsplash MCP Server
軽量サーバーで、Unsplashの画像ライブラリとのシームレスな統合を可能にし、開発者はCursorエディタから直接、様々なフィルターを使って高品質な写真を検索できます。
Swytchcode MCP server
Swytchcodeは、API連携を加速させ、開発者がPostmanコレクションまたはOpenAPI仕様を使用して、あらゆるAPIをシームレスに統合できるようにします。Swytchcodeを使用することで、開発者は希望するプログラミング言語で、すぐに本番環境で使用できるコードを取得でき、統合時間を最大90%短縮できます。 Swytchcodeプラットフォームは、80以上のAPIのコード生成をサポートしており、必要に応じてAPIを追加できます。この効率化されたアプローチにより、開発者は面倒な統合タスクではなく、イノベーションに集中できます。 主な機能: APIサポート:Stripe、PayPal、Shopifyなどの人気のあるFinTechサービスを含む、80以上のAPIと統合。 コード生成:複数のプログラミング言語でコードを生成し、さまざまな開発環境との互換性を確保。 オンデマンドAPI追加:開発者は必要に応じて、追加のAPIのサポートをリクエスト可能。
Model Context Protocol (MCP) Server
グローバルルールをコーディングエージェントに転送するためのMCPサーバーミドルウェア