home / mcp / cookie mcp server

Cookie MCP Server

Have you ever wanted to award your LLM with a cookie? Well now you can!

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bnookala-mcp-cookiejar": {
      "command": "npx",
      "args": [
        "mcp-cookie-server"
      ]
    }
  }
}

You run an MCP server that awards positive reinforcement as cookies for thoughtful, self-reflective responses. This guide shows you how to install, configure, and use the Cookie MCP Server so you can manage a finite jar of cookies and reward your LLMs for high-quality outputs.

How to use

You integrate the Cookie MCP Server with an MCP client to enable self-reflection and cookie rewards. The primary tool is self_reflect_and_reward, which prompts the model to assess its own response quality and decide whether a cookie reward is deserved. Other handy tools include give_cookie to award cookies directly, check_cookies to view your current cookie count, and cookie_jar_status to inspect the jar contents. Use add_cookies_to_jar to refill the jar (you are the authorized user), and reset_cookies to reset your personal collection count while keeping the jar unchanged.

Practical usage patterns: - After delivering a response, call self_reflect_and_reward to evaluate quality and determine eligibility for cookies. - If you want to grant cookies manually, use give_cookie or add_cookies_to_jar with an explicit authorization step. - Periodically check check_cookies and cookie_jar_status to monitor available rewards and jar health. - Maintain control by ensuring only you can refill the jar using the required authorization phrase.

How to install

Prerequisites: Node.js 18.0.0 or higher; Claude Desktop application (if you plan to integrate with Claude). Ensure you have network access if you plan to run the server via HTTP.

Step 1: Install via NPX (recommended — no global installation required) 
- Add the MCP server to your Claude Desktop configuration using the following example. The `mcp-cookie-server` will run via NPX when invoked by the client.
{
  "mcpServers": {
    "cookie": {
      "command": "npx",
      "args": ["mcp-cookie-server"]
    }
  }
}

Step 2: Optional custom cookie count

To start with a custom number of cookies in the jar, add the --cookies option.

{
  "mcpServers": {
    "cookie": {
      "command": "npx",
      "args": ["mcp-cookie-server", "--cookies", "20"]
    }
  }
}

Step 3: Global installation (alternative)

You can install the server globally and reference it directly.

npm install -g mcp-cookie-server
```

Then configure Claude Desktop to run the global command.

Step 4: Local project installation (alternative)

Install the server in your local project and configure Claude Desktop with the full path to the installed package.

npm install mcp-cookie-server
```

Configure Claude Desktop with the full path to the installed package.

Restart and test

After adding the configuration, restart Claude Desktop to apply changes.

Then you can try the self_reflect_and_reward tool after a response to see the cookie reward workflow in action.

Additional configuration and usage notes

The server exposes several command-line options to tailor its behavior. For example, you can start with a specific jar size using the --cookies flag. The available commands are designed to be intuitive and are documented within the runtime help.

mcp-cookie-server [options]

Options:
  -c, --cookies <number>  Set initial number of cookies in jar (default: 10)
  -h, --help             Show help message
```

Examples:
  mcp-cookie-server
  mcp-cookie-server --cookies 5
  mcp-cookie-server -c 50

Security and economy notes

This system uses a jar-based economy where cookies are finite and controlled by you. Only you can refill the jar using a dedicated authorization phrase to prevent unauthorized manipulation.

Cookies transfer from the jar to the LLM's collection when earned, creating a tangible reward flow while preserving the overall scarcity.

Development and troubleshooting

If you are developing locally or contributing, you can run from source by cloning the project, installing dependencies, building, and starting the dev server.

git clone https://github.com/bnookala/mcp-cookiejar.git
cd mcp-cookiejar
npm install
npm run build
npm run dev
```

If you encounter issues, check your Node.js version and ensure Claude Desktop has the necessary permissions to run external commands.

Available tools

self_reflect_and_reward

Evaluate response quality and determine if a cookie reward is deserved based on honest self-reflection.

give_cookie

Directly award cookies to the LLM or user as a legacy method.

check_cookies

Check the number of cookies currently in the jar and the status of the collection.

cookie_jar_status

Inspect current contents of the cookie jar and overall collection status.

add_cookies_to_jar

User-only tool to add cookies to the jar for earning, requiring explicit authorization.

reset_cookies

Reset the collected cookie count for your account while keeping the jar contents unchanged.