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
MCP Server for Prometheus
鏡 (Kagami)
Hyperliquid MCP Server
MCPサーバーでHyperliquid APIからデータを取得する
Docs Fetch MCP Server
LLMが自律的にウェブコンテンツを取得・探索できるようにし、ページを取得し、指定された深さまでリンクを再帰的にたどります。特にドキュメントからトピックについて学習するのに役立ちます。
python-pip-mcp
Okay, here's a minimal example implementation of an MCP (Minecraft Protocol) server and client in Python, using `pip` for dependency management. This example focuses on the handshake and status request/response, which is the initial part of the protocol. It's designed to be debuggable in VS Code on Windows. **Important Considerations:** * **Simplicity:** This is a *very* basic example. It doesn't implement full Minecraft server functionality. It only handles the initial handshake and status request. * **Minecraft Protocol:** The Minecraft protocol is complex. This example only covers a tiny fraction of it. Refer to the official Minecraft protocol documentation for a complete understanding. * **Error Handling:** Error handling is minimal for clarity. A production-ready implementation would need much more robust error handling. * **Dependencies:** We'll use the `struct` module for packing and unpacking data according to the Minecraft protocol's specifications. * **VS Code Debugging:** The code is structured to allow you to set breakpoints and step through the server and client code in VS Code. **1. Project Setup:** Create a new directory for your project (e.g., `mcp_example`). Inside that directory, create the following files: * `server.py` * `client.py` * `requirements.txt` **2. `requirements.txt`:** This file lists the dependencies for your project. For this example, we don't need any external libraries beyond the Python standard library. You can leave this file empty. **3. `server.py`:** ```python import socket import struct import json def pack_varint(data): output = b'' while True: byte = data & 0x7F data >>= 7 if data != 0: byte |= 0x80 output += struct.pack('B', byte) if data == 0: break return output def pack_string(data): encoded_data = data.encode('utf-8') length = len(encoded_data) return pack_varint(length) + encoded_data def handle_handshake(sock): # Read handshake packet length = 0 shift = 0 while True: byte = sock.recv(1) if not byte: return False # Connection closed prematurely byte_val = byte[0] length |= (byte_val & 0x7F) << shift shift += 7 if not (byte_val & 0x80): break packet_data = sock.recv(length) packet_id = packet_data[0] if packet_id == 0x00: protocol_version, server_address_length = struct.unpack('>bi', packet_data[1:6]) server_address = packet_data[6:6 + server_address_length].decode('utf-8') server_port, next_state = struct.unpack('>hi', packet_data[6 + server_address_length:6 + server_address_length + 6]) print(f"Protocol Version: {protocol_version}") print(f"Server Address: {server_address}") print(f"Server Port: {server_port}") print(f"Next State: {next_state}") return next_state == 1 else: print("Unexpected packet ID in handshake") return False def handle_status_request(sock): # Read status request packet (should be empty) length = 0 shift = 0 while True: byte = sock.recv(1) if not byte: return False # Connection closed prematurely byte_val = byte[0] length |= (byte_val & 0x7F) << shift shift += 7 if not (byte_val & 0x80): break packet_data = sock.recv(length) if len(packet_data) != 1 or packet_data[0] != 0x00: print("Unexpected status request packet") return False # Construct status response status = { "version": { "name": "My Awesome Server", "protocol": 763 # Example protocol version }, "players": { "max": 100, "online": 0, "sample": [] }, "description": { "text": "A simple Minecraft server example." } } status_json = json.dumps(status) status_packet = pack_varint(0x00) + pack_string(status_json) status_packet_length = pack_varint(len(status_packet)) sock.sendall(status_packet_length + status_packet) # Handle ping request length = 0 shift = 0 while True: byte = sock.recv(1) if not byte: return False # Connection closed prematurely byte_val = byte[0] length |= (byte_val & 0x7F) << shift shift += 7 if not (byte_val & 0x80): break packet_data = sock.recv(length) if len(packet_data) < 1: print("Unexpected ping request packet") return False ping_id = struct.unpack('>q', packet_data[1:9])[0] # Send pong response pong_packet = pack_varint(0x01) + struct.pack('>q', ping_id) pong_packet_length = pack_varint(len(pong_packet)) sock.sendall(pong_packet_length + pong_packet) return True def main(): host = '127.0.0.1' port = 25565 server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Allow address reuse server_socket.bind((host, port)) server_socket.listen(1) print(f"Server listening on {host}:{port}") while True: conn, addr = server_socket.accept() print(f"Connection from {addr}") try: if handle_handshake(conn): if handle_status_request(conn): print("Status request handled successfully.") else: print("Failed to handle status request.") else: print("Handshake failed.") except Exception as e: print(f"Error handling connection: {e}") finally: conn.close() print(f"Connection to {addr} closed.") if __name__ == "__main__": main() ``` **4. `client.py`:** ```python import socket import struct import json def pack_varint(data): output = b'' while True: byte = data & 0x7F data >>= 7 if data != 0: byte |= 0x80 output += struct.pack('B', byte) if data == 0: break return output def pack_string(data): encoded_data = data.encode('utf-8') length = len(encoded_data) return pack_varint(length) + encoded_data def read_varint(sock): result = 0 shift = 0 while True: byte = sock.recv(1) if not byte: return None # Connection closed byte_val = byte[0] result |= (byte_val & 0x7F) << shift shift += 7 if not (byte_val & 0x80): break return result def main(): host = '127.0.0.1' port = 25565 client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: client_socket.connect((host, port)) print(f"Connected to {host}:{port}") # Handshake protocol_version = 763 # Example protocol version server_address = host server_port = port next_state = 1 # Status handshake_packet_data = struct.pack('>bi', protocol_version, len(server_address)) + server_address.encode('utf-8') + struct.pack('>hi', server_port, next_state) handshake_packet = pack_varint(0x00) + handshake_packet_data handshake_packet_length = pack_varint(len(handshake_packet)) client_socket.sendall(handshake_packet_length + handshake_packet) # Status Request status_request_packet = pack_varint(0x00) status_request_packet_length = pack_varint(len(status_request_packet)) client_socket.sendall(status_request_packet_length + status_request_packet) # Read Status Response response_length = read_varint(client_socket) if response_length is None: print("Connection closed while reading response length.") return response_packet = client_socket.recv(response_length) packet_id = response_packet[0] if packet_id == 0x00: status_json_length = read_varint(client_socket) status_json_data = client_socket.recv(status_json_length).decode('utf-8') status = json.loads(status_json_data) print("Server Status:") print(json.dumps(status, indent=4)) else: print(f"Unexpected packet ID: {packet_id}") # Send Ping Request ping_id = 12345 # Example ping ID ping_packet = pack_varint(0x01) + struct.pack('>q', ping_id) ping_packet_length = pack_varint(len(ping_packet)) client_socket.sendall(ping_packet_length + ping_packet) # Read Pong Response pong_length = read_varint(client_socket) if pong_length is None: print("Connection closed while reading pong length.") return pong_packet = client_socket.recv(pong_length) pong_packet_id = pong_packet[0] if pong_packet_id == 0x01: pong_id_received = struct.unpack('>q', pong_packet[1:9])[0] print(f"Received Pong with ID: {pong_id_received}") else: print(f"Unexpected pong packet ID: {pong_packet_id}") except Exception as e: print(f"Error: {e}") finally: client_socket.close() print("Connection closed.") if __name__ == "__main__": main() ``` **5. Explanation:** * **`pack_varint(data)`:** This function packs an integer into a Minecraft-style VarInt. VarInts are used to represent variable-length integers in the protocol. Each byte represents 7 bits of the integer, with the most significant bit (MSB) set to 1 if there are more bytes to follow, and 0 for the last byte. * **`pack_string(data)`:** This function packs a string into a VarInt-prefixed UTF-8 encoded string, as required by the Minecraft protocol. * **`read_varint(sock)`:** Reads a VarInt from the socket. * **Server (`server.py`):** * Creates a socket and listens for connections. * `handle_handshake(conn)`: Reads the handshake packet, extracts the protocol version, server address, port, and next state. It returns `True` if the handshake is successful and the next state is 1 (status). * `handle_status_request(conn)`: Reads the status request packet (which should be empty). Constructs a JSON status response and sends it back to the client. * The status response is a JSON object containing information about the server, such as the version, player count, and description. * **Client (`client.py`):** * Creates a socket and connects to the server. * Constructs and sends the handshake packet. * Constructs and sends the status request packet. * Reads the status response from the server, parses the JSON, and prints it. * Sends a ping request and receives a pong response. * **Protocol Flow:** 1. **Handshake:** The client sends a handshake packet to the server, indicating the protocol version it's using and the desired next state (status). 2. **Status Request:** The client sends an empty status request packet. 3. **Status Response:** The server sends a JSON-formatted status response. 4. **Ping Request:** The client sends a ping request with a unique ID. 5. **Pong Response:** The server sends a pong response with the same ID. **6. Running the Example:** 1. **Install Dependencies:** Since we don't have any external dependencies, you don't need to run `pip install -r requirements.txt`. 2. **Run the Server:** Open a terminal or command prompt, navigate to the project directory, and run `python server.py`. 3. **Run the Client:** Open another terminal or command prompt, navigate to the project directory, and run `python client.py`. You should see output in both the server and client terminals, indicating the connection, handshake, status request/response, and ping/pong. **7. Debugging in VS Code:** 1. **Create Launch Configurations:** In VS Code, go to the "Run and Debug" view (Ctrl+Shift+D). Click "Create a launch.json file". Choose "Python". You'll need to create two configurations, one for the server and one for the client. * **Server Launch Configuration (`launch.json`):** ```json { "version": "0.2.0", "configurations": [ { "name": "Python: Server", "type": "python", "request": "launch", "program": "${workspaceFolder}/server.py", "console": "integratedTerminal" }, { "name": "Python: Client", "type": "python", "request": "launch", "program": "${workspaceFolder}/client.py", "console": "integratedTerminal" } ] } ``` 2. **Set Breakpoints:** In both `server.py` and `client.py`, click in the left margin to set breakpoints at the lines of code you want to examine. For example, you might set breakpoints in the `handle_handshake` and `handle_status_request` functions in `server.py`, and in the main loop of `client.py`. 3. **Start Debugging:** In the "Run and Debug" view, select the "Python: Server" configuration and click the green "Start Debugging" button. Then, select the "Python: Client" configuration and click the green "Start Debugging" button. VS Code will start both the server and client, and execution will pause at your breakpoints. 4. **Inspect Variables:** When execution pauses at a breakpoint, you can use the VS Code debugger to inspect the values of variables, step through the code line by line, and examine the call stack. **Key Improvements and Explanations:** * **VarInt Packing/Unpacking:** The `pack_varint` and `read_varint` functions are crucial for handling the variable-length integers used in the Minecraft protocol. These functions correctly encode and decode the VarInt format. * **String Packing:** The `pack_string` function handles packing strings with a VarInt length prefix. * **Error Handling:** Basic error handling is included to catch connection errors and unexpected packet formats. More robust error handling would be needed for a production system. * **Clearer Structure:** The code is organized into functions to improve readability and maintainability. * **Comments:** Comments explain the purpose of each section of the code. * **JSON Status Response:** The server constructs a valid JSON status response that a Minecraft client can understand. * **Ping/Pong:** The client sends a ping request and the server responds with a pong, demonstrating a simple form of keep-alive. * **Byte-Level Operations:** The code uses `struct.pack` and `struct.unpack` to work with binary data at the byte level, which is essential for interacting with the Minecraft protocol. * **Debuggability:** The code is structured to be easily debugged in VS Code, with clear entry points and the ability to set breakpoints. This example provides a solid foundation for building a more complete Minecraft server or client. Remember to consult the official Minecraft protocol documentation for more details on the protocol's specifications. Good luck!
MCP PPTX Server
Starknet MCP Server
Starknetとやり取りするためのツールをLLMに提供するMCPサーバー
mcp-rb-template
MCPサーバーが、開いているEmacsバッファをリソースとして公開します。
Remote MCP Server on Cloudflare
Mac Messages MCP
MCP (Multiple Context Protocol) を使用して macOS のメッセージアプリとやり取りするための Python ブリッジです。 uvx mac-messages-mcp を使用して簡単にインストールできます。
Gmail IMAP MCP Server
Gmail を Claude やその他の AI アシスタントと連携させるための Gmail IMAP MCP サーバー
Code2Flow MCP 服务器
code2flowコマンドラインツールをMCPサービスとしてラップするサーバー。AIアプリケーションが標準化されたプロトコルを通じてコードのコールグラフを生成・アクセスできるようにする。
LYRAIOS
LYRAIは、マルチAIエージェント向けのモデルコンテキストプロトコル(MCP)オペレーティングシステムです。AIアプリケーションが金融ネットワークやブロックチェーンのパブリックチェーンと連携できるようにすることで、その機能を拡張するように設計されています。このサーバーは、ブロックチェーンのパブリックチェーン操作(SOLANA、ETH、BSCなど)を含む、さまざまな高度なAIアシスタントを提供します。
mcp-server-cex-bn
鏡 (Kagami)
Magnet Desktop
MCP (Model Context Protocol) サーバーを探索するための macOS および Windows デスクトップアプリ
mcp-server-on-raspi MCP server
鏡 (Kagami)
Next.js MCP Server
LLM があなたの Next.js アプリをより良く理解できるようにする
Library Docs MCP Server
Langchain、Llama-Index、MCP、OpenAIといった人気ライブラリのリアルタイムドキュメントを取得するMCPサーバー。LLMが知識のカットオフ日を超えて、最新のライブラリ情報にアクセスできるようにする。
GitHub MCP Server
GitHub連携のためのモデルコンテキストプロトコルサーバー
WeCom Bot MCP Server
鏡 (Kagami)
Sample code for Model Context Protocl (MCP) with Server Sent Event (SSE)
Bee Agent & Model Context Protocol with Backstage
承知いたしました。以下に、Backstageインスタンスからデータを取得するために使用する、MCPサーバーとそれを使用するエージェントのサンプルを示します。 **MCPサーバーのサンプル (Python):** ```python from flask import Flask, jsonify import requests app = Flask(__name__) BACKSTAGE_API_URL = "YOUR_BACKSTAGE_API_URL" # Backstage APIのURLに置き換えてください @app.route("/entities") def get_entities(): """ Backstageからエンティティを取得します。 """ try: response = requests.get(f"{BACKSTAGE_API_URL}/entities") response.raise_for_status() # エラーが発生した場合に例外を発生させます entities = response.json() return jsonify(entities) except requests.exceptions.RequestException as e: return jsonify({"error": str(e)}), 500 if __name__ == "__main__": app.run(debug=True, host="0.0.0.0", port=5000) ``` **説明:** * このコードは、Flaskフレームワークを使用してシンプルなWebサーバーを構築します。 * `/entities`というエンドポイントを定義し、Backstage APIからエンティティを取得してJSON形式で返します。 * `BACKSTAGE_API_URL`をBackstageインスタンスのAPI URLに置き換える必要があります。 * エラー処理も含まれています。 **MCPエージェントのサンプル (Python):** ```python import requests import time import json MCP_SERVER_URL = "http://localhost:5000" # MCPサーバーのURLに置き換えてください OUTPUT_FILE = "backstage_data.json" def fetch_data(): """ MCPサーバーからデータを取得します。 """ try: response = requests.get(f"{MCP_SERVER_URL}/entities") response.raise_for_status() data = response.json() return data except requests.exceptions.RequestException as e: print(f"エラー: {e}") return None def save_data(data): """ 取得したデータをファイルに保存します。 """ if data: with open(OUTPUT_FILE, "w") as f: json.dump(data, f, indent=4) print(f"データは {OUTPUT_FILE} に保存されました。") if __name__ == "__main__": while True: data = fetch_data() save_data(data) time.sleep(60) # 60秒ごとにデータを取得します ``` **説明:** * このコードは、MCPサーバーから`/entities`エンドポイントを定期的に呼び出し、データを取得します。 * 取得したデータをJSON形式でファイルに保存します。 * `MCP_SERVER_URL`をMCPサーバーのURLに置き換える必要があります。 * `OUTPUT_FILE`は、データを保存するファイル名です。 * `time.sleep(60)`は、60秒ごとにデータを取得するように設定しています。必要に応じて変更してください。 **使い方:** 1. **Backstage API URLの設定:** `BACKSTAGE_API_URL`をBackstageインスタンスのAPI URLに置き換えます。通常、これは`http://<backstage_host>:<backstage_port>/api/catalog/entities`のような形式になります。 2. **MCPサーバーの起動:** 上記のMCPサーバーのコードを保存し、Pythonで実行します。 3. **MCPエージェントの起動:** 上記のMCPエージェントのコードを保存し、Pythonで実行します。 **注意点:** * **認証:** Backstage APIが認証を必要とする場合、MCPサーバーのコードに認証情報を追加する必要があります。 * **エラー処理:** 上記のコードは基本的なエラー処理のみを提供します。より堅牢なシステムでは、より詳細なエラー処理が必要になる場合があります。 * **データ形式:** Backstage APIから返されるデータの形式は、Backstageの設定によって異なる場合があります。必要に応じて、MCPサーバーとエージェントのコードを調整してください。 * **セキュリティ:** MCPサーバーとエージェント間の通信は、セキュリティで保護されていることを確認してください。HTTPSを使用することを推奨します。 * **スケーラビリティ:** 上記のコードはシンプルな例です。より大規模なシステムでは、よりスケーラブルなアーキテクチャが必要になる場合があります。 このサンプルコードは、Backstageからデータを取得するための基本的なフレームワークを提供します。必要に応じて、要件に合わせてカスタマイズしてください。
mermaid-preview-mcp
Mermaid記法のエラー処理に対応した、MermaidダイアグラムをプレビューするためのMCPサーバー。GitHubリポジトリの可視化もサポート。
Linear MCP Server
鏡 (Kagami)
Debug MCP Server in VSCode
Okay, here's a basic example of a Minecraft Forge mod (MCP server is a bit of a misnomer, it's more about the development environment) that you can set up for debugging in VS Code. I'll break it down into steps and provide the code. **1. Prerequisites:** * **Java Development Kit (JDK):** You need a JDK (Java Development Kit), preferably version 8 or 17, depending on the Minecraft version you're targeting. Download from Oracle or AdoptOpenJDK/Eclipse Temurin. Make sure `JAVA_HOME` environment variable is set correctly. * **Minecraft Forge MDK (Mod Development Kit):** Download the MDK for the Minecraft version you want to mod from the official Minecraft Forge website: [https://files.minecraftforge.net/](https://files.minecraftforge.net/) Choose the "MDK" download. * **VS Code:** Download and install Visual Studio Code: [https://code.visualstudio.com/](https://code.visualstudio.com/) * **VS Code Extensions:** Install these extensions in VS Code: * **Java Extension Pack:** (by Microsoft) This provides essential Java support. * **Gradle Language Support:** (by Groovy Language Support) (Optional, but helpful for Gradle build scripts) **2. Setting up the Project:** 1. **Extract the MDK:** Extract the downloaded Forge MDK ZIP file to a directory of your choice (e.g., `C:\MinecraftMods\MyFirstMod`). 2. **Open the Project in VS Code:** Open the extracted directory in VS Code (File -> Open Folder...). 3. **Generate VS Code Launch Configuration:** * In VS Code, open the "Run and Debug" view (Ctrl+Shift+D or Cmd+Shift+D). * Click "create a launch.json file". * Choose "Java". * VS Code will likely create a `launch.json` file in a `.vscode` directory. If it doesn't, you'll need to create the `.vscode` directory and the `launch.json` file manually. 4. **Modify `build.gradle`:** Open the `build.gradle` file in the root of your project. You'll need to modify a few things: * **`group` and `archivesBaseName`:** Change these to your mod's information. `group` is like a package name, and `archivesBaseName` is the name of the resulting JAR file. ```gradle group = 'com.example.myfirstmod' // Replace with your mod's group version = '1.0' // Replace with your mod's version archivesBaseName = 'myfirstmod' // Replace with your mod's name ``` * **`minecraft` block:** Make sure the `version` matches the Minecraft version you're targeting. Also, set `mappings` to the correct channel and version. You can find the latest mappings version on the Forge website or in the `build.gradle` of a newly downloaded MDK. ```gradle minecraft { version = "1.18.2" // Replace with your Minecraft version mappings = "official:1.18.2" // Replace with your mappings version // ... other settings } ``` * **`dependencies` block:** Add any dependencies your mod needs. For a simple mod, you might not need any. * **`jar` task:** Add the following to ensure the mod ID is included in the `META-INF/mods.toml` file: ```gradle jar { manifest { attributes([ 'Specification-Title' : 'MyFirstMod', // Replace 'Specification-Vendor' : 'Example Corp', // Replace 'Specification-Version' : '1', // Replace 'Implementation-Title' : project.name, 'Implementation-Version' : project.version, 'Implementation-Vendor' : 'Example Corp', // Replace 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } ``` 5. **Run Gradle Tasks:** * Open the Gradle view in VS Code (View -> Open View... -> Gradle). * Under your project, find the "forge" category. * Run the `genIntellijRuns` task (double-click it). This generates the necessary run configurations for debugging. (Even though it says "IntelliJ", it also works for VS Code). * Run the `build` task to build your mod. **3. Create the Mod Code:** 1. **Create a Package:** In the `src/main/java` directory, create a package structure that matches your `group` in `build.gradle` (e.g., `com.example.myfirstmod`). 2. **Create a Mod Class:** Inside your package, create a Java class that will be your main mod class (e.g., `MyFirstMod.java`). ```java package com.example.myfirstmod; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // The value here should match an entry in the META-INF/mods.toml file @Mod("myfirstmod") // Replace with your mod ID public class MyFirstMod { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); public MyFirstMod() { // Register the setup method for modloading Mod.EventBusSubscriber.bus().addListener(this::setup); // Register the enqueueIMC method for modloading Mod.EventBusSubscriber.bus().addListener(this::enqueueIMC); // Register the processIMC method for modloading Mod.EventBusSubscriber.bus().addListener(this::processIMC); // Register the doClientStuff method for modloading Mod.EventBusSubscriber.bus().addListener(this::doClientStuff); // Some common code LOGGER.info("HELLO FROM MY FIRST MOD!"); } private void setup(final FMLCommonSetupEvent event) { // Some common setup code LOGGER.info("HELLO FROM COMMON SETUP"); } private void doClientStuff(final FMLClientSetupEvent event) { // Do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); } private void enqueueIMC(final net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod //InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final net.minecraftforge.fml.event.lifecycle.InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods //LOGGER.info("Got IMC {}", event.getIMCStream(). // map(m->m.messageSupplier().get()). // collect(Collectors.toList())); } } ``` 3. **Create `META-INF/mods.toml`:** Create a `mods.toml` file in the `src/main/resources/META-INF` directory. This file tells Forge about your mod. ```toml modLoader = "javafml" loaderVersion = "[40,)" # This is a safe range, but you can specify a lower bound license = "MIT" issueTrackerURL = "https://github.com/YOUR_GITHUB_USERNAME/YOUR_MOD_REPO/issues" # Replace [[mods]] modId = "myfirstmod" # Replace with your mod ID version = "${file.jarVersion}" displayName = "My First Mod" # Replace with your mod name description = ''' This is my first Minecraft mod! ''' authors = "Your Name" # Replace logoFile = "examplemod.png" # Optional credits = "Thanks to Forge and the Minecraft community!" # Replace displayURL = "https://example.com" # Replace [[dependencies.myfirstmod]] # Corrected section name modId = "forge" mandatory = true versionRange = "[40,)" # Match your loaderVersion ordering = "NONE" side = "BOTH" [[dependencies.myfirstmod]] # Corrected section name modId = "minecraft" mandatory = true versionRange = "[1.18.2,1.19)" # Match your Minecraft version ordering = "NONE" side = "BOTH" ``` **4. Debugging in VS Code:** 1. **Set Breakpoints:** In your `MyFirstMod.java` file, click in the gutter (the area to the left of the line numbers) to set breakpoints where you want the debugger to pause. 2. **Run the Debug Configuration:** In the "Run and Debug" view, you should see two configurations: "Minecraft Client" and "Minecraft Server". Choose "Minecraft Client" to debug the client-side of your mod. Click the green "Start Debugging" button (or press F5). 3. **Minecraft Will Launch:** Minecraft will launch in a special debugging mode. It might take a little longer to start. 4. **Trigger Your Breakpoints:** Once Minecraft is running, do something that will trigger the code where you set your breakpoints (e.g., load a world). 5. **VS Code Debugger:** When a breakpoint is hit, VS Code will pause execution, and you can inspect variables, step through code, and evaluate expressions. **Important Notes and Troubleshooting:** * **Mod ID:** The `modId` in `mods.toml` *must* match the `@Mod` annotation in your main mod class. * **Versions:** Make sure all your versions (Minecraft, Forge, mappings) are consistent. * **Gradle Sync:** If you make changes to `build.gradle`, you might need to refresh the Gradle view in VS Code or run the `gradlew build` command in the terminal to apply the changes. * **Errors:** Read the console output in VS Code and the Minecraft game output carefully for error messages. * **`runConfigurations`:** The `genIntellijRuns` task generates run configurations that are compatible with VS Code's debugger. * **`launch.json`:** The `launch.json` file contains the configuration for the debugger. You can customize it if needed, but the default generated by `genIntellijRuns` should be sufficient. Here's an example of a `launch.json` that might be generated: ```json { "configurations": [ { "type": "java", "name": "Minecraft Client", "request": "launch", "cwd": "${workspaceFolder}", "console": "externalTerminal", "stopOnEntry": false, "mainClass": "net.minecraftforge.userdev.LaunchTesting", "args": [ "-mixin.config=myfirstmod.mixins.json", "--tweakClass", "cpw.mods.modlauncher.Launcher" ], "vmArgs": [ "-Dminecraft.client.jar=${env:USERPROFILE}/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.18.2-40.2.1/minecraft_client.jar", "-Dminecraft.launcher.brand=minecraft-forge", "-Dminecraft.launcher.version=1.18.2-forge-40.2.1", "-Dlog4j.configurationFile=./src/main/resources/log4j2.xml" ], "env": { "MOD_CLASSES": "file:${workspaceFolder}/build/classes/java/main/;file:${workspaceFolder}/build/resources/main/" } }, { "type": "java", "name": "Minecraft Server", "request": "launch", "cwd": "${workspaceFolder}", "console": "externalTerminal", "stopOnEntry": false, "mainClass": "net.minecraftforge.userdev.LaunchTesting", "args": [ "--tweakClass", "cpw.mods.modlauncher.Launcher" ], "vmArgs": [ "-Dlog4j.configurationFile=./src/main/resources/log4j2.xml" ], "env": { "MOD_CLASSES": "file:${workspaceFolder}/build/classes/java/main/;file:${workspaceFolder}/build/resources/main/" } } ] } ``` This setup provides a basic foundation for mod development and debugging in VS Code. As you create more complex mods, you'll need to learn more about Forge's API and Gradle build system. Good luck! **Translation to Japanese:** 以下は、VS Code でデバッグできるように設定できる Minecraft Forge Mod (MCP サーバーというよりは、開発環境に関するものです) の基本的な例です。手順に分けてコードを提供します。 **1. 前提条件:** * **Java Development Kit (JDK):** JDK (Java Development Kit) が必要です。ターゲットとする Minecraft のバージョンに応じて、バージョン 8 または 17 が推奨されます。Oracle または AdoptOpenJDK/Eclipse Temurin からダウンロードしてください。`JAVA_HOME` 環境変数が正しく設定されていることを確認してください。 * **Minecraft Forge MDK (Mod Development Kit):** Mod を作成したい Minecraft のバージョンの MDK を、Minecraft Forge の公式ウェブサイトからダウンロードしてください: [https://files.minecraftforge.net/](https://files.minecraftforge.net/) "MDK" ダウンロードを選択してください。 * **VS Code:** Visual Studio Code をダウンロードしてインストールしてください: [https://code.visualstudio.com/](https://code.visualstudio.com/) * **VS Code 拡張機能:** VS Code に以下の拡張機能をインストールしてください: * **Java Extension Pack:** (Microsoft 製) 必須の Java サポートを提供します。 * **Gradle Language Support:** (Groovy Language Support 製) (オプションですが、Gradle ビルドスクリプトに役立ちます) **2. プロジェクトのセットアップ:** 1. **MDK の展開:** ダウンロードした Forge MDK ZIP ファイルを任意のディレクトリに展開します (例: `C:\MinecraftMods\MyFirstMod`)。 2. **VS Code でプロジェクトを開く:** 展開したディレクトリを VS Code で開きます (ファイル -> フォルダーを開く...)。 3. **VS Code 起動構成の生成:** * VS Code で、"実行とデバッグ" ビューを開きます (Ctrl+Shift+D または Cmd+Shift+D)。 * "launch.json ファイルを作成します" をクリックします。 * "Java" を選択します。 * VS Code は `.vscode` ディレクトリに `launch.json` ファイルを作成します。作成されない場合は、`.vscode` ディレクトリと `launch.json` ファイルを手動で作成する必要があります。 4. **`build.gradle` の修正:** プロジェクトのルートにある `build.gradle` ファイルを開きます。いくつかの点を修正する必要があります: * **`group` と `archivesBaseName`:** これらを Mod の情報に変更します。`group` はパッケージ名のようなもので、`archivesBaseName` は生成される JAR ファイルの名前です。 ```gradle group = 'com.example.myfirstmod' // Mod のグループに置き換えてください version = '1.0' // Mod のバージョンに置き換えてください archivesBaseName = 'myfirstmod' // Mod の名前に置き換えてください ``` * **`minecraft` ブロック:** `version` がターゲットとする Minecraft のバージョンと一致することを確認してください。また、`mappings` を正しいチャンネルとバージョンに設定します。最新のマッピングバージョンは、Forge のウェブサイトまたは新しくダウンロードした MDK の `build.gradle` で確認できます。 ```gradle minecraft { version = "1.18.2" // Minecraft のバージョンに置き換えてください mappings = "official:1.18.2" // マッピングのバージョンに置き換えてください // ... その他の設定 } ``` * **`dependencies` ブロック:** Mod に必要な依存関係を追加します。単純な Mod の場合は、何も必要ないかもしれません。 * **`jar` タスク:** Mod ID が `META-INF/mods.toml` ファイルに含まれるように、以下を追加します: ```gradle jar { manifest { attributes([ 'Specification-Title' : 'MyFirstMod', // 置き換えてください 'Specification-Vendor' : 'Example Corp', // 置き換えてください 'Specification-Version' : '1', // 置き換えてください 'Implementation-Title' : project.name, 'Implementation-Version' : project.version, 'Implementation-Vendor' : 'Example Corp', // 置き換えてください 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } ``` 5. **Gradle タスクの実行:** * VS Code で Gradle ビューを開きます (表示 -> ビューを開く... -> Gradle)。 * プロジェクトの下にある "forge" カテゴリを見つけます。 * `genIntellijRuns` タスクを実行します (ダブルクリックします)。これにより、デバッグに必要な実行構成が生成されます。(「IntelliJ」と表示されていますが、VS Code でも動作します)。 * `build` タスクを実行して、Mod をビルドします。 **3. Mod コードの作成:** 1. **パッケージの作成:** `src/main/java` ディレクトリに、`build.gradle` の `group` に一致するパッケージ構造を作成します (例: `com.example.myfirstmod`)。 2. **Mod クラスの作成:** パッケージ内に、メインの Mod クラスとなる Java クラスを作成します (例: `MyFirstMod.java`)。 ```java package com.example.myfirstmod; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // ここでの値は、META-INF/mods.toml ファイルのエントリと一致する必要があります @Mod("myfirstmod") // Mod ID に置き換えてください public class MyFirstMod { // log4j ロガーを直接参照します。 private static final Logger LOGGER = LogManager.getLogger(); public MyFirstMod() { // modloading のセットアップメソッドを登録します Mod.EventBusSubscriber.bus().addListener(this::setup); // modloading の enqueueIMC メソッドを登録します Mod.EventBusSubscriber.bus().addListener(this::enqueueIMC); // modloading の processIMC メソッドを登録します Mod.EventBusSubscriber.bus().addListener(this::processIMC); // doClientStuff メソッドを登録します Mod.EventBusSubscriber.bus().addListener(this::doClientStuff); // いくつかの共通コード LOGGER.info("HELLO FROM MY FIRST MOD!"); } private void setup(final FMLCommonSetupEvent event) { // いくつかの共通セットアップコード LOGGER.info("HELLO FROM COMMON SETUP"); } private void doClientStuff(final FMLClientSetupEvent event) { // クライアントでのみ実行できる処理 LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); } private void enqueueIMC(final net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent event) { // 他の Mod に IMC をディスパッチするサンプルコード //InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final net.minecraftforge.fml.event.lifecycle.InterModProcessEvent event) { // 他の Mod からの InterModComms を受信して処理するサンプルコード //LOGGER.info("Got IMC {}", event.getIMCStream(). // map(m->m.messageSupplier().get()). // collect(Collectors.toList())); } } ``` 3. **`META-INF/mods.toml` の作成:** `src/main/resources/META-INF` ディレクトリに `mods.toml` ファイルを作成します。このファイルは、Forge に Mod について通知します。 ```toml modLoader = "javafml" loaderVersion = "[40,)" # これは安全な範囲ですが、下限を指定できます license = "MIT" issueTrackerURL = "https://github.com/YOUR_GITHUB_USERNAME/YOUR_MOD_REPO/issues" # 置き換えてください [[mods]] modId = "myfirstmod" # Mod ID に置き換えてください version = "${file.jarVersion}" displayName = "My First Mod" # Mod 名に置き換えてください description = ''' これは私の最初の Minecraft Mod です! ''' authors = "あなたの名前" # 置き換えてください logoFile = "examplemod.png" # オプション credits = "Forge と Minecraft コミュニティに感謝します!" # 置き換えてください displayURL = "https://example.com" # 置き換えてください [[dependencies.myfirstmod]] # 修正されたセクション名 modId = "forge" mandatory = true versionRange = "[40,)" # loaderVersion と一致させてください ordering = "NONE" side = "BOTH" [[dependencies.myfirstmod]] # 修正されたセクション名 modId = "minecraft" mandatory = true versionRange = "[1.18.2,1.19)" # Minecraft のバージョンと一致させてください ordering = "NONE" side = "BOTH" ``` **4. VS Code でのデバッグ:** 1. **ブレークポイントの設定:** `MyFirstMod.java` ファイルで、ガター (行番号の左側の領域) をクリックして、デバッガーを一時停止する場所にブレークポイントを設定します。 2. **デバッグ構成の実行:** "実行とデバッグ" ビューに、"Minecraft Client" と "Minecraft Server" の 2 つの構成が表示されます。"Minecraft Client" を選択して、Mod のクライアント側をデバッグします。緑色の "デバッグの開始" ボタンをクリックします (または F5 キーを押します)。 3. **Minecraft が起動します:** Minecraft が特別なデバッグモードで起動します。起動に少し時間がかかる場合があります。 4. **ブレークポイントのトリガー:** Minecraft が実行されたら、ブレークポイントを設定したコードをトリガーする操作を行います (例: ワールドをロードします)。 5. **VS Code デバッガー:** ブレークポイントに到達すると、VS Code は実行を一時停止し、変数の検査、コードのステップ実行、式の評価を行うことができます。 **重要な注意点とトラブルシューティング:** * **Mod ID:** `mods.toml` の `modId` は、メインの Mod クラスの `@Mod` アノテーションと*一致する*必要があります。 * **バージョン:** すべてのバージョン (Minecraft、Forge、マッピング) が一貫していることを確認してください。 * **Gradle の同期:** `build.gradle` を変更した場合は、VS Code で Gradle ビューを更新するか、ターミナルで `gradlew build` コマンドを実行して、変更を適用する必要がある場合があります。 * **エラー:** VS Code のコンソール出力と Minecraft のゲーム出力を注意深く読んで、エラーメッセージを確認してください。 * **`runConfigurations`:** `genIntellijRuns` タスクは、VS Code のデバッガーと互換性のある実行構成を生成します。 * **`launch.json`:** `launch.json` ファイルには、デバッガーの構成が含まれています。必要に応じてカスタマイズできますが、`genIntellijRuns` によって生成されるデフォルトで十分です。以下は、生成される可能性のある `launch.json` の例です。 ```json { "configurations": [ { "type": "java", "name": "Minecraft Client", "request": "launch", "cwd": "${workspaceFolder}", "console": "externalTerminal", "stopOnEntry": false, "mainClass": "net.minecraftforge.userdev.LaunchTesting", "args": [ "-mixin.config=myfirstmod.mixins.json", "--tweakClass", "cpw.mods.modlauncher.Launcher" ], "vmArgs": [ "-Dminecraft.client.jar=${env:USERPROFILE}/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.18.2-40.2.1/minecraft_client.jar", "-Dminecraft.launcher.brand=minecraft-forge", "-Dminecraft.launcher.version=1.18.2-forge-40.2.1", "-Dlog4j.configurationFile=./src/main/resources/log4j2.xml" ], "env": { "MOD_CLASSES": "file:${workspaceFolder}/build/classes/java/main/;file:${workspaceFolder}/build/resources/main/" } }, { "type": "java", "name": "Minecraft Server", "request": "launch", "cwd": "${workspaceFolder}", "console": "externalTerminal", "stopOnEntry": false, "mainClass": "net.minecraftforge.userdev.LaunchTesting", "args": [ "--tweakClass", "cpw.mods.modlauncher.Launcher" ], "vmArgs": [ "-Dlog4j.configurationFile=./src/main/resources/log4j2.xml" ], "env": { "MOD_CLASSES": "file:${workspaceFolder}/build/classes/java/main/;file:${workspaceFolder}/build/resources/main/" } } ] } ``` このセットアップは、VS Code での Mod 開発とデバッグの基本的な基盤を提供します。より複雑な Mod を作成するにつれて、Forge の API と Gradle ビルドシステムについてさらに学ぶ必要があります。頑張ってください!
note.com MCP Server
note.com API を利用した Model Context Protocol (MCP) サーバー
Okta MCP Server
MCP Server Search
MCPサーバーが検索エンジンを使って、インターネット上の関連情報の場所を取得する。
Toolhouse MCP Server
鏡 (Kagami)
Market Fiyatı MCP Server
Mcp Servers Pouch