XIV MCP

Quick start

Offer a first tool to AI assistants in five minutes.

This guide covers API version 2 of the XIV MCP plugin API. If you only want to use XIV MCP, see the user docs.

You need a Dalamud plugin for API 15 (the Dalamud SDK on .NET 10), and XIV MCP loaded in the game to try your tools. The examples use C# 12 features such as collection expressions ([a, b]), which the .NET 10 SDK has by default.

Copy the client

Copy examples/XivMcpClient.cs into your plugin. It is one file, needs only Dalamud and System.Text.Json, and works whether or not XIV MCP is installed.

Create the client and add a tool

Plugin.cs
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using XivMcp.Client;

public sealed class Plugin : IDalamudPlugin
{
    [PluginService]
    internal static IPluginLog Log { get; private set; } = null!;

    private readonly XivMcpClient mcp;

    // Your plugin's own state: the name of whom it follows.
    private string? following;

    public Plugin(IDalamudPluginInterface pluginInterface)
    {
        mcp = new XivMcpClient(pluginInterface);
        mcp.RegistrationFailed += message =>
            Log.Warning($"XIV MCP rejected a tool: {message}");

        mcp.AddTool(
            new McpToolDefinition(
                "myplugin_status",
                "Whom My Plugin is following right now, if anyone.")
            {
                ReadOnly = true,
            },
            args => new { following });
    }

    public void Dispose() => mcp.Dispose();
}

Load your plugin and enable it

Build your plugin and load it as a dev plugin: /xlsettings → Experimental → Dev Plugin Locations, add the path to your built DLL, save, then enable it in /xlplugins → Dev Tools → Installed Dev Plugins.

XIV MCP shows a notification that your plugin wants to register. Click Enable there, or in /xivmcp → Third-party plugins.

Ask the assistant

Ask it "whom is My Plugin following?". It calls myplugin_status and answers from its result.

Hello MCP is a complete example plugin with a tool of each kind and a job.

Quick tools like this one run on the framework thread, the game's main thread, where Dalamud lets you read game memory. They must answer right away; anything that waits is a long-running tool.

On this page