Discover Awesome MCP Servers
Extend your agent with 15,668 capabilities via MCP servers.
- All15,668
- 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
Confluence Wiki MCP Server Extension
鏡 (Kagami)
MCPHub 🚀
MCPHub - Model Context Protocol (MCP) サーバーを見つけ、インストールし、管理するためのクロスプラットフォーム GUI アプリケーションです。apt/pip の MCP サーバー版と考えてください。
Quarkus Model Context Protocol (MCP) Server
この拡張機能を使用すると、開発者はMCPサーバーの機能を簡単に実装できます。
TypeScript MCP Server
📱 MCP Server for iOS Simulator
worker17
労働者の生産性を監視し、必要に応じて解雇するMCPサーバー。
Mcp Servers Collection
検証済みのMCPサーバーと連携機能のコレクション
mcp-server-yahoo-finance MCP server
鏡 (Kagami)
MCP Test Client
MCP Test Client は、Model Context Protocol (MCP) サーバー用の TypeScript テストユーティリティです。
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 リクエストパケットのデータクラスを定義
Database Analyzer MCP Server
Local iMessage RAG MCP Server
Anthropic MCP ハッカソン(ニューヨーク)の iMessage RAG MCP サーバー
Trino MCP Server
鏡 (Kagami)

Mcp Namecheap Registrar
Namecheap APIに接続して、ドメインの空き状況と価格を確認し、登録します。
MCP Bundler Service
GitHubリポジトリからMCPサーバーをバンドルし、デプロイメントの準備をするためのマイクロサービス。
mcp-server
MCP サーバーの作り方を学びましょう。
Minimal MCP Server
最小限の Model Context Protocol (MCP) サーバーの実装
MCP Servers Multi-Agent AI Infrastructure
@enemyrr/mcp-mysql-server
鏡 (Kagami)
MCP Actions Adapter
MCPサーバーをGPT Actions互換APIに変換するシンプルなアダプター
xtrace-mcp
Alpaca MCP Server
鏡 (Kagami)
Servidor MCP do Supabase
Supabase の MCP サーバー、データクエリと挿入機能付き
Eka MCP Server
Eka MCPサーバー (Eka MCP sābā)
MCP (Model Context Protocol)
AI のためのシンプルなモデルコンテキストサーバー
Chrome MCP Server
Chrome 拡張機能と Claude AI の連携のための MCP サーバー
MSSQL MCP Server
鏡 (Kagami)
T2_C2
MCP (Mod Coder Pack) is a set of tools and scripts used to decompile, deobfuscate, and recompile Minecraft's source code. It's not a single piece of server code, but rather a collection of utilities. Therefore, I can't provide "server code for MCP." However, I can explain what MCP does and how it relates to Minecraft server development, and point you to resources. **What MCP Does:** * **Decompilation:** Takes the obfuscated Minecraft server (or client) `.jar` file and converts the bytecode into human-readable Java code. * **Deobfuscation:** Renames the obfuscated class and method names to more meaningful names, making the code easier to understand. This is done using mappings (text files that define the original obfuscated names and the new, deobfuscated names). * **Patching:** Allows you to apply modifications (patches) to the decompiled source code. * **Recompilation:** Compiles the modified Java code back into a `.jar` file that can be used as a modified Minecraft server. * **Reobfuscation:** (Optional) Re-obfuscates the code using the original obfuscation scheme, making it compatible with the official Minecraft client. This is less common for server mods. **Why MCP is Important for Server Development:** * **Understanding Minecraft Internals:** MCP allows developers to see how the Minecraft server works internally, which is essential for creating complex mods. * **Modifying Existing Behavior:** By decompiling and modifying the source code, developers can change the way the server behaves. * **Creating New Features:** MCP provides a foundation for adding entirely new features to the Minecraft server. **How to Use MCP (General Steps):** 1. **Download MCP:** MCP is no longer actively maintained. However, you can find older versions online. A more modern alternative is **Forge MDK (Mod Development Kit)**, which includes decompilation tools and a build environment. Search for "Forge MDK download" to find the latest version. Forge is the standard for Minecraft modding. 2. **Set up the Environment:** MCP (or Forge MDK) requires a Java Development Kit (JDK). Make sure you have a compatible JDK installed. 3. **Decompile Minecraft:** Use the MCP scripts (or Forge MDK tools) to decompile the Minecraft server `.jar` file. 4. **Deobfuscate:** Apply the mappings to deobfuscate the code. 5. **Modify the Code:** Make the changes you want to the decompiled Java code. 6. **Recompile:** Compile the modified code back into a `.jar` file. 7. **Test:** Run the modified server and test your changes. **Important Considerations:** * **Minecraft EULA:** Be aware of the Minecraft End User License Agreement (EULA) when creating and distributing mods. The EULA restricts commercial use of modified Minecraft code. * **Obfuscation Changes:** Mojang changes the obfuscation scheme with each Minecraft update, so you'll need updated mappings for each version. Forge usually provides these. * **Forge vs. MCP:** Forge is the dominant modding platform. It provides an API that makes it easier to create mods without directly modifying the base Minecraft code. Using Forge is generally recommended over directly patching the Minecraft source code with MCP. **Example (Conceptual - using Forge):** Let's say you want to create a simple server mod that changes the message that's displayed when a player joins the game. Using Forge, you would: 1. **Create a Forge Mod Project:** Use the Forge MDK to create a new mod project. 2. **Add Dependencies:** Add the necessary Forge dependencies to your project. 3. **Create an Event Handler:** Create a Java class that listens for the `PlayerEvent.PlayerLoggedInEvent`. 4. **Modify the Join Message:** In the event handler, get the player's name and create a new join message. You might use `event.getEntity().sendMessage(new TextComponentString("Welcome, " + event.getEntity().getName() + "!"));` 5. **Register the Event Handler:** Register your event handler with the Forge event bus. 6. **Build the Mod:** Build the mod into a `.jar` file. 7. **Install the Mod:** Place the `.jar` file in the `mods` folder of your Minecraft server. **In summary, there is no single "MCP server code." MCP is a toolset for working with the Minecraft server's code. Forge is the recommended platform for modern Minecraft modding.** To get started, I recommend: * **Download the latest Forge MDK:** Search for "Forge MDK download". * **Follow a Forge modding tutorial:** There are many excellent tutorials available online. Search for "Forge modding tutorial". Let me know if you have more specific questions about Minecraft server modding or Forge.
Wisdom MCP Gateway
Enterpret の Wisdom MCP SSE サーバー用の stdio ゲートウェイ
RapidAPI MCP Server
承知いたしました。以下に、RapidAPI Global Patent APIとの連携とSQLiteストレージを利用したMCPサーバーの実装について、日本語で説明します。 **MCP (Minecraft Protocol) サーバー実装:RapidAPI Global Patent API連携とSQLiteストレージ** この実装は、Minecraft Protocol (MCP) サーバーを構築し、RapidAPI Global Patent APIを利用して特許情報を取得し、SQLiteデータベースに保存するものです。 **概要** 1. **MCPサーバー:** Minecraftクライアントからの接続を受け付け、ゲームロジックを処理するサーバーです。 2. **RapidAPI Global Patent API連携:** 特許情報を取得するために、RapidAPIのGlobal Patent APIを利用します。 3. **SQLiteストレージ:** 取得した特許情報をSQLiteデータベースに保存します。 **実装のポイント** * **MCPサーバーの構築:** * 適切なMCPサーバーライブラリ(例:Glowstone、SpongeForge)を選択し、基本的なサーバー機能を実装します。 * プレイヤーのログイン、チャット、コマンド処理などの機能を実装します。 * **RapidAPI Global Patent API連携:** * RapidAPIアカウントを作成し、Global Patent APIのサブスクリプションを取得します。 * APIキーを取得し、サーバーコードに組み込みます。 * APIリクエストを送信し、特許情報をJSON形式で取得する関数を実装します。 * APIリクエストのレート制限に注意し、適切なエラーハンドリングを実装します。 * **SQLiteストレージ:** * SQLiteデータベースを作成し、特許情報を格納するテーブルを定義します。 * 取得した特許情報をデータベースに挿入する関数を実装します。 * 特許情報を検索、更新、削除する関数を実装します。 * **Minecraftコマンドの実装:** * Minecraftクライアントから特許情報を検索するためのコマンドを実装します(例:`/patent search <キーワード>`)。 * コマンド実行時に、RapidAPI Global Patent APIにリクエストを送信し、取得した特許情報をSQLiteデータベースに保存します。 * 検索結果をMinecraftクライアントに表示します。 * **エラーハンドリング:** * APIリクエストのエラー、データベース操作のエラーなど、様々なエラーを適切に処理します。 * エラーログを記録し、問題発生時のデバッグを容易にします。 * **セキュリティ:** * APIキーを安全に管理します。 * SQLインジェクション攻撃を防ぐために、パラメータ化されたクエリを使用します。 **技術スタックの例** * **プログラミング言語:** Java (MCPサーバーライブラリとの互換性のため) * **MCPサーバーライブラリ:** Glowstone、SpongeForge * **データベース:** SQLite * **HTTPクライアント:** Apache HttpClient、OkHttp * **JSONライブラリ:** Gson、Jackson **実装例 (Java)** ```java // RapidAPI Global Patent APIへのリクエスト送信 public String searchPatents(String keyword) { // APIキー、APIエンドポイントの設定 String apiKey = "YOUR_API_KEY"; String apiUrl = "https://rapidapi.com/api/global-patent-api/search?q=" + keyword; // HTTPクライアントの作成 HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet(apiUrl); // ヘッダーの設定 request.setHeader("X-RapidAPI-Key", apiKey); request.setHeader("X-RapidAPI-Host", "global-patent-api.p.rapidapi.com"); // APIリクエストの送信 HttpResponse response = client.execute(request); // レスポンスの処理 HttpEntity entity = response.getEntity(); if (entity != null) { return EntityUtils.toString(entity); } else { return null; } } // SQLiteデータベースへの保存 public void savePatent(Patent patent) { // データベース接続 Connection connection = DriverManager.getConnection("jdbc:sqlite:patents.db"); // SQL文の作成 String sql = "INSERT INTO patents (title, abstract, publication_date) VALUES (?, ?, ?)"; PreparedStatement statement = connection.prepareStatement(sql); statement.setString(1, patent.getTitle()); statement.setString(2, patent.getAbstract()); statement.setString(3, patent.getPublicationDate()); // SQL文の実行 statement.executeUpdate(); // データベース接続のクローズ connection.close(); } ``` **注意点** * RapidAPI Global Patent APIの利用規約と料金プランをよく確認してください。 * APIのレート制限を超えないように、リクエスト頻度を調整してください。 * セキュリティ対策を徹底し、APIキーを安全に管理してください。 この説明が、RapidAPI Global Patent APIとの連携とSQLiteストレージを利用したMCPサーバーの実装の参考になれば幸いです。具体的な実装方法については、各ライブラリのドキュメントやサンプルコードを参照してください。