> For the complete documentation index, see [llms.txt](https://kaizo-1.gitbook.io/kaizo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kaizo-1.gitbook.io/kaizo-docs/lua-engine/mcp/setup-mcp.md).

# Setup MCP

## Name

MCP / AI for Kaizo

## What it does

MCP lets an AI tool like Cursor talk to the running cheat over localhost.

It can manage Lua scripts, explore the game tree, and probe memory.

This is separate from your `.lua` files. Lua scripts are persistent features. MCP is a control plane for an AI.

## How to set it up

1. Start Kaizo and attach to Sober.
2. Open the menu with Insert or Home.
3. Go to Scripts, then MCP/AI.
4. Turn on Enable MCP.
5. Wait until it says ready on localhost port 9090.
6. Click Copy prompt.
7. Paste that prompt into Cursor or your AI tool.
8. Make sure your MCP config has this server:

```json
{
  "mcpServers": {
    "linux-rbx-external": {
      "url": "http://127.0.0.1:9090/mcp"
    }
  }
}
```

9. Reload MCP or restart the agent so the tools show up.

## Memory writes

Allow memory writes stays off by default.

Leave it off unless you want the AI to write memory.

Reading memory and using Lua tools still works with writes off.

Also keep Misc Disable memory writes off if you want any writes at all.

## Lua tools MCP can use

* `lua_scripts_directory`
* `lua_api_catalog`
* `lua_api_lookup`
* `lua_list_scripts`
* `lua_read_script`
* `lua_eval`
* `lua_write_script`
* `lua_refresh`
* `lua_set_enabled`
* `lua_reload`
* `lua_delete_script`

Use `lua_eval` for one shot tests. Save a `.lua` file and enable it for lasting features.

## Example

```
1. Enable MCP in Scripts -> MCP/AI
2. Copy prompt
3. Add the localhost MCP url in Cursor
4. Ask the AI to list scripts with lua_list_scripts
5. Ask it to write a small hello overlay script and enable it
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kaizo-1.gitbook.io/kaizo-docs/lua-engine/mcp/setup-mcp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
