# maxbittker/rs-sdk architecture

> Architecture diagram of the GitHub repository maxbittker/rs-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maxbittker/rs-sdk
- Repository: https://github.com/maxbittker/rs-sdk

## Overview

RS-SDK combines a TypeScript bot-control SDK and MCP agent interface with a browser or headless game client and a RuneScape-style server emulator. The main workflow is an agent executing bot code: the MCP manager connects the SDK, the SDK sends actions through the gateway and client, and the emulator processes game traffic and updates the world. The README documents this topology; sampled source confirms the manager, SDK, headless client, engine startup, and market-search handler. Some gateway and bot-bridge implementations are not present in the supplied tree, so their internal wiring is not expanded.

Main entry points: [`sdk/index.ts`](https://github.com/maxbittker/rs-sdk/blob/main/sdk/index.ts) (Bot SDK), [`mcp/server.ts`](https://github.com/maxbittker/rs-sdk/blob/main/mcp/server.ts) (MCP tools), [`server/engine/src/app.ts`](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/app.ts) (Engine runtime), [`mcp/api/index.ts`](https://github.com/maxbittker/rs-sdk/blob/main/mcp/api/index.ts) (Connection manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent interfaces"]
  node_mcp["MCP tools<br/>[server.ts]"]
  node_manager["Connection manager<br/>[index.ts]"]
  node_scripts["Bot scripts<br/>[script.ts]"]
end

subgraph group_control["Bot control"]
  node_sdk["Bot SDK<br/>[index.ts]"]
  node_actions["Action API<br/>[actions.ts]"]
end

subgraph group_client["Game client"]
  node_webclient["Web client<br/>[ClientBuild.ts]"]
  node_lite["Headless client<br/>[LiteClient.ts]"]
end

subgraph group_engine["Game emulator"]
  node_world["Game world<br/>[World.ts]"]
  node_engineapp["Engine runtime<br/>[app.ts]"]
  node_network["Client handlers"]
  node_pathfinding["Pathfinding<br/>[index.ts]"]
  node_db[("Database layer<br/>[query.ts]")]
end

subgraph group_market["Market"]
  node_marketapi["Market SDK<br/>[market.ts]"]
  node_ge["Grand Exchange<br/>[GrandExchange.ts]"]
  node_marketstore[("Market store<br/>[MarketStore.ts]")]
end

node_agent(("Bot agent"))
node_gateway["Gateway"]

node_agent -->|"requests tools"| node_mcp
node_mcp -->|"manages connections"| node_manager
node_mcp -->|"executes code with"| node_sdk
node_agent -->|"starts bot"| node_scripts
node_scripts -->|"runs with"| node_sdk
node_manager -->|"connects"| node_sdk
node_sdk -->|"sends actions"| node_gateway
node_gateway -->|"forwards messages"| node_webclient
node_webclient -->|"relays game state"| node_gateway
node_gateway -->|"forwards state"| node_sdk
node_sdk -->|"exposes actions"| node_actions
node_lite -.->|"exchanges game traffic"| node_world
node_engineapp -->|"starts world"| node_world
node_engineapp -->|"initializes runtime"| node_db
node_network -->|"dispatches search"| node_ge
node_sdk -.->|"reads market data"| node_marketapi
node_ge -.->|"uses market state"| node_marketstore

click node_mcp "https://github.com/maxbittker/rs-sdk/blob/main/mcp/server.ts"
click node_manager "https://github.com/maxbittker/rs-sdk/blob/main/mcp/api/index.ts"
click node_scripts "https://github.com/maxbittker/rs-sdk/blob/main/bots/_template/script.ts"
click node_sdk "https://github.com/maxbittker/rs-sdk/blob/main/sdk/index.ts"
click node_actions "https://github.com/maxbittker/rs-sdk/blob/main/sdk/actions.ts"
click node_webclient "https://github.com/maxbittker/rs-sdk/blob/main/server/webclient/src/client/ClientBuild.ts"
click node_lite "https://github.com/maxbittker/rs-sdk/blob/main/server/webclient/src/lite/LiteClient.ts"
click node_world "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/World.ts"
click node_engineapp "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/app.ts"
click node_network "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/network/game/client/handler/MarketSearchHandler.ts"
click node_pathfinding "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/routefinder/index.ts"
click node_db "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/db/query.ts"
click node_marketapi "https://github.com/maxbittker/rs-sdk/blob/main/sdk/market.ts"
click node_ge "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/market/GrandExchange.ts"
click node_marketstore "https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/market/MarketStore.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp,node_manager,node_scripts toneBlue
class node_sdk,node_actions toneAmber
class node_webclient,node_lite toneMint
class node_world,node_engineapp,node_network,node_pathfinding,node_db toneRose
class node_marketapi,node_ge,node_marketstore,node_agent,node_gateway toneIndigo
```

## Components

### Agent interfaces

- [MCP tools](https://github.com/maxbittker/rs-sdk/blob/main/mcp/server.ts): `mcp/server.ts`
- [Connection manager](https://github.com/maxbittker/rs-sdk/blob/main/mcp/api/index.ts): `mcp/api/index.ts`
- [Bot scripts](https://github.com/maxbittker/rs-sdk/blob/main/bots/_template/script.ts): `bots/_template/script.ts`

### Bot control

- [Bot SDK](https://github.com/maxbittker/rs-sdk/blob/main/sdk/index.ts): `sdk/index.ts`
- [Action API](https://github.com/maxbittker/rs-sdk/blob/main/sdk/actions.ts): `sdk/actions.ts`

### Game client

- [Web client](https://github.com/maxbittker/rs-sdk/blob/main/server/webclient/src/client/ClientBuild.ts): `server/webclient/src/client/ClientBuild.ts`
- [Headless client](https://github.com/maxbittker/rs-sdk/blob/main/server/webclient/src/lite/LiteClient.ts): `server/webclient/src/lite/LiteClient.ts`

### Game emulator

- [Game world](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/World.ts): `server/engine/src/engine/World.ts`
- [Engine runtime](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/app.ts): `server/engine/src/app.ts`
- [Client handlers](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/network/game/client/handler/MarketSearchHandler.ts): `server/engine/src/network/game/client/handler/MarketSearchHandler.ts`
- [Pathfinding](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/routefinder/index.ts): `server/engine/src/engine/routefinder/index.ts`
- [Database layer](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/db/query.ts): `server/engine/src/db/query.ts`

### Market

- [Market SDK](https://github.com/maxbittker/rs-sdk/blob/main/sdk/market.ts): `sdk/market.ts`
- [Grand Exchange](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/market/GrandExchange.ts): `server/engine/src/engine/market/GrandExchange.ts`
- [Market store](https://github.com/maxbittker/rs-sdk/blob/main/server/engine/src/engine/market/MarketStore.ts): `server/engine/src/engine/market/MarketStore.ts`

### Other components

- **Bot agent**
- **Gateway**

## Connections

- Bot agent → MCP tools: requests tools
- MCP tools → Connection manager: manages connections
- MCP tools → Bot SDK: executes code with
- Bot agent → Bot scripts: starts bot
- Bot scripts → Bot SDK: runs with
- Connection manager → Bot SDK: connects
- Bot SDK → Gateway: sends actions
- Gateway → Web client: forwards messages
- Web client → Gateway: relays game state
- Gateway → Bot SDK: forwards state
- Bot SDK → Action API: exposes actions
- Headless client → Game world: exchanges game traffic
- Engine runtime → Game world: starts world
- Engine runtime → Database layer: initializes runtime
- Client handlers → Grand Exchange: dispatches search
- Bot SDK → Market SDK: reads market data
- Grand Exchange → Market store: uses market state
