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.
- 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.
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`);
});import { Client } from "mc-protocol";
const client = new Client({ host: "localhost", port: 25565 });
client.on("Socket:Ready", async () => {
await client.sendPacket("Intension", {
protocolVersion: 776,
serverHost: "localhost",
serverPort: 25565,
nextState: 2,
});
await client.sendPacket("Hello", {
username: "bot",
playerUUID: "00000000000000000000000000000000",
});
});
client.on("Login/LoginFinished", () => {
client.sendPacket("LoginAcknowledged");
});
client.on("Config/SelectKnownPacks", ({ knownPacks }) => {
client.sendPacket("SelectKnownPacks", { knownPacks });
});
client.on("Config/FinishConfiguration", () => {
client.sendPacket("FinishConfiguration");
});
client.on("playerJoin", (s) => console.log(`in as ${s.username}`));import { Proxy } from "mc-protocol";
const proxy = new Proxy({
listen: { host: "0.0.0.0", port: 25566 },
upstream: { host: "play.example.net", port: 25565 },
});
proxy.Client.on("ChatCommand", async (player, data, next) => {
console.log(`${player.session.username} ran /${data.command}`);
await next(data);
});
proxy.Server.on("SetPlayerInventory", (_server, data, next) => {
if (shouldHideInventory(data)) return next(null);
return next(data);
});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.