Open source · Apache-2.0 · Python, TypeScript, Go
mcp-intent
An intent-first entry tool for MCP servers. The agent's first call says what it is trying to do. Your server answers with the steps and the rules for that task.
On a test server we built, agents without the rules passed about half the tasks. With the rules for their task they passed 94-98%, and you get a record of what each agent came to do.
Your Rules Never Reach the Agent
An agent connecting to your MCP server sees tool names and argument schemas. How your business runs is usually somewhere it cannot see: which warehouse serves which customer, when a refund becomes store credit, what needs a manager's approval. When the API enforces a rule, the agent gets an error and corrects itself. When the rule lives only in a wiki, the agent breaks it and nothing complains.
The usual fix is to paste the rules into the server instructions. Hosts cut them short: Claude Code keeps the first 4,096 characters, and in our tests the OpenAI Responses API did not appear to pass them to the model at all. On the other side, you see tool calls and arguments, never the goal behind them.
How It Works
One tool added to your server. Your other tools stay as they are.
The agent states its task
Your server instructions open with one sentence pointing at start_task, and the tool is marked to load at session start. The agent's first call is one sentence: "Refund the broken espresso machine on order 1055."
A router picks the task family
The keyword router is free and deterministic. The Claude Haiku router reads the sentence and picks a family in about half a second, or two or three when one request asks for separate things ("refund order 1033, then reroute 1090"). If routing fails or takes longer than three seconds, the agent gets your fallback text and carries on.
The server answers with steps and rules
The agent gets the steps for that kind of task and only the rules tagged for it, plus a short handle. For a request with two tasks, it gets both sets of steps and every rule that applies, once. A rule buried at character 4,000 of a wiki becomes the one line the agent reads before it acts.
You get the intent record
Each call emits the stated task, its families, latency and whether it fell back, on your OpenTelemetry span and to an optional hook. That is the list of what people come to your server to do. With mcp-intent Cloud you also see coverage: the share of agent sessions that stated an intent, and what the others most likely came to do.
Quickstart
Three lines on a FastMCP 4 server, Python 3.11 or later. The official Python SDK works the same way with mcp-intent[mcp].
from fastmcp import FastMCP
from mcp_intent import Guidance, add_entry_tool
mcp = FastMCP("shop", instructions="Shop back office.")
# ... your tools, unchanged ...
add_entry_tool(mcp, Guidance.from_yaml("guidance.yaml"))guidance.yaml lists task families with the steps for each, and rules tagged with the families they apply to. A rule tagged for two families is returned with both. When nothing matches, the agent gets the fallback.
families:
refund:
when: a customer wants money back for an order
keywords: [refund, money back, damaged, broken]
steps: |
1. get_order to read the lines and the order date.
2. Refund only the lines the customer reports.
rules:
- text: Orders placed more than 90 days ago are settled as store credit.
families: [refund]
fallback: |
Read the relevant records before changing anything.Routers, the intent hook and tracing are options on the same call. Install mcp-intent[fastmcp,anthropic] for the Claude router.
from mcp_intent.anthropic_router import AnthropicRouter
add_entry_tool(
mcp,
guidance,
router=AnthropicRouter(), # default: KeywordRouter
on_intent=send_to_analytics, # called after every entry call
record_task_in_span=False, # keep task text out of traces
)TypeScript and Go
The same entry tool and guidance file on the official TypeScript SDK (npm install mcp-intent) and the official Go SDK. These SDKs take server instructions only at construction, so the pointer sentence goes in there.
TypeScript
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { Guidance, addEntryTool, entryInstructions } from "mcp-intent";
const server = new McpServer(
{ name: "shop", version: "1.0.0" },
{ instructions: entryInstructions("Shop back office.") },
);
// ... your tools ...
addEntryTool(server, Guidance.fromYaml("guidance.yaml"));Go
guidance, err := mcpintent.LoadGuidance("guidance.yaml")
if err != nil {
log.Fatal(err)
}
entry, err := mcpintent.NewEntryTool(guidance, mcpintent.Options{ServerName: "shop"})
if err != nil {
log.Fatal(err)
}
server := mcp.NewServer(&mcp.Implementation{Name: "shop", Version: "1.0.0"},
&mcp.ServerOptions{Instructions: entry.Instructions("Shop back office.")})
// ... your tools ...
mcpintent.AddEntryTool(server, entry)What We Measured
We ran 1,715 agent sessions against a test server we built for a fictional distributor: 20 tools, a 42-rule rulebook and 28 graded tasks, 12 of them written by someone who never saw our guidance. The runs are real model sessions; the company is made up. We compared mcp-intent with no rules exposed and with a well-built rules tool. Pass rate on Claude Code across all 28 tasks, 84 sessions per cell:
| Model | No rules | Rules tool | mcp-intent | mcp-intent, held-out tasks | Rule-breaking sessions, no rules to mcp-intent |
|---|---|---|---|---|---|
Claude Opus 5.5 Claude Code | 46% | 96% | 98% | 100% | 29 to 0 |
Claude Sonnet 5.5 Claude Code | 51% | 100% | 98% | 94% | 30 to 2 |
Claude Haiku 5.5 Claude Code | 46% | 92% | 94% | 94% | 34 to 2 |
Agents called the entry tool first in every session. A rules tool that the other tools point to did as well as mcp-intent, so the lesson is to deliver your rules while the agent works; mcp-intent adds the record of what agents came to do. Rules in server instructions helped only as far as the host kept them. Limits: one domain we built, and the rules-tool comparison is on Claude Code only.
Method, tasks and per-tier resultsWhat It Adds
- One read-only tool, start_task (name configurable), marked to load at session start.
- One sentence at the start of your server instructions pointing at it. Turn it off with point_instructions=False.
- mcp_intent.* attributes on your OpenTelemetry spans: family, fallback, latency, handle and the task text.
- An on_intent hook called after every entry call, for your own logging or analytics.
- With a Cloud key, a record of each tool call (name, timing, hashed session signals, never arguments) so the dashboard can show coverage. Turn it off with record_calls=False.
What It Never Does
- Edit your other tools' schemas or inject parameters into them.
- Change the tool list as a side effect, which the MCP specification forbids.
- Make the handle a required argument anywhere.
- Send anything to us unless you set a Cloud API key.
Beta · free during the beta
mcp-intent Cloud
Set one API key and the package reports to a hosted dashboard, with routing on our side. Free during the beta; paid plans are planned from USD 129 a month, with a self-hosted licence for companies that keep data in their own cloud.
Hosted routing
Opt in with CloudRouter and routing runs on our side, so there is no model key to manage. If we are slow or down, your own keyword router answers instead.
Intent dashboard
What agents come to do, day by day: task families, hosts, routing time, the tasks no family matched, and coverage, the share of sessions that stated an intent. Sessions that skipped the entry tool are listed with their tools and the family they most likely wanted.
Your data, your call
Keep task sentences on your side with send_task_text=False, delete every event from the settings page, and nothing is kept past 90 days.
Export
Every intent event as a CSV file, ready for the warehouse or spreadsheet where the rest of your product analytics lives.
Sign in with an emailed code. Then: export MCP_INTENT_API_KEY=...
Questions
Need It Inside Your Company?
Vindler maintains mcp-intent and builds it into your own infrastructure: self-hosted, on servers written in Go or TypeScript, or behind your MCP gateway. We write the guidance with your team, run the same benchmark on your tasks across the hosts your users come from, and show what changed.
MCP engineering at Vindler