Discover Awesome MCP Servers

Extend your agent with 84,517 capabilities via MCP servers.

All84,517
Okta MCP Server

Okta MCP Server

Claude が Okta のユーザー管理システムと連携し、ユーザー詳細の取得、フィルタリングオプションによるユーザー一覧表示、およびユーザーグループの管理機能を提供します。

Trello-Claude интеграция

Trello-Claude интеграция

Smithery.ai 上の MCP Server を介した Claude と Trello の連携

Flipt MCP Server

Flipt MCP Server

FliptのMCPサーバーを使用すると、AIアシスタントやLLMが、標準化されたインターフェースを通じて、フィーチャーフラグ、セグメント、評価と直接やり取りできます。 例えば、AIアシスタントに次のように質問できます。 「'dark-mode'フラグの現在の状態は何ですか?」

MemGPT MCP Server

MemGPT MCP Server

鏡 (Kagami)

DNSDumpster - MCP Server

DNSDumpster - MCP Server

ConnectWise Manage MCP Server

ConnectWise Manage MCP Server

鏡 (Kagami)

MCP-Wikipedia-API-Server

MCP-Wikipedia-API-Server

AIアシスタント向けにWikipediaの要約を取得するFastAPI-MCPサーバー。Google ColabとNgrokを使ってデプロイ。

mcp-use-didwba

mcp-use-didwba

MCP (Minecraft Protocol) クライアントとサーバーで、didwba を認証技術として使用する例を以下に示します。 (Note: This is a conceptual example. Implementing didwba in Minecraft requires significant custom development and may not be directly compatible with standard Minecraft clients or servers. This example focuses on the core concepts.) **Conceptual Overview:** This example outlines the general steps involved in using didwba (Decentralized Identity with Web Authentication) for Minecraft authentication. It assumes you have a basic understanding of didwba and its underlying technologies (e.g., DIDs, Verifiable Credentials, Web Authentication). **1. Client (Minecraft Client Modification):** * **DID Generation/Storage:** * The modified Minecraft client generates or retrieves a DID (Decentralized Identifier) for the user. This DID is stored securely on the client (e.g., in a keystore). * Example (Conceptual): ``` // Simplified example - in reality, this would involve a proper DID library String did = "did:example:user123"; // Example DID String privateKey = "some_secret_key"; // Securely stored ``` * **Authentication Request:** * When the user attempts to connect to a didwba-enabled Minecraft server, the client initiates an authentication request. * This request includes the user's DID. * Example: ``` // Send DID to server sendToServer("auth_request", did); ``` * **Challenge Response (Web Authentication):** * The server sends back a challenge (e.g., a nonce or a request for a specific Verifiable Credential). * The client uses Web Authentication (e.g., using the `navigator.credentials.get()` API in a browser-like environment embedded in the client) to sign the challenge using the private key associated with the DID. This might involve displaying a prompt to the user for authentication (e.g., using a hardware security key or biometric authentication). * Example (Conceptual - requires a Web Authentication library): ``` // Server sends challenge: String challenge = "random_challenge"; // Simulate Web Authentication signing (replace with actual WebAuthn) String signature = signChallenge(challenge, privateKey); // Send signed challenge back to the server sendToServer("auth_response", signature); ``` **2. Server (Minecraft Server Modification):** * **Authentication Request Handling:** * The server receives the authentication request containing the user's DID. * It generates a unique challenge and sends it back to the client. * Example: ``` // Receive DID from client: String did = receiveFromClient("auth_request"); // Generate a unique challenge String challenge = generateRandomChallenge(); // Store the challenge associated with the DID (e.g., in a map) challengeMap.put(did, challenge); // Send the challenge to the client sendToClient("auth_challenge", challenge); ``` * **Challenge Response Verification:** * The server receives the signed challenge from the client. * It retrieves the original challenge associated with the user's DID. * It verifies the signature using the public key associated with the DID (which can be retrieved from a DID resolver or a trusted source). * Example: ``` // Receive signature from client: String signature = receiveFromClient("auth_response"); // Retrieve the challenge associated with the DID String challenge = challengeMap.get(did); // Get the public key associated with the DID (from a DID resolver) String publicKey = getPublicKeyFromDID(did); // Verify the signature boolean isValid = verifySignature(signature, challenge, publicKey); if (isValid) { // Authentication successful! System.out.println("Authentication successful for DID: " + did); // Grant access to the Minecraft server } else { // Authentication failed System.out.println("Authentication failed for DID: " + did); // Reject the connection } ``` **3. DID Resolver (External Service):** * The server needs a way to resolve DIDs to their corresponding public keys. This is typically done using a DID resolver, which is a service that can look up DID documents and retrieve the public keys associated with a DID. * Example (Conceptual): ``` // Function to retrieve the public key from a DID resolver String getPublicKeyFromDID(String did) { // Make a request to the DID resolver // (e.g., using a REST API) // Example: https://example.com/did-resolver/did:example:user123 // Parse the DID document and extract the public key String publicKey = "the_public_key_associated_with_the_did"; return publicKey; } ``` **Important Considerations:** * **Security:** Securely store private keys on the client. Use robust cryptographic libraries for signing and verification. Protect the DID resolver from attacks. * **DID Method:** Choose a suitable DID method (e.g., did:web, did:key) based on your requirements. * **Web Authentication Integration:** Integrating Web Authentication into a Minecraft client requires embedding a browser-like environment or using a custom implementation. * **Verifiable Credentials (Optional):** You can extend this example to require users to present Verifiable Credentials (VCs) to prove specific attributes (e.g., age, membership in a group). The server would then verify the VCs before granting access. * **Minecraft Protocol:** You'll need to understand the Minecraft protocol to properly send and receive authentication messages. * **Libraries:** Use appropriate libraries for DID management, cryptography, and Web Authentication. **Simplified Code Snippets (Illustrative):** These are highly simplified examples and are not production-ready. ```java // Client (Simplified) String did = "did:example:user123"; String privateKey = "some_secret_key"; String challenge = receiveFromServer("auth_challenge"); String signature = signChallenge(challenge, privateKey); // Replace with WebAuthn sendToServer("auth_response", signature); // Server (Simplified) String did = receiveFromClient("auth_request"); String challenge = generateRandomChallenge(); sendToClient("auth_challenge", challenge); String signature = receiveFromClient("auth_response"); String publicKey = getPublicKeyFromDID(did); boolean isValid = verifySignature(signature, challenge, publicKey); ``` **In summary, this example provides a conceptual framework for using didwba for Minecraft authentication. Implementing this requires significant development effort and careful consideration of security and integration with the Minecraft protocol.** --- **Japanese Translation:** 以下は、MCP (Minecraft Protocol) クライアントとサーバーで、認証技術として didwba (Decentralized Identity with Web Authentication) を使用する例です。 (注意: これは概念的な例です。Minecraft に didwba を実装するには、大幅なカスタム開発が必要であり、標準の Minecraft クライアントまたはサーバーとの直接的な互換性はない可能性があります。この例では、コアとなる概念に焦点を当てています。) **概念的な概要:** この例では、Minecraft 認証に didwba を使用する際に関わる一般的な手順の概要を示します。 didwba とその基盤となる技術 (例: DID、検証可能な資格情報、Web Authentication) について基本的な理解があることを前提としています。 **1. クライアント (Minecraft クライアントの改造):** * **DID の生成/保存:** * 改造された Minecraft クライアントは、ユーザーの DID (分散型識別子) を生成または取得します。 この DID は、クライアントに安全に保存されます (例: キーストア内)。 * 例 (概念的): ```java // 簡単な例 - 実際には、適切な DID ライブラリを使用する必要があります String did = "did:example:user123"; // DID の例 String privateKey = "some_secret_key"; // 安全に保存 ``` * **認証リクエスト:** * ユーザーが didwba 対応の Minecraft サーバーに接続しようとすると、クライアントは認証リクエストを開始します。 * このリクエストには、ユーザーの DID が含まれます。 * 例: ```java // DID をサーバーに送信 sendToServer("auth_request", did); ``` * **チャレンジレスポンス (Web Authentication):** * サーバーはチャレンジ (例: ナンス、または特定の検証可能な資格情報のリクエスト) を返送します。 * クライアントは、Web Authentication (例: クライアントに埋め込まれたブラウザのような環境で `navigator.credentials.get()` API を使用) を使用して、DID に関連付けられた秘密鍵を使用してチャレンジに署名します。 これには、認証のためにユーザーにプロンプトを表示することが含まれる場合があります (例: ハードウェアセキュリティキーまたは生体認証を使用)。 * 例 (概念的 - Web Authentication ライブラリが必要): ```java // サーバーはチャレンジを送信: String challenge = "random_challenge"; // Web Authentication の署名をシミュレート (実際の WebAuthn に置き換えてください) String signature = signChallenge(challenge, privateKey); // 署名されたチャレンジをサーバーに返送 sendToServer("auth_response", signature); ``` **2. サーバー (Minecraft サーバーの改造):** * **認証リクエストの処理:** * サーバーは、ユーザーの DID を含む認証リクエストを受信します。 * 一意のチャレンジを生成し、クライアントに返送します。 * 例: ```java // クライアントから DID を受信: String did = receiveFromClient("auth_request"); // 一意のチャレンジを生成 String challenge = generateRandomChallenge(); // DID に関連付けられたチャレンジを保存 (例: マップ内) challengeMap.put(did, challenge); // チャレンジをクライアントに送信 sendToClient("auth_challenge", challenge); ``` * **チャレンジレスポンスの検証:** * サーバーは、クライアントから署名されたチャレンジを受信します。 * ユーザーの DID に関連付けられた元のチャレンジを取得します。 * DID に関連付けられた公開鍵を使用して署名を検証します (DID リゾルバーまたは信頼できるソースから取得できます)。 * 例: ```java // クライアントから署名を受信: String signature = receiveFromClient("auth_response"); // DID に関連付けられたチャレンジを取得 String challenge = challengeMap.get(did); // DID に関連付けられた公開鍵を取得 (DID リゾルバーから) String publicKey = getPublicKeyFromDID(did); // 署名を検証 boolean isValid = verifySignature(signature, challenge, publicKey); if (isValid) { // 認証成功! System.out.println("DID の認証に成功しました: " + did); // Minecraft サーバーへのアクセスを許可 } else { // 認証失敗 System.out.println("DID の認証に失敗しました: " + did); // 接続を拒否 } ``` **3. DID リゾルバー (外部サービス):** * サーバーは、DID を対応する公開鍵に解決する方法が必要です。 これは通常、DID リゾルバーを使用して行われます。DID リゾルバーは、DID ドキュメントを検索し、DID に関連付けられた公開鍵を取得できるサービスです。 * 例 (概念的): ```java // DID リゾルバーから公開鍵を取得する関数 String getPublicKeyFromDID(String did) { // DID リゾルバーにリクエストを送信 // (例: REST API を使用) // 例: https://example.com/did-resolver/did:example:user123 // DID ドキュメントを解析し、公開鍵を抽出 String publicKey = "the_public_key_associated_with_the_did"; return publicKey; } ``` **重要な考慮事項:** * **セキュリティ:** クライアントに秘密鍵を安全に保存します。 署名と検証には、堅牢な暗号化ライブラリを使用してください。 DID リゾルバーを攻撃から保護します。 * **DID メソッド:** 要件に基づいて、適切な DID メソッド (例: did:web、did:key) を選択します。 * **Web Authentication の統合:** Minecraft クライアントに Web Authentication を統合するには、ブラウザのような環境を埋め込むか、カスタム実装を使用する必要があります。 * **検証可能な資格情報 (オプション):** この例を拡張して、ユーザーが特定の属性 (例: 年齢、グループへの所属) を証明するために検証可能な資格情報 (VC) を提示することを要求できます。 サーバーは、アクセスを許可する前に VC を検証します。 * **Minecraft プロトコル:** 認証メッセージを適切に送受信するには、Minecraft プロトコルを理解する必要があります。 * **ライブラリ:** DID 管理、暗号化、および Web Authentication に適切なライブラリを使用します。 **簡略化されたコードスニペット (説明用):** これらは非常に簡略化された例であり、本番環境で使用できるものではありません。 ```java // クライアント (簡略化) String did = "did:example:user123"; String privateKey = "some_secret_key"; String challenge = receiveFromServer("auth_challenge"); String signature = signChallenge(challenge, privateKey); // WebAuthn に置き換えてください sendToServer("auth_response", signature); // サーバー (簡略化) String did = receiveFromClient("auth_request"); String challenge = generateRandomChallenge(); sendToClient("auth_challenge", challenge); String signature = receiveFromClient("auth_response"); String publicKey = getPublicKeyFromDID(did); boolean isValid = verifySignature(signature, challenge, publicKey); ``` **要約すると、この例は、Minecraft 認証に didwba を使用するための概念的なフレームワークを提供します。 これを実装するには、多大な開発努力と、セキュリティおよび Minecraft プロトコルとの統合を慎重に検討する必要があります。**

MCP-SSE4

MCP-SSE4

MCP サーバーのデモから作成されました。

mcp-server-skyfireWhat is mcp-server-skyfire?How to use mcp-server-skyfire?Key features of mcp-server-skyfire:Use cases of mcp-server-skyfire:FAQ from mcp-server-skyfire:

mcp-server-skyfireWhat is mcp-server-skyfire?How to use mcp-server-skyfire?Key features of mcp-server-skyfire:Use cases of mcp-server-skyfire:FAQ from mcp-server-skyfire:

Unity AI MCP Server

Unity AI MCP Server

Unityゲーム開発向けに、AIを活用したツールやアシスタンスを提供するMCPサーバー

convex-mcp-server MCP Server

convex-mcp-server MCP Server

Model Context Protocol Server for NebulaGraph

Model Context Protocol Server for NebulaGraph

鏡 (Kagami)

Perplexity MCP Server

Perplexity MCP Server

鏡 (Kagami)

Generate images MCP server

Generate images MCP server

画像を生成するためのモデルコンテキストプロトコルサーバー

Crawl4AI MCP Server

Crawl4AI MCP Server

Crawl4AI-MCP: 特定のウェブスクレイピングとClaude AI処理を組み合わせた、強力なウェブクローリングおよびコンテンツ分析サーバーです。カスタマイズ可能な深度、コンテンツ選択、AI分析機能により、特定のウェブサイトから洞察を抽出します。

temp

temp

YouTubeのMCPサーバー!Claude LLMで一度の呼び出しで、YouTubeのトランスクリプトを直接検索してアクセスできます。

MCP server

MCP server

Zipic MCP Server

Zipic MCP Server

Zipicアプリを通じて、画像の圧縮と最適化機能を提供するモデルコンテキストプロトコルサーバー。

gitlab-mr-mcp-server

gitlab-mr-mcp-server

「GitLab MR で動作する MCP サーバー」

Filesystem MCP Server

Filesystem MCP Server

鏡 (Kagami)

Postgers_MCP_for_AWS_RDS

Postgers_MCP_for_AWS_RDS

AWS RDS 上の Postgres DB にアクセスするための MCP サーバーです。

Hello, MCP server.

Hello, MCP server.

基本的な MCP サーバー

Malaysia Prayer Time for Claude Desktop

Malaysia Prayer Time for Claude Desktop

マレーシアの礼拝時間データのためのモデルコンテキストプロトコル(MCP)サーバー

Weather MCP Server

Weather MCP Server

Okay, here's an example of a simple weather MCP (Minecraft Protocol) server in Python. This is a very basic example and doesn't implement the full Minecraft protocol. It focuses on sending a custom packet to a client to display weather information. **Important Considerations:** * **Minecraft Protocol Complexity:** The actual Minecraft protocol is quite complex. This example simplifies things significantly. You'd need a proper library (like `mcstatus` or `nbt`) for more robust interaction. * **Client-Side Mod:** This server sends a custom packet. The Minecraft client *must* have a mod installed that knows how to receive and interpret this custom packet. Without a client-side mod, the client will ignore the packet, and nothing will happen. * **Security:** This is a basic example and doesn't include any security measures. Do not expose this to the open internet without proper security considerations. * **Error Handling:** The error handling is minimal. A production server would need much more robust error handling. * **MCP (Minecraft Protocol) Version:** The Minecraft protocol changes between versions. This example is a general concept and might need adjustments depending on the Minecraft version you're targeting. ```python import socket import struct import time import random # Configuration HOST = '127.0.0.1' # Listen on localhost PORT = 25565 # Use a port (not the default Minecraft port unless you know what you're doing) CUSTOM_PACKET_ID = 0x7F # A custom packet ID (must match client-side mod) def create_weather_packet(temperature, humidity, wind_speed): """Creates a custom weather packet.""" # Format: Packet ID (1 byte), Temperature (float), Humidity (float), Wind Speed (float) packet_data = struct.pack('!bfff', CUSTOM_PACKET_ID, temperature, humidity, wind_speed) # Add packet length (VarInt) packet_length = len(packet_data) length_prefix = encode_varint(packet_length) return length_prefix + packet_data def encode_varint(value): """Encodes an integer as a Minecraft VarInt.""" output = bytearray() while True: byte = value & 0x7F value >>= 7 if value != 0: byte |= 0x80 output.append(byte) if value == 0: break return bytes(output) def handle_client(conn, addr): """Handles a single client connection.""" print(f"Connected by {addr}") try: while True: # Simulate weather data temperature = random.uniform(10.0, 35.0) # Celsius humidity = random.uniform(30.0, 90.0) # Percentage wind_speed = random.uniform(0.0, 15.0) # m/s # Create the weather packet weather_packet = create_weather_packet(temperature, humidity, wind_speed) # Send the packet conn.sendall(weather_packet) print(f"Sent weather data: Temp={temperature:.2f}, Humidity={humidity:.2f}, Wind={wind_speed:.2f}") time.sleep(5) # Send weather data every 5 seconds except ConnectionResetError: print(f"Client {addr} disconnected.") except Exception as e: print(f"Error handling client {addr}: {e}") finally: conn.close() def main(): """Main server function.""" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() print(f"Weather MCP Server listening on {HOST}:{PORT}") while True: conn, addr = s.accept() handle_client(conn, addr) if __name__ == "__main__": main() ``` **Explanation:** 1. **Imports:** Imports necessary modules (`socket`, `struct`, `time`, `random`). 2. **Configuration:** * `HOST`: The IP address to listen on (localhost in this case). * `PORT`: The port to listen on. Choose a port that's not already in use. **Do not use the default Minecraft port (25565) unless you know what you're doing and are prepared to handle the full Minecraft handshake.** * `CUSTOM_PACKET_ID`: A unique ID for your custom packet. This *must* match the ID used in your client-side mod. IDs 0x00-0x1F and 0xFA-0xFF are generally reserved. 3. **`create_weather_packet(temperature, humidity, wind_speed)`:** * This function creates the custom packet that will be sent to the client. * `struct.pack('!bfff', ...)`: This packs the data into a binary format. * `!`: Network byte order (big-endian). Important for Minecraft. * `b`: Signed byte (for the packet ID). * `f`: Float (for temperature, humidity, and wind speed). * `encode_varint(packet_length)`: Encodes the packet length as a VarInt, which is required by the Minecraft protocol. 4. **`encode_varint(value)`:** * Encodes an integer as a Minecraft VarInt. VarInts are a variable-length integer encoding used in the Minecraft protocol. 5. **`handle_client(conn, addr)`:** * Handles the connection with a single client. * It enters a loop that simulates weather data, creates a packet, and sends it to the client every 5 seconds. * Includes basic error handling for client disconnections. 6. **`main()`:** * Creates a socket, binds it to the specified host and port, and listens for incoming connections. * When a client connects, it calls `handle_client()` to handle the connection. **How to Use:** 1. **Save:** Save the code as a Python file (e.g., `weather_server.py`). 2. **Run:** Execute the script from your terminal: `python weather_server.py` 3. **Create a Client-Side Mod:** You *must* create a Minecraft mod that: * Connects to the server at the specified `HOST` and `PORT`. * Listens for packets with the `CUSTOM_PACKET_ID`. * Parses the temperature, humidity, and wind speed from the packet. * Displays the weather information in the game (e.g., on the screen, in a chat message, etc.). 4. **Run Minecraft with the Mod:** Start Minecraft with your mod installed. 5. **Connect:** Your mod should connect to the server, and you should see the weather data being displayed in the game. **Example Client-Side Mod (Conceptual - Requires Actual Modding):** This is a *very* simplified conceptual example of what the client-side mod would need to do. You'd need to use a Minecraft modding framework (like Forge or Fabric) to actually implement this. ```java // (Conceptual Java code - Requires a Minecraft modding framework) import net.minecraft.client.Minecraft; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; public class WeatherMod { private static final int CUSTOM_PACKET_ID = 0x7F; // Must match server @SubscribeEvent public void onClientPacket(ClientCustomPacketEvent event) { PacketBuffer buffer = event.getPacket().payload(); int packetId = buffer.readByte(); if (packetId == CUSTOM_PACKET_ID) { float temperature = buffer.readFloat(); float humidity = buffer.readFloat(); float windSpeed = buffer.readFloat(); // Display the weather information (e.g., in chat) Minecraft.getMinecraft().player.sendChatMessage( String.format("Weather: Temp=%.2f, Humidity=%.2f, Wind=%.2f", temperature, humidity, windSpeed)); } } } ``` **Key Improvements and Considerations for a Real-World Implementation:** * **Minecraft Protocol Handshake:** Implement the full Minecraft handshake (status request, login, etc.) if you want to act as a "real" Minecraft server. Libraries like `mcstatus` can help with this. * **Asynchronous Handling:** Use threads or asynchronous I/O (e.g., `asyncio`) to handle multiple clients concurrently without blocking. * **Configuration:** Allow the server to be configured (e.g., through a configuration file) for the port, packet ID, and other settings. * **Data Persistence:** Store weather data in a database or file so it persists across server restarts. * **More Realistic Weather:** Implement a more sophisticated weather model that changes over time and is influenced by factors like biome and time of day. * **Client-Side Mod Features:** Add more features to the client-side mod, such as displaying the weather information on the screen, changing the sky color, or adding weather effects (rain, snow, etc.). * **Security:** Implement proper authentication and authorization to prevent unauthorized access to the server. This example provides a starting point. Building a fully functional weather server requires a significant amount of work, especially on the client-side mod. Good luck! **Japanese Translation:** ``` 以下は、Python での簡単な天気 MCP (Minecraft Protocol) サーバーの例です。 これは非常に基本的な例であり、Minecraft プロトコルのすべてを実装しているわけではありません。 天気情報を表示するために、カスタムパケットをクライアントに送信することに焦点を当てています。 **重要な考慮事項:** * **Minecraft プロトコルの複雑さ:** 実際の Minecraft プロトコルは非常に複雑です。 この例では、大幅に簡略化されています。 より堅牢なインタラクションには、適切なライブラリ (`mcstatus` や `nbt` など) が必要になります。 * **クライアント側の Mod:** このサーバーはカスタムパケットを送信します。 Minecraft クライアントには、このカスタムパケットを受信して解釈する方法を知っている Mod がインストールされている*必要*があります。 クライアント側の Mod がないと、クライアントはパケットを無視し、何も起こりません。 * **セキュリティ:** これは基本的な例であり、セキュリティ対策は含まれていません。 適切なセキュリティ対策なしに、これをオープンなインターネットに公開しないでください。 * **エラー処理:** エラー処理は最小限です。 本番サーバーには、より堅牢なエラー処理が必要です。 * **MCP (Minecraft Protocol) バージョン:** Minecraft プロトコルはバージョンによって異なります。 この例は一般的な概念であり、対象とする Minecraft のバージョンに応じて調整が必要になる場合があります。 ```python import socket import struct import time import random # 設定 HOST = '127.0.0.1' # ローカルホストでリッスン PORT = 25565 # ポートを使用 (デフォルトの Minecraft ポートを使用する場合は、注意が必要です) CUSTOM_PACKET_ID = 0x7F # カスタムパケット ID (クライアント側の Mod と一致する必要があります) def create_weather_packet(temperature, humidity, wind_speed): """カスタム天気パケットを作成します。""" # フォーマット: パケット ID (1 バイト), 温度 (float), 湿度 (float), 風速 (float) packet_data = struct.pack('!bfff', CUSTOM_PACKET_ID, temperature, humidity, wind_speed) # パケット長を追加 (VarInt) packet_length = len(packet_data) length_prefix = encode_varint(packet_length) return length_prefix + packet_data def encode_varint(value): """整数を Minecraft VarInt としてエンコードします。""" output = bytearray() while True: byte = value & 0x7F value >>= 7 if value != 0: byte |= 0x80 output.append(byte) if value == 0: break return bytes(output) def handle_client(conn, addr): """単一のクライアント接続を処理します。""" print(f"Connected by {addr}") try: while True: # 天気データをシミュレート temperature = random.uniform(10.0, 35.0) # 摂氏 humidity = random.uniform(30.0, 90.0) # パーセント wind_speed = random.uniform(0.0, 15.0) # m/s # 天気パケットを作成 weather_packet = create_weather_packet(temperature, humidity, wind_speed) # パケットを送信 conn.sendall(weather_packet) print(f"Sent weather data: Temp={temperature:.2f}, Humidity={humidity:.2f}, Wind={wind_speed:.2f}") time.sleep(5) # 5 秒ごとに天気データを送信 except ConnectionResetError: print(f"Client {addr} disconnected.") except Exception as e: print(f"Error handling client {addr}: {e}") finally: conn.close() def main(): """メインサーバー関数。""" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() print(f"Weather MCP Server listening on {HOST}:{PORT}") while True: conn, addr = s.accept() handle_client(conn, addr) if __name__ == "__main__": main() ``` **説明:** 1. **インポート:** 必要なモジュール (`socket`, `struct`, `time`, `random`) をインポートします。 2. **設定:** * `HOST`: リッスンする IP アドレス (この場合はローカルホスト)。 * `PORT`: リッスンするポート。 すでに使用されていないポートを選択してください。 **デフォルトの Minecraft ポート (25565) を使用する場合は、注意が必要です。完全な Minecraft ハンドシェイクを処理する準備ができている場合にのみ使用してください。** * `CUSTOM_PACKET_ID`: カスタムパケットの一意の ID。 これは、クライアント側の Mod で使用される ID と*一致する*必要があります。 ID 0x00-0x1F および 0xFA-0xFF は通常予約されています。 3. **`create_weather_packet(temperature, humidity, wind_speed)`:** * この関数は、クライアントに送信されるカスタムパケットを作成します。 * `struct.pack('!bfff', ...)`: これは、データをバイナリ形式にパックします。 * `!`: ネットワークバイトオーダー (ビッグエンディアン)。 Minecraft にとって重要です。 * `b`: 符号付きバイト (パケット ID 用)。 * `f`: float (温度、湿度、風速用)。 * `encode_varint(packet_length)`: パケット長を Minecraft プロトコルに必要な VarInt としてエンコードします。 4. **`encode_varint(value)`:** * 整数を Minecraft VarInt としてエンコードします。 VarInt は、Minecraft プロトコルで使用される可変長整数エンコーディングです。 5. **`handle_client(conn, addr)`:** * 単一のクライアントとの接続を処理します。 * 天気データをシミュレートし、パケットを作成し、5 秒ごとにクライアントに送信するループに入ります。 * クライアントの切断に対する基本的なエラー処理が含まれています。 6. **`main()`:** * ソケットを作成し、指定されたホストとポートにバインドし、着信接続をリッスンします。 * クライアントが接続すると、`handle_client()` を呼び出して接続を処理します。 **使い方:** 1. **保存:** コードを Python ファイルとして保存します (例: `weather_server.py`)。 2. **実行:** ターミナルからスクリプトを実行します: `python weather_server.py` 3. **クライアント側の Mod を作成:** 次のことを行う Minecraft Mod を*必ず*作成してください。 * 指定された `HOST` と `PORT` でサーバーに接続します。 * `CUSTOM_PACKET_ID` を持つパケットをリッスンします。 * パケットから温度、湿度、風速を解析します。 * ゲーム内で天気情報を表示します (例: 画面上、チャットメッセージなど)。 4. **Mod を使用して Minecraft を実行:** Mod をインストールした状態で Minecraft を起動します。 5. **接続:** Mod がサーバーに接続し、ゲーム内で天気データが表示されるはずです。 **クライアント側の Mod の例 (概念 - 実際の Modding が必要):** これは、クライアント側の Mod が行う必要のあることの*非常に*簡略化された概念的な例です。 これを実際に実装するには、Minecraft Modding フレームワーク (Forge や Fabric など) を使用する必要があります。 ```java // (概念的な Java コード - Minecraft Modding フレームワークが必要) import net.minecraft.client.Minecraft; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; public class WeatherMod { private static final int CUSTOM_PACKET_ID = 0x7F; // サーバーと一致する必要があります @SubscribeEvent public void onClientPacket(ClientCustomPacketEvent event) { PacketBuffer buffer = event.getPacket().payload(); int packetId = buffer.readByte(); if (packetId == CUSTOM_PACKET_ID) { float temperature = buffer.readFloat(); float humidity = buffer.readFloat(); float windSpeed = buffer.readFloat(); // 天気情報を表示 (例: チャットで) Minecraft.getMinecraft().player.sendChatMessage( String.format("Weather: Temp=%.2f, Humidity=%.2f, Wind=%.2f", temperature, humidity, windSpeed)); } } } ``` **実際の実装のための重要な改善点と考慮事項:** * **Minecraft プロトコルハンドシェイク:** 「実際の」Minecraft サーバーとして機能する場合は、完全な Minecraft ハンドシェイク (ステータスリクエスト、ログインなど) を実装します。 `mcstatus` などのライブラリが役立ちます。 * **非同期処理:** スレッドまたは非同期 I/O (`asyncio` など) を使用して、ブロックせずに複数のクライアントを同時に処理します。 * **設定:** ポート、パケット ID、その他の設定について、サーバーを設定ファイルなどを介して設定できるようにします。 * **データの永続性:** 天気データをデータベースまたはファイルに保存して、サーバーの再起動後も永続するようにします。 * **より現実的な天気:** 時間の経過とともに変化し、バイオームや時刻などの要因の影響を受ける、より洗練された天気モデルを実装します。 * **クライアント側の Mod 機能:** 画面に天気情報を表示したり、空の色を変更したり、天候効果 (雨、雪など) を追加したりするなど、クライアント側の Mod にさらに機能を追加します。 * **セキュリティ:** サーバーへの不正アクセスを防ぐために、適切な認証と承認を実装します。 この例は出発点を提供します。 完全に機能する天気サーバーを構築するには、特にクライアント側の Mod でかなりの作業が必要です。 頑張ってください! ``` This translation aims to be accurate and understandable for a Japanese speaker familiar with programming concepts. I've tried to maintain the technical accuracy while making it readable.

SQLGenius - AI-Powered SQL Assistant

SQLGenius - AI-Powered SQL Assistant

SQLGeniusは、Vertex AIのGemini Proを使用して自然言語をSQLクエリに変換する、AI搭載のSQLアシスタントです。MCPとStreamlitで構築されており、リアルタイムの可視化とスキーマ管理を備えた、BigQueryデータ探索のための直感的なインターフェースを提供します。

spotify_mcp_server_claude

spotify_mcp_server_claude

カスタムの MCP フレームワークを使って構築された MCP サーバー

Time-MCP

Time-MCP

「現在の日時を取得するためのMCPサーバー」 (Genzai no nichiji o shutoku suru tame no MCP sābā)

Configurable Puppeteer MCP Server

Configurable Puppeteer MCP Server

Puppeteer を使用してブラウザの自動化機能を提供する Model Context Protocol サーバー。環境変数を通じて設定可能なオプションを備えており、LLM がウェブページとやり取りしたり、スクリーンショットを撮ったり、ブラウザ環境で JavaScript を実行したりすることを可能にします。

Thirdweb Mcp

Thirdweb Mcp