---
title: Installation
description: Add mc-protocol to a Node or Bun project.
---

mc-protocol is not published to npm yet. Install it straight from GitHub.

**bun**

```sh
bun add github:GDLev/mc-protocol
```

**npm**

```sh
npm install github:GDLev/mc-protocol
```

**pnpm**

```sh
pnpm add github:GDLev/mc-protocol
```

The 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 start` runs `examples/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

```ts
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:

```ts
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](/docs/versions).

## Running from a clone

To hack on the library itself:

```sh
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.

> **Info**
>
> Only protocol 776 (Minecraft 26.2) is built in. A client with another protocol can still ping the server list; a login attempt is refused with a `LoginDisconnect` that names the supported versions.
