AI assistants (MCP)
Connect Claude, Cursor or another AI tool to Mittelware over MCP so it can create and edit your rules, collections and variables, explain how rules work, and check why a rule isn't firing.
Mittelware has a built-in MCP server. MCP (the Model Context Protocol) is the standard way for an AI tool such as Claude, Cursor or GitHub Copilot to use another program. Once you connect one, you can ask it in plain words to work with your rules:
- "Block every request to doubleclick.net in Chrome."
- "Mock
GET /api/usersin Edge with two users, in a collection called Mocks." - "Why isn't my
Prod API to localhostrule firing for this request?" - "Explain all my rules, and tell me which ones hide each other."
The assistant doesn't guess how Mittelware works. The server hands it a built-in guide to the rule engine (conditions, actions, {{ }} template tags, order and priority, variables, WebSocket rules, recipes and troubleshooting), and tools that use the same checks as the Create Rule form. A rule it makes is validated exactly like one you make by hand, and it shows up on the Rules page as it happens.
NOTE
Anything an assistant creates is switched on straight away and changes real traffic from then on. Look at what it made on the Rules page, and switch off or delete what you don't want.
Connect an assistant#
The server is on by default. Open Settings, then AI assistants. The Connect an assistant card has a snippet for each tool, with your address and access token already filled in. Click the copy button and paste it where the tool says.
Claude Code#
Run this once in a terminal. It works for Claude Code in the terminal and in VS Code, for every project:
claude mcp add --transport http --scope user mittelware http://127.0.0.1:47831/mcp --header "Authorization: Bearer <your token>"
Then ask Claude Code something. /mcp lists the servers it knows about, and mittelware should show as connected.
Claude Desktop#
Claude Desktop starts local helper programs, so it uses a small bridge (mcp-remote, which needs Node.js). In Claude Desktop open Settings, Developer, Edit Config, add this under mcpServers, and restart Claude Desktop:
{
"mcpServers": {
"mittelware": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://127.0.0.1:47831/mcp", "--allow-http", "--header", "Authorization:${MITTELWARE_AUTH}"],
"env": { "MITTELWARE_AUTH": "Bearer <your token>" }
}
}
}
Cursor#
Save this as .cursor/mcp.json in a project, or ~/.cursor/mcp.json for every project:
{
"mcpServers": {
"mittelware": {
"url": "http://127.0.0.1:47831/mcp",
"headers": { "Authorization": "Bearer <your token>" }
}
}
}
VS Code (GitHub Copilot)#
Save this as .vscode/mcp.json in a project, or run MCP: Open User Configuration to use it everywhere:
{
"servers": {
"mittelware": {
"type": "http",
"url": "http://127.0.0.1:47831/mcp",
"headers": { "Authorization": "Bearer <your token>" }
}
}
}
Any other tool#
Give it the address http://127.0.0.1:47831/mcp and have it send Authorization: Bearer <your token> with every request. Mittelware speaks MCP over HTTP ("streamable HTTP"), so any tool that supports that works.
What the assistant can do#
| Area | What it can do |
|---|---|
| Learn | Read the built-in guide, check whether monitoring is on, list the apps you can scope a rule to |
| Rules | List, read (with a plain-language explanation), create, change, switch on or off, and delete rules; check a rule without saving it |
| Test | Ask which rules would act on a sample request, and a sample response, and why others wouldn't |
| Collections | List, create, rename, switch on or off, delete, and move rules between them |
| Variables | List, create, change and delete variables. The values of hidden variables are never shown to the assistant |
| Import and export | Read your rules as the Export button writes them, and import rules from that format |
Assistants that support MCP prompts also offer create-rule, explain-my-rules and why-isnt-my-rule-firing, which start the most common conversations for you.
It's safe by default#
Rules can redirect your traffic and variables can hold cookies and tokens, so the server is locked down:
- It listens on this computer only (
127.0.0.1), never on your network. - Every request needs the access token. Without it the server answers
401and does nothing. - A request from a web page on another site is refused, so a website can't use it, even by tricks with DNS.
- The values of hidden variables are never sent to an assistant. It can set one, but not read it back.
- Treat the token like a password. New token in the settings makes a fresh one; the old one stops working at once, and you give the new one to your assistants.
To turn the whole thing off, switch off Let AI assistants manage my rules. Assistants that are connected stop working immediately.
When something doesn't work#
| What you see | What to check |
|---|---|
| The assistant says it can't connect | Is Let AI assistants manage my rules on, and does the card say Running at …? Is Mittelware open? The server runs inside the app |
It answers 401 |
The token is wrong or was replaced. Copy the snippet again from Settings, AI assistants |
| The card says Couldn't listen on … | Another program uses that port. Pick another in Port and copy the snippets again |
| A rule it made doesn't fire | Ask it to run why isn't my rule firing. The usual causes are monitoring being off, the app not being opened through Mittelware, or a trusted-certificate problem for HTTPS. See Rules and HTTPS |
| Claude Desktop shows no tools | npx must work in a terminal (install Node.js), and the config must be valid JSON. Restart Claude Desktop after editing it |