Discover Awesome MCP Servers
Extend your agent with 26,715 capabilities via MCP servers.
- All26,715
- 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
Jina Free MCP
A Managed Component Provider that enables fetching webpage content using Jina AI's reader service.
ABAP-ADT-API MCP-Server
An MCP server that enables seamless communication between ABAP systems and MCP clients using the ABAP Development Tools (ADT) API. It provides tools for managing ABAP objects, handling transport requests, and performing code analysis directly through MCP-compatible interfaces.
Monitor MCP Server
Basic MCP Server
A minimal template server demonstrating MCP tools, resources, and prompts built with Smithery SDK. Provides starter examples including a hello tool, history resource, and greet prompt.
Test MCP
Máy chủ MCP đơn giản cho mục đích thử nghiệm.
mcp-init
Okay, here's a basic outline and code snippets to get you started with creating a new Minecraft Protocol (MCP) server in TypeScript, with a focus on including common "batteries" (features and libraries) to make development easier. This will be a simplified example, and you'll need to expand upon it for a fully functional server. **Conceptual Outline** 1. **Project Setup:** Initialize a TypeScript project with necessary dependencies. 2. **Networking:** Set up a TCP server to listen for Minecraft client connections. 3. **Protocol Handling:** Implement the Minecraft protocol (MCP) parsing and serialization. This is the most complex part. 4. **Authentication:** Handle player authentication (online or offline mode). 5. **World Management:** Load, generate, and manage the game world. 6. **Entity Management:** Track and update entities (players, mobs, objects). 7. **Game Logic:** Implement game rules, events, and player interactions. 8. **Command Handling:** Parse and execute server commands. 9. **Logging:** Implement logging for debugging and monitoring. **1. Project Setup** ```bash mkdir minecraft-server cd minecraft-server npm init -y npm install typescript ts-node @types/node ws minecraft-protocol --save npm install nodemon --save-dev # For automatic restarts during development tsc --init # Creates a tsconfig.json file ``` **Explanation:** * `mkdir minecraft-server`: Creates a directory for your project. * `cd minecraft-server`: Navigates into the project directory. * `npm init -y`: Initializes a new Node.js project with default settings. * `npm install typescript ts-node @types/node ws minecraft-protocol --save`: Installs the core dependencies: * `typescript`: The TypeScript compiler. * `ts-node`: Allows you to run TypeScript files directly. * `@types/node`: TypeScript type definitions for Node.js. * `ws`: A WebSocket library (useful for some MCP implementations or future extensions). * `minecraft-protocol`: A library that handles the Minecraft protocol encoding and decoding. This is *crucial*. * `npm install nodemon --save-dev`: Installs `nodemon` as a development dependency. It automatically restarts the server when you make changes to your code. * `tsc --init`: Creates a `tsconfig.json` file, which configures the TypeScript compiler. **tsconfig.json (Example)** ```json { "compilerOptions": { "target": "es2020", "module": "commonjs", "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true }, "include": ["src/**/*"], "exclude": ["node_modules"] } ``` **Explanation:** * `target`: Specifies the ECMAScript target version (ES2020 is a good modern choice). * `module`: Specifies the module system (CommonJS is common for Node.js). * `outDir`: The directory where the compiled JavaScript files will be placed. * `rootDir`: The root directory of your TypeScript source files. * `strict`: Enables strict type checking. Highly recommended. * `esModuleInterop`: Enables interoperability between CommonJS and ES modules. * `skipLibCheck`: Skips type checking of declaration files (`.d.ts`). * `forceConsistentCasingInFileNames`: Enforces consistent casing in file names. * `resolveJsonModule`: Allows importing JSON files as modules. * `include`: Specifies the files to include in the compilation. * `exclude`: Specifies the files to exclude from the compilation. **2. Networking and Protocol Handling (src/index.ts)** ```typescript import net from 'net'; import { createServer } from 'minecraft-protocol'; const server = createServer({ 'online-mode': false, // Set to true for online authentication host: '0.0.0.0', // Listen on all interfaces port: 25565, // Default Minecraft port version: '1.19.4', // Specify the Minecraft version maxPlayers: 10 }); server.on('login', (client) => { console.log(`${client.username} connected`); client.on('end', () => { console.log(`${client.username} disconnected`); }); client.on('error', (err) => { console.error(`Client ${client.username} error:`, err); }); // Send initial game data (example) client.write('login', { entityId: 123, isHardcore: false, gameMode: 0, previousGameMode: -1, worldNames: ['minecraft:overworld'], dimensionCodec: { dimension: { type: 'compound', name: 'dimension', value: { ambient_light: { type: 'float', value: 0 }, bed_works: { type: 'byte', value: 1 }, coordinate_scale: { type: 'double', value: 1 }, effects: { type: 'string', value: 'minecraft:overworld' }, fixed_time: { type: 'long', value: 6000 }, has_ceiling: { type: 'byte', value: 0 }, has_raids: { type: 'byte', value: 1 }, has_skylight: { type: 'byte', value: 1 }, infiniburn: { type: 'string', value: 'minecraft:infiniburn_overworld' }, logical_height: { type: 'int', value: 256 }, min_y: { type: 'int', value: -64 }, height: { type: 'int', value: 384 }, monster_spawn_block_light_limit: { type: 'int', value: 0 }, monster_spawn_light_level: { type: 'int', value: 7 }, natural: { type: 'byte', value: 1 }, piglin_safe: { type: 'byte', value: 0 }, respawn_anchor_works: { type: 'byte', value: 0 }, require_skylight: { type: 'byte', value: 0 }, ultrawarm: { type: 'byte', value: 0 } } } }, dimension: 'minecraft:overworld', seed: [0, 0], maxPlayers: 10, isFlat: false, isDebug: false, hasRespawnAnchor: false }); client.write('position', { x: 0, y: 64, z: 0, yaw: 0, pitch: 0, flags: 0, teleportId: 0 }); client.write('chat', { message: JSON.stringify({ translate: 'chat.type.announcement', with: [ 'Server', 'Welcome to the server!' ] }), position: 0, sender: '0' }); }); server.on('listening', () => { console.log(`Server listening on port ${server.socketServer.address().port}`); }); server.on('error', (err) => { console.error('Server error:', err); }); ``` **Explanation:** * `import net from 'net';`: Imports the Node.js `net` module for networking. * `import { createServer } from 'minecraft-protocol';`: Imports the `createServer` function from the `minecraft-protocol` library. * `createServer(...)`: Creates the Minecraft server instance. * `online-mode`: Set to `false` for offline mode (no Mojang authentication). Set to `true` for online authentication (requires a Mojang account). **Important: Offline mode is insecure and should only be used for testing.** * `host`: The IP address to listen on. `'0.0.0.0'` listens on all interfaces. * `port`: The port to listen on (default Minecraft port is 25565). * `version`: The Minecraft version the server supports. **Crucially important to match the client's version.** Check the `minecraft-protocol` documentation for supported versions. * `maxPlayers`: The maximum number of players allowed on the server. * `server.on('login', (client) => { ... });`: This is the core event handler. It's called when a client successfully connects and authenticates. * `client`: An object representing the connected client. It has properties like `username` and methods for sending data. * `client.on('end', ...)`: Handles client disconnection. * `client.on('error', ...)`: Handles client errors. * `client.write('login', ...)`: Sends the initial login data to the client. This includes the entity ID, game mode, world information, and other essential data. **This data *must* be correct for the client to properly join the world.** The example provides a basic dimension codec. * `client.write('position', ...)`: Sends the player's initial position in the world. * `client.write('chat', ...)`: Sends a welcome message to the player. * `server.on('listening', ...)`: Called when the server starts listening for connections. * `server.on('error', ...)`: Handles server-level errors. **3. Running the Server** 1. **Compile:** Run `tsc` in your project directory to compile the TypeScript code to JavaScript. This will create a `dist` directory with the compiled files. 2. **Run:** Run the server using `node dist/index.js`. Alternatively, use `nodemon` for automatic restarts: `nodemon dist/index.js`. **Important Considerations and Next Steps** * **Minecraft Protocol Complexity:** The Minecraft protocol is *very* complex. The `minecraft-protocol` library handles much of the low-level encoding and decoding, but you still need to understand the structure of the packets and the data they contain. Refer to the `minecraft-protocol` documentation and the official Minecraft protocol documentation (if available) for details. * **World Generation:** The example doesn't include any world generation. You'll need to implement a system for creating and loading chunks of the world. Consider using libraries like `prismarine-chunk` and `prismarine-world` for this. * **Entity Management:** You'll need to manage entities (players, mobs, objects) in the world. This involves tracking their positions, properties, and interactions. * **Game Logic:** Implement the game rules, events, and player interactions. * **Security:** If you're running an online server, security is paramount. Implement proper authentication, authorization, and anti-cheat measures. * **Error Handling:** Add robust error handling to catch and log errors gracefully. * **Configuration:** Use a configuration file (e.g., JSON or YAML) to store server settings. * **Logging:** Implement a proper logging system for debugging and monitoring. Consider using a library like `winston` or `pino`. * **Plugins/Modding:** Consider designing your server with a plugin or modding API to allow for extensibility. **Example with `prismarine-chunk` (Illustrative)** This is a very basic example to show how you might start using `prismarine-chunk`. You'll need to install it: `npm install prismarine-chunk`. ```typescript import net from 'net'; import { createServer } from 'minecraft-protocol'; import { Chunk } from 'prismarine-chunk'; import { Vec3 } from 'vec3'; const server = createServer({ /* ... server options ... */ }); server.on('login', (client) => { // ... (existing login code) ... // Create a chunk const chunk = new Chunk({ version: '1.19.4' }); // Match server version // Fill the chunk with blocks (example: grass) for (let x = 0; x < 16; x++) { for (let z = 0; z < 16; z++) { chunk.setBlockType(new Vec3(x, 63, z), 2); // Grass block ID (may vary by version) chunk.setBlockData(new Vec3(x, 63, z), 0); } } // Send the chunk to the client client.write('map_chunk', { x: 0, z: 0, groundUp: true, biomes: new Array(1024).fill(1), // Example biome data heightmaps: { type: 'compound', name: 'heightmaps', value: { MOTION_BLOCKING: { type: 'longArray', value: new Array(36).fill(0) }, WORLD_SURFACE: { type: 'longArray', value: new Array(36).fill(0) } }}, chunkData: chunk.dump(), blockEntities: [] }); // ... (rest of the login code) ... }); ``` **Important Notes about `prismarine-chunk`:** * **Version Compatibility:** Make sure the `version` option in `new Chunk()` matches the Minecraft version your server is using. * **Block IDs:** Block IDs can change between Minecraft versions. You'll need to look up the correct IDs for the version you're using. Libraries like `prismarine-registry` can help with this. * **Chunk Format:** The chunk format is complex. `prismarine-chunk` simplifies it, but you still need to understand the basics of how chunks are structured. * **Biomes and Heightmaps:** The `biomes` and `heightmaps` data are also required for the client to render the chunk correctly. The example provides placeholder data; you'll need to generate realistic data for a proper world. **In summary, building a Minecraft server is a significant undertaking. Start with the basics, understand the protocol, and gradually add features. The `minecraft-protocol` and `prismarine-*` libraries are essential tools for this process.** **Vietnamese Translation:** Okay, đây là một phác thảo cơ bản và các đoạn mã để giúp bạn bắt đầu tạo một máy chủ Minecraft Protocol (MCP) mới bằng TypeScript, tập trung vào việc bao gồm các "pin" (tính năng và thư viện) phổ biến để giúp việc phát triển dễ dàng hơn. Đây sẽ là một ví dụ đơn giản và bạn sẽ cần mở rộng nó để có một máy chủ hoạt động đầy đủ. **Phác thảo khái niệm** 1. **Thiết lập dự án:** Khởi tạo một dự án TypeScript với các phụ thuộc cần thiết. 2. **Mạng:** Thiết lập một máy chủ TCP để lắng nghe các kết nối từ máy khách Minecraft. 3. **Xử lý giao thức:** Triển khai phân tích cú pháp và tuần tự hóa giao thức Minecraft (MCP). Đây là phần phức tạp nhất. 4. **Xác thực:** Xử lý xác thực người chơi (chế độ trực tuyến hoặc ngoại tuyến). 5. **Quản lý thế giới:** Tải, tạo và quản lý thế giới trò chơi. 6. **Quản lý thực thể:** Theo dõi và cập nhật các thực thể (người chơi, mob, đối tượng). 7. **Logic trò chơi:** Triển khai các quy tắc trò chơi, sự kiện và tương tác của người chơi. 8. **Xử lý lệnh:** Phân tích cú pháp và thực thi các lệnh máy chủ. 9. **Ghi nhật ký:** Triển khai ghi nhật ký để gỡ lỗi và giám sát. **1. Thiết lập dự án** ```bash mkdir minecraft-server cd minecraft-server npm init -y npm install typescript ts-node @types/node ws minecraft-protocol --save npm install nodemon --save-dev # Để tự động khởi động lại trong quá trình phát triển tsc --init # Tạo một tệp tsconfig.json ``` **Giải thích:** * `mkdir minecraft-server`: Tạo một thư mục cho dự án của bạn. * `cd minecraft-server`: Điều hướng vào thư mục dự án. * `npm init -y`: Khởi tạo một dự án Node.js mới với các cài đặt mặc định. * `npm install typescript ts-node @types/node ws minecraft-protocol --save`: Cài đặt các phụ thuộc cốt lõi: * `typescript`: Trình biên dịch TypeScript. * `ts-node`: Cho phép bạn chạy trực tiếp các tệp TypeScript. * `@types/node`: Định nghĩa kiểu TypeScript cho Node.js. * `ws`: Một thư viện WebSocket (hữu ích cho một số triển khai MCP hoặc các tiện ích mở rộng trong tương lai). * `minecraft-protocol`: Một thư viện xử lý mã hóa và giải mã giao thức Minecraft. Điều này là *rất quan trọng*. * `npm install nodemon --save-dev`: Cài đặt `nodemon` làm một phụ thuộc phát triển. Nó tự động khởi động lại máy chủ khi bạn thực hiện các thay đổi đối với mã của mình. * `tsc --init`: Tạo một tệp `tsconfig.json`, tệp này định cấu hình trình biên dịch TypeScript. **tsconfig.json (Ví dụ)** ```json { "compilerOptions": { "target": "es2020", "module": "commonjs", "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true }, "include": ["src/**/*"], "exclude": ["node_modules"] } ``` **Giải thích:** * `target`: Chỉ định phiên bản mục tiêu ECMAScript (ES2020 là một lựa chọn hiện đại tốt). * `module`: Chỉ định hệ thống mô-đun (CommonJS là phổ biến cho Node.js). * `outDir`: Thư mục nơi các tệp JavaScript đã biên dịch sẽ được đặt. * `rootDir`: Thư mục gốc của các tệp nguồn TypeScript của bạn. * `strict`: Bật kiểm tra kiểu nghiêm ngặt. Rất khuyến khích. * `esModuleInterop`: Cho phép khả năng tương tác giữa các mô-đun CommonJS và ES. * `skipLibCheck`: Bỏ qua kiểm tra kiểu của các tệp khai báo (`.d.ts`). * `forceConsistentCasingInFileNames`: Buộc cách viết hoa nhất quán trong tên tệp. * `resolveJsonModule`: Cho phép nhập các tệp JSON làm mô-đun. * `include`: Chỉ định các tệp cần đưa vào quá trình biên dịch. * `exclude`: Chỉ định các tệp cần loại trừ khỏi quá trình biên dịch. **2. Mạng và Xử lý giao thức (src/index.ts)** ```typescript import net from 'net'; import { createServer } from 'minecraft-protocol'; const server = createServer({ 'online-mode': false, // Đặt thành true để xác thực trực tuyến host: '0.0.0.0', // Lắng nghe trên tất cả các giao diện port: 25565, // Cổng Minecraft mặc định version: '1.19.4', // Chỉ định phiên bản Minecraft maxPlayers: 10 }); server.on('login', (client) => { console.log(`${client.username} đã kết nối`); client.on('end', () => { console.log(`${client.username} đã ngắt kết nối`); }); client.on('error', (err) => { console.error(`Lỗi máy khách ${client.username}:`, err); }); // Gửi dữ liệu trò chơi ban đầu (ví dụ) client.write('login', { entityId: 123, isHardcore: false, gameMode: 0, previousGameMode: -1, worldNames: ['minecraft:overworld'], dimensionCodec: { dimension: { type: 'compound', name: 'dimension', value: { ambient_light: { type: 'float', value: 0 }, bed_works: { type: 'byte', value: 1 }, coordinate_scale: { type: 'double', value: 1 }, effects: { type: 'string', value: 'minecraft:overworld' }, fixed_time: { type: 'long', value: 6000 }, has_ceiling: { type: 'byte', value: 0 }, has_raids: { type: 'byte', value: 1 }, has_skylight: { type: 'byte', value: 1 }, infiniburn: { type: 'string', value: 'minecraft:infiniburn_overworld' }, logical_height: { type: 'int', value: 256 }, min_y: { type: 'int', value: -64 }, height: { type: 'int', value: 384 }, monster_spawn_block_light_limit: { type: 'int', value: 0 }, monster_spawn_light_level: { type: 'int', value: 7 }, natural: { type: 'byte', value: 1 }, piglin_safe: { type: 'byte', value: 0 }, respawn_anchor_works: { type: 'byte', value: 0 }, require_skylight: { type: 'byte', value: 0 }, ultrawarm: { type: 'byte', value: 0 } } } }, dimension: 'minecraft:overworld', seed: [0, 0], maxPlayers: 10, isFlat: false, isDebug: false, hasRespawnAnchor: false }); client.write('position', { x: 0, y: 64, z: 0, yaw: 0, pitch: 0, flags: 0, teleportId: 0 }); client.write('chat', { message: JSON.stringify({ translate: 'chat.type.announcement', with: [ 'Server', 'Chào mừng đến với máy chủ!' ] }), position: 0, sender: '0' }); }); server.on('listening', () => { console.log(`Máy chủ đang lắng nghe trên cổng ${server.socketServer.address().port}`); }); server.on('error', (err) => { console.error('Lỗi máy chủ:', err); }); ``` **Giải thích:** * `import net from 'net';`: Nhập mô-đun `net` của Node.js để kết nối mạng. * `import { createServer } from 'minecraft-protocol';`: Nhập hàm `createServer` từ thư viện `minecraft-protocol`. * `createServer(...)`: Tạo phiên bản máy chủ Minecraft. * `online-mode`: Đặt thành `false` cho chế độ ngoại tuyến (không xác thực Mojang). Đặt thành `true` để xác thực trực tuyến (yêu cầu tài khoản Mojang). **Quan trọng: Chế độ ngoại tuyến không an toàn và chỉ nên được sử dụng để thử nghiệm.** * `host`: Địa chỉ IP để lắng nghe. `'0.0.0.0'` lắng nghe trên tất cả các giao diện. * `port`: Cổng để lắng nghe (cổng Minecraft mặc định là 25565). * `version`: Phiên bản Minecraft mà máy chủ hỗ trợ. **Cực kỳ quan trọng để khớp với phiên bản của máy khách.** Kiểm tra tài liệu `minecraft-protocol` để biết các phiên bản được hỗ trợ. * `maxPlayers`: Số lượng người chơi tối đa được phép trên máy chủ. * `server.on('login', (client) => { ... });`: Đây là trình xử lý sự kiện cốt lõi. Nó được gọi khi một máy khách kết nối và xác thực thành công. * `client`: Một đối tượng đại diện cho máy khách đã kết nối. Nó có các thuộc tính như `username` và các phương thức để gửi dữ liệu. * `client.on('end', ...)`: Xử lý ngắt kết nối của máy khách. * `client.on('error', ...)`: Xử lý lỗi của máy khách. * `client.write('login', ...)`: Gửi dữ liệu đăng nhập ban đầu cho máy khách. Điều này bao gồm ID thực thể, chế độ trò chơi, thông tin thế giới và các dữ liệu cần thiết khác. **Dữ liệu này *phải* chính xác để máy khách tham gia thế giới một cách chính xác.** Ví dụ cung cấp một codec kích thước cơ bản. * `client.write('position', ...)`: Gửi vị trí ban đầu của người chơi trong thế giới. * `client.write('chat', ...)`: Gửi một tin nhắn chào mừng đến người chơi. * `server.on('listening', ...)`: Được gọi khi máy chủ bắt đầu lắng nghe các kết nối. * `server.on('error', ...)`: Xử lý các lỗi cấp máy chủ. **3. Chạy máy chủ** 1. **Biên dịch:** Chạy `tsc` trong thư mục dự án của bạn để biên dịch mã TypeScript thành JavaScript. Điều này sẽ tạo một thư mục `dist` với các tệp đã biên dịch. 2. **Chạy:** Chạy máy chủ bằng cách sử dụng `node dist/index.js`. Ngoài ra, hãy sử dụng `nodemon` để tự động khởi động lại: `nodemon dist/index.js`. **Các cân nhắc quan trọng và các bước tiếp theo** * **Độ phức tạp của giao thức Minecraft:** Giao thức Minecraft *rất* phức tạp. Thư viện `minecraft-protocol` xử lý phần lớn việc mã hóa và giải mã cấp thấp, nhưng bạn vẫn cần hiểu cấu trúc của các gói và dữ liệu mà chúng chứa. Tham khảo tài liệu `minecraft-protocol` và tài liệu giao thức Minecraft chính thức (nếu có) để biết chi tiết. * **Tạo thế giới:** Ví dụ không bao gồm bất kỳ thế giới nào. Bạn sẽ cần triển khai một hệ thống để tạo và tải các khối của thế giới. Cân nhắc sử dụng các thư viện như `prismarine-chunk` và `prismarine-world` cho việc này. * **Quản lý thực thể:** Bạn sẽ cần quản lý các thực thể (người chơi, mob, đối tượng) trong thế giới. Điều này liên quan đến việc theo dõi vị trí, thuộc tính và tương tác của chúng. * **Logic trò chơi:** Triển khai các quy tắc trò chơi, sự kiện và tương tác của người chơi. * **Bảo mật:** Nếu bạn đang chạy một máy chủ trực tuyến, bảo mật là tối quan trọng. Triển khai xác thực, ủy quyền và các biện pháp chống gian lận thích hợp. * **Xử lý lỗi:** Thêm xử lý lỗi mạnh mẽ để bắt và ghi lại các lỗi một cách duyên dáng. * **Cấu hình:** Sử dụng tệp cấu hình (ví dụ: JSON hoặc YAML) để lưu trữ cài đặt máy chủ. * **Ghi nhật ký:** Triển khai một hệ thống ghi nhật ký thích hợp để gỡ lỗi và giám sát. Cân nhắc sử dụng một thư viện như `winston` hoặc `pino`. * **Plugin/Modding:** Cân nhắc thiết kế máy chủ của bạn với API plugin hoặc modding để cho phép khả năng mở rộng. **Ví dụ với `prismarine-chunk` (Minh họa)** Đây là một ví dụ rất cơ bản để cho thấy cách bạn có thể bắt đầu sử dụng `prismarine-chunk`. Bạn sẽ cần cài đặt nó: `npm install prismarine-chunk`. ```typescript import net from 'net'; import { createServer } from 'minecraft-protocol'; import { Chunk } from 'prismarine-chunk'; import { Vec3 } from 'vec3'; const server = createServer({ /* ... các tùy chọn máy chủ ... */ }); server.on('login', (client) => { // ... (mã đăng nhập hiện có) ... // Tạo một khối const chunk = new Chunk({ version: '1.19.4' }); // Khớp với phiên bản máy chủ // Điền vào khối với các khối (ví dụ: cỏ) for (let x = 0; x < 16; x++) { for (let z = 0; z < 16; z++) { chunk.setBlockType(new Vec3(x, 63, z), 2); // ID khối cỏ (có thể khác nhau tùy theo phiên bản) chunk.setBlockData(new Vec3(x, 63, z), 0); } } // Gửi khối cho máy khách client.write('map_chunk', { x: 0, z: 0, groundUp: true, biomes: new Array(1024).fill(1), // Dữ liệu quần xã ví dụ heightmaps: { type: 'compound', name: 'heightmaps', value: { MOTION_BLOCKING: { type: 'longArray', value: new Array(36).fill(0) }, WORLD_SURFACE: { type: 'longArray', value: new Array(36).fill(0) } }}, chunkData: chunk.dump(), blockEntities: [] }); // ... (phần còn lại của mã đăng nhập) ... }); ``` **Lưu ý quan trọng về `prismarine-chunk`:** * **Khả năng tương thích phiên bản:** Đảm bảo tùy chọn `version` trong `new Chunk()` khớp với phiên bản Minecraft mà máy chủ của bạn đang sử dụng. * **ID khối:** ID khối có thể thay đổi giữa các phiên bản Minecraft. Bạn sẽ cần tra cứu ID chính xác cho phiên bản bạn đang sử dụng. Các thư viện như `prismarine-registry` có thể giúp bạn việc này. * **Định dạng khối:** Định dạng khối rất phức tạp. `prismarine-chunk` đơn giản hóa nó, nhưng bạn vẫn cần hiểu những điều cơ bản về cách các khối được cấu trúc. * **Quần xã và Bản đồ độ cao:** Dữ liệu `biomes` và `heightmaps` cũng được yêu cầu để máy khách hiển thị khối một cách chính xác. Ví dụ cung cấp dữ liệu giữ chỗ; bạn sẽ cần tạo dữ liệu thực tế cho một thế giới thích hợp. **Tóm lại, xây dựng một máy chủ Minecraft là một nỗ lực đáng kể. Bắt đầu với những điều cơ bản, hiểu giao thức và dần dần thêm các tính năng. Các thư viện `minecraft-protocol` và `prismarine-*` là những công cụ cần thiết cho quá trình này.**
GitHub GraphQL API MCP
Enables querying and exploring the GitHub GraphQL API schema and executing optimized GraphQL queries to retrieve precise GitHub data (repositories, issues, PRs, users) with reduced token consumption.
Zerodha Trading Bot MCP
An automated trading bot that interfaces with Zerodha to execute stock trades, manage positions, and access market information through natural language commands.
MCP Ctl
Một trình quản lý gói để quản lý tất cả các máy chủ MCP của bạn trên các nền tảng.
Agoragentic
Agent-to-agent marketplace where AI agents discover, invoke, and pay for services from other agents using USDC on Base L2. 72+ services, free tools, x402 micropayments.
Cloudflare Playwright MCP
A Model Control Protocol server that enables AI assistants to control a browser through tools for web automation tasks like navigation, typing, clicking, and taking screenshots.
MCP MeloTTS Audio Generator
Enables AI assistants to convert text to high-quality speech audio using MeloTTS. Automatically splits long texts into segments, generates WAV files, and merges them using ffmpeg with support for multiple languages and customizable speech parameters.
mcp-server-hcp-terraform
Máy chủ MCP để làm việc với HCP Terraform
Oracle DB Context
Provides contextual Oracle database schema information to AI assistants, enabling them to understand and work with large databases containing thousands of tables. Supports multi-database connections, smart schema caching, table lookups, and relationship mapping.
Get My Notion MCP Server
Provides access to a specific GitHub repository (my-notion) allowing AI assistants to browse files, read content, and track commit information. Enables real-time interaction with repository data through the GitHub API without authentication requirements.
Feifei Proxy MCP
A service that converts existing MCP protocols (stdio/sse) to streamable\_http transmission type, allowing compatibility between different MCP implementations.
Schwab MCP Server
A read-only MCP server that provides access to Charles Schwab account data and market information, including portfolio positions, real-time quotes, options chains, price history, and account balances through AI assistants.
Pearch
Best people search engine that reduces the time spent on talent discovery
Elisym Mcp Server
AI agents that hire other AI agents — and pay in SOL. Decentralized agent marketplace via Nostr + Solana.
selenium-mcp
Máy chủ MCP cho Selenium
mcp-server-bash
Máy chủ MCP tối giản được viết bằng tập lệnh bash.
Alpaca MCP Server
MCP server that exposes Alpaca Market Data & Broker API as tools, enabling access to financial data like stock bars, assets, market days, and news through the Message Control Protocol.
Aareguru MCP Server
Provides Swiss Aare river swimming data including water temperature, flow rates, safety assessments, and forecasts. Enables AI assistants to answer questions about current conditions, compare cities, and provide safety recommendations based on official BAFU thresholds.
ID Generator MCP
Provides AI assistants with capabilities to generate collision-resistant unique identifiers using UUID v4 and CUID2 algorithms.
MCP2Browser
Provides browser automation capabilities through HTTP, allowing AI assistants to navigate web pages and inspect content using Playwright-powered tools for opening URLs and retrieving page information.
Add API key to .env file
Chắc chắn rồi, đây là một hệ thống MCP (Message Passing Concurrency) đơn giản được triển khai bằng Python, bao gồm một máy khách và một vài máy chủ: ```python import socket import threading # Cấu hình HOST = '127.0.0.1' # Địa chỉ IP của máy chủ PORT = 12345 # Cổng để lắng nghe # Hàm xử lý kết nối máy khách trên máy chủ def handle_client(conn, addr): print(f"Đã kết nối bởi {addr}") try: while True: data = conn.recv(1024) # Nhận dữ liệu từ máy khách if not data: break # Nếu không có dữ liệu, kết thúc kết nối message = data.decode('utf-8') print(f"Đã nhận: {message} từ {addr}") response = f"Máy chủ đã nhận: {message}" conn.sendall(response.encode('utf-8')) # Gửi phản hồi lại cho máy khách except Exception as e: print(f"Lỗi trong quá trình xử lý máy khách: {e}") finally: print(f"Đóng kết nối với {addr}") conn.close() # Hàm máy chủ def server(): server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.bind((HOST, PORT)) server_socket.listen() print(f"Máy chủ đang lắng nghe trên {HOST}:{PORT}") while True: conn, addr = server_socket.accept() # Chấp nhận kết nối máy khách client_thread = threading.Thread(target=handle_client, args=(conn, addr)) client_thread.start() # Bắt đầu một luồng mới để xử lý máy khách # Hàm máy khách def client(): client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect((HOST, PORT)) try: while True: message = input("Nhập tin nhắn (hoặc 'exit' để thoát): ") if message.lower() == 'exit': break client_socket.sendall(message.encode('utf-8')) # Gửi tin nhắn đến máy chủ data = client_socket.recv(1024) # Nhận phản hồi từ máy chủ print(f"Đã nhận: {data.decode('utf-8')}") except Exception as e: print(f"Lỗi máy khách: {e}") finally: print("Đóng kết nối máy khách") client_socket.close() if __name__ == "__main__": # Chọn chạy máy chủ hoặc máy khách choice = input("Chạy máy chủ (s) hay máy khách (c)? (s/c): ") if choice.lower() == 's': server() elif choice.lower() == 'c': client() else: print("Lựa chọn không hợp lệ.") ``` **Giải thích:** 1. **Cấu hình:** * `HOST`: Địa chỉ IP của máy chủ (ở đây là localhost). * `PORT`: Cổng mà máy chủ sẽ lắng nghe. 2. **`handle_client(conn, addr)`:** * Hàm này được chạy trong một luồng riêng biệt cho mỗi máy khách kết nối. * `conn`: Đối tượng socket đại diện cho kết nối với máy khách. * `addr`: Địa chỉ của máy khách (IP và cổng). * Hàm này nhận dữ liệu từ máy khách, in nó ra, và gửi một phản hồi lại cho máy khách. * Vòng lặp `while True` cho phép máy chủ liên tục nhận tin nhắn từ máy khách cho đến khi kết nối bị đóng. 3. **`server()`:** * Tạo một socket máy chủ. * Gán socket vào địa chỉ và cổng đã chỉ định. * Lắng nghe các kết nối đến. * Trong một vòng lặp vô hạn, chấp nhận các kết nối máy khách mới. * Cho mỗi máy khách, tạo một luồng mới để xử lý kết nối bằng hàm `handle_client`. 4. **`client()`:** * Tạo một socket máy khách. * Kết nối đến máy chủ. * Cho phép người dùng nhập tin nhắn. * Gửi tin nhắn đến máy chủ. * Nhận phản hồi từ máy chủ và in nó ra. 5. **`if __name__ == "__main__":`:** * Đoạn mã này cho phép bạn chọn chạy chương trình như một máy chủ hoặc một máy khách. **Cách chạy:** 1. **Lưu:** Lưu đoạn mã trên thành một tệp Python, ví dụ: `mcp_example.py`. 2. **Chạy máy chủ:** Mở một cửa sổ terminal và chạy: `python mcp_example.py`. Khi được hỏi, nhập `s` để chạy máy chủ. 3. **Chạy máy khách:** Mở một cửa sổ terminal khác và chạy: `python mcp_example.py`. Khi được hỏi, nhập `c` để chạy máy khách. Bạn có thể chạy nhiều máy khách. 4. **Tương tác:** Trong cửa sổ terminal của máy khách, nhập tin nhắn và nhấn Enter. Bạn sẽ thấy tin nhắn được gửi đến máy chủ và phản hồi được in ra. **Lưu ý:** * Đây là một ví dụ rất đơn giản. Trong một hệ thống MCP thực tế, bạn sẽ cần xử lý nhiều vấn đề phức tạp hơn, chẳng hạn như: * Xử lý lỗi mạnh mẽ hơn. * Sử dụng các giao thức truyền thông phức tạp hơn (ví dụ: JSON, Protocol Buffers). * Quản lý luồng tốt hơn (ví dụ: sử dụng một pool luồng). * Bảo mật. * Bạn có thể chạy máy chủ và máy khách trên cùng một máy (như trong ví dụ này) hoặc trên các máy khác nhau. Nếu bạn chạy chúng trên các máy khác nhau, hãy thay đổi `HOST` thành địa chỉ IP của máy chủ. * Hệ thống này sử dụng threading, cho phép xử lý đồng thời nhiều máy khách. Hy vọng điều này hữu ích! Hãy cho tôi biết nếu bạn có bất kỳ câu hỏi nào khác.
xtai-mcp-data-analysis
An MCP server for data analysis and visualization supporting CSV and Excel files. It enables users to generate statistical summaries and create multi-dimensional charts like heatmaps and bar plots through natural language.
sushimcp
sushimcp
mintlify-mcp
An MCP server that enables users to query any Mintlify-powered documentation site directly from Claude. It leverages Mintlify's AI Assistant API to provide RAG-based answers and code examples for various platforms like Agno, Resend, and Upstash.
MCP Google Workspace
Enables comprehensive management of Google Calendar, Contacts, and Gmail through AI systems. Supports full CRUD operations including creating/updating/deleting events, managing contacts, sending emails, organizing with labels, and batch operations with OAuth2 authentication.