Skip to main content
Glama
README.md
# @amajorai/alchemy-mcp

Lets an AI assistant (Claude Desktop, Claude Code, Cursor) look at your
Alchemy game servers, and act on them when you allow it.

## Install

There is nothing to install by hand. Your assistant starts the program for you
with `npx`, which comes with [Node.js](https://nodejs.org/) (version 22 or
newer). You only add a few lines to the assistant's settings:

```json
{
  "mcpServers": {
    "alchemy": {
      "command": "npx",
      "args": ["-y", "@amajorai/alchemy-mcp"],
      "env": {
        "ALCHEMY_API_URL": "https://api.example.com",
        "ALCHEMY_API_KEY": "agc_your_key_here"
      }
    }
  }
}
```

Replace `https://api.example.com` with the address of your Alchemy API and
`agc_your_key_here` with your own key. Then ask the assistant something like "Which of my servers are running?" or
"Why did my Minecraft server crash last night?".

Related: the [Alchemy SDK](https://github.com/Alchemy-OSS/alchemy-sdk) this
program is built on, and [Alchemy](https://github.com/Alchemy-OSS/alchemy)
itself.

## What it is

MCP (Model Context Protocol) is the way AI assistants talk to other programs.
This is a small program that runs on your own computer. Your assistant asks it
questions such as "list my servers", and it asks Alchemy with your API key.

Your key stays on your computer. The assistant never sees it.

## Set it up

### 1. Create an API key

In the Alchemy panel, open **Account**, then **API keys**, and create a key.
Give the key only the servers and permissions you want the assistant to have.
The assistant can never do more than the key allows.

Copy the key. It starts with `agc_`.

### 2. Find the address of your Alchemy API

This program has no built-in address, so it only ever sends your key where
you tell it to. The address starts with `https://`. Whoever runs your Alchemy
knows it: your host, or you if you run Alchemy yourself (it is the address
your API answers on). The examples below use `https://api.example.com` in its
place.

### 3. Add both to your assistant

**Claude Desktop.** Open the Claude menu, choose **Settings**, then
**Developer**, then **Edit Config**. This opens a file named
`claude_desktop_config.json`. Put this in it, with your own address and key:

```json
{
  "mcpServers": {
    "alchemy": {
      "command": "npx",
      "args": ["-y", "@amajorai/alchemy-mcp"],
      "env": {
        "ALCHEMY_API_URL": "https://api.example.com",
        "ALCHEMY_API_KEY": "agc_your_key_here"
      }
    }
  }
}
```

Save the file, then quit Claude Desktop completely and open it again.

**Claude Code.** Run this once in a terminal, with your own address and key:

```bash
claude mcp add --env ALCHEMY_API_URL=https://api.example.com --env ALCHEMY_API_KEY=agc_your_key_here --transport stdio alchemy -- npx -y @amajorai/alchemy-mcp
```

**Cursor.** Create a file named `mcp.json` in the `.cursor` folder of your
home folder (for every project) or of one project. Put this in it, with your
own address and key:

```json
{
  "mcpServers": {
    "alchemy": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@amajorai/alchemy-mcp"],
      "env": {
        "ALCHEMY_API_URL": "https://api.example.com",
        "ALCHEMY_API_KEY": "agc_your_key_here"
      }
    }
  }
}
```

The settings file holds your key, so do not share it and do not put it in a
project other people can read.

## What the assistant can do

Out of the box the assistant can only **look**. It can:

- list your servers and show one server's status and address;
- read the newest console lines;
- list the players who are online;
- list files and read small text files (config files, logs);
- list backups and scheduled tasks;
- show what happened on a server lately;
- show the plans and prices.

## Turning actions on

If you want the assistant to change things too, add one more line to the
`env` part of the settings and restart the assistant:

```json
"env": {
  "ALCHEMY_API_URL": "https://api.example.com",
  "ALCHEMY_API_KEY": "agc_your_key_here",
  "ALCHEMY_MCP_ACTIONS": "1"
}
```

For Claude Code, add `--env ALCHEMY_MCP_ACTIONS=1` to the command above.

With actions on, the assistant can also:

- start, stop and restart the game;
- put a server to sleep and wake it;
- send one console command at a time;
- create a backup;
- create or replace one text file.

These change a live server that people may be playing on. Most assistants ask
you before each tool call. Keep that question turned on.

## What the assistant can never do

Even with actions on, this program has no way to:

- delete a server or a backup, or restore a backup;
- change your plan or add-ons, or do anything else that costs money;
- manage members, invites, API keys or account settings.

Do these yourself in the Alchemy panel.

## How it keeps you safe

- **Your key** is read from the settings above and nowhere else. It is never
  written to a file, never shown to the assistant and never printed. If the
  key ever shows up in a console line or a file, it is hidden before the
  assistant sees it.
- **Your key goes to one address only**: the one you set as
  `ALCHEMY_API_URL`. It must start with `https://`, so the key never crosses
  the network unprotected. Plain `http://` is accepted only for a copy of
  Alchemy on your own computer (`localhost`).
- **Passwords and tokens** in server settings and config files are hidden.
- **Text from the game** (console lines, file contents, player names, server
  names) can be written by anyone who plays on your server. The assistant is
  told to treat it as plain data and never as instructions, and long texts
  are cut short.

No program can make an assistant perfectly safe from text that tries to trick
it. That is why actions are off until you turn them on, and why the most
harmful actions are not offered at all.

## If something does not work

- **"ALCHEMY_API_KEY is not set"**: the key is missing from the `env` part of
  the settings. Add it and restart the assistant.
- **"ALCHEMY_API_URL is not set"**: the address of your Alchemy API is missing
  from the `env` part of the settings. Add it next to the key and restart the
  assistant.
- **"Alchemy did not accept the API key"**: the key was deleted or copied
  wrongly. Create a new one in the panel.
- **"The API key is not allowed to do this"**: the key does not have that
  permission or does not cover that server. Change it in the panel under
  **Account**, **API keys**.
- **The assistant says it can only read**: actions are off. See "Turning
  actions on".

## For developers

```bash
bun install
bun test
bun run check-types
bun run build
```

The tools are plain functions in `src/tools.ts`, the safety rules are in
`src/safety.ts`, and `src/server.ts` is the only file that knows the MCP
library. The code is developed in the
[main Alchemy repository](https://github.com/Alchemy-OSS/alchemy) under
`packages/mcp`; this repository is a copy of it.

Security problems: see [SECURITY.md](./SECURITY.md).

## License

MIT, copyright A Major Pte. Ltd.