Skip to main content
Glama

MCP Minecraft Remote

by nacal
server.ts1.12 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import * as mineflayer from 'mineflayer' import { BotState, ConnectionInfo } from './types.js' // Object to maintain bot state (global state) export const botState: BotState = { bot: null, isConnected: false, connectionInfo: { host: '', port: 25565, username: '', version: '', }, currentContainer: null, } // Create server instance export const server = new McpServer({ name: 'MinecraftRemote', version: '0.1.0', }) // Function to initialize the bot export function createBot(options: mineflayer.BotOptions): mineflayer.Bot { const bot = mineflayer.createBot(options) return bot } // Function to update bot state export function updateConnectionInfo(info: Partial<ConnectionInfo>): void { botState.connectionInfo = { ...botState.connectionInfo, ...info, } } // Function to update bot connection state export function updateConnectionState( connected: boolean, bot: mineflayer.Bot | null = null ): void { botState.isConnected = connected if (bot !== undefined) { botState.bot = bot } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nacal/mcp-minecraft-remote'

If you have feedback or need assistance with the MCP directory API, please join our Discord server