Skip to content
mc-protocol
Esc
↑↓navigate↵open⌘Jpreview

Your code. Their Minecraft client.

Build custom servers, connect bots, or inspect traffic with a proxy. Send named packets and handle events in TypeScript. mc-protocol takes care of the bytes for Minecraft Java 26.2.

Build your first serverView sourcebun add github:GDLev/mc-protocol
  • 257 packet readers and writers. No runtime dependencies.
  • Item names, custom stacks, and lit chunks without hand-built buffers.
  • Offline login and keep-alive automation. Game logic stays yours.
server.tsJava 26.2 · protocol 776
import { Server } from "mc-protocol";

const server = new Server({
  port: 25565,
  autoInit: true,
  autoKeepAlive: true,
  compressionThreshold: 256,
});

server.on("Status/StatusRequest", (client) => {
  client.sendPacket("StatusResponse", {
    jsonResponse: {
      version: { name: "26.2", protocol: 776 },
      players: { max: 20, online: server.clients.size },
      description: { text: "My server" },
    },
  }).catch(console.error);
});

server.on("Status/PingRequest", (client, data) => {
  client.sendPacket("PongResponse", {
    timestamp: data.timestamp,
  }).catch(console.error);
});

server.on("playerJoin", (client, session) => {
  console.log(`${session.username} joined`);
});

Guide

Put a player on solid ground. Then build a bot or a packet proxy.

Packets

Find the packet, its direction, and the fields to send.

Types

Know what to pass: numbers, text, positions, and item stacks.