Installation
Add mc-protocol to a Node or Bun project.
mc-protocol is not published to npm yet. Install it straight from GitHub.
bun add github:GDLev/mc-protocolnpm install github:GDLev/mc-protocolpnpm add github:GDLev/mc-protocolThe package ships TypeScript source, not compiled JavaScript. Its entry point is src/index.ts, so your runtime needs to execute .ts files directly:
- Bun runs it as is. The repo itself uses Bun:
bun startrunsexamples/flat-world.ts. - Node 22.18+, 23.6+, or 24+ runs it with type stripping enabled by default (
node examples/flat-world.ts). - tsx or ts-node work on older Node versions.
Import
import { Server, Client, Proxy, helpers } from "mc-protocol";
import type { ServerOptions, ClientOptions, ClientSession } from "mc-protocol";
The root export tracks the newest built-in version. To pin a version, import the same names from its subpath:
import { Server, Client, Proxy, helpers } from "mc-protocol/26.2"; // or "mc-protocol/776"
Server, Client, and Proxy from a subpath default to that version and helpers is bound to its data. Everything else is identical. See Versions.
Running from a clone
To hack on the library itself:
git clone https://github.com/GDLev/mc-protocol
cd mc-protocol
bun install
bun start # runs examples/flat-world.ts on :25565
bun test
bun run typecheck
Point a Minecraft 26.2 client at localhost and you should land on seeded noise terrain.