March 21, 20265 min read

MCP Servers for AI Agents: a Practical Guide

What MCP servers are, why AI agents need them, and how to connect Claude or Cursor to deterministic computation tools via MCP.

mcpaideveloper

AI agents are bad at math. They hallucinate numbers, invent formulas, and confidently return wrong answers for calculations that a $5 calculator handles correctly.

A user asks: "If I invest $500/month at 7% annual return for 25 years, how much will I have?" The correct answer is $405,393. Your agent says "approximately $380,000 to $420,000." Close, but wrong, and the user knows it.

MCP (Model Context Protocol) fixes this by giving agents access to external tools. Instead of guessing, the agent calls a real calculator and returns the exact number.

Why agents fail at computation

LLMs generate text by predicting the most likely next token. For language, this works well. For math, it fails because:

  1. Arithmetic is not pattern matching. The product of 847 and 293 is 248,171. There is no pattern to learn here. It is a mechanical operation.
  2. Compound operations amplify errors. A mortgage amortization schedule requires hundreds of dependent calculations. One rounding error in month 1 cascades through 360 months.
  3. Confidence is uncorrelated with accuracy. The model will present wrong numbers with the same certainty as correct text. 23.7% of 847.50 is 200.8575, not "approximately 200."

The fix is simple: give the agent access to a calculator.

What is MCP?

MCP is a protocol that lets AI models call external tools. Think of it as function calling, but standardized across models and clients.

An MCP server exposes a set of tools (functions) that the agent can discover and invoke. The agent sends structured parameters, the server runs the computation, and the result comes back as data.

No prompt engineering. No "please calculate this for me." Just a function call with inputs and outputs.

Setting up MCP with Claude Desktop

Add this to your Claude Desktop configuration:

{
  "mcpServers": {
    "toolknife": {
      "type": "streamable-http",
      "url": "https://toolknife.com/api/mcp"
    }
  }
}

Restart Claude Desktop. You now have access to calculation, conversion, and developer tools.

Try asking Claude: "What is the monthly payment on a $350,000 mortgage at 6.5% for 30 years with 20% down?" It will call the mortgage calculator MCP tool and return the exact amount.

Setting up MCP with Cursor

In Cursor settings, add an MCP server with the same URL:

{
  "mcpServers": {
    "toolknife": {
      "type": "streamable-http",
      "url": "https://toolknife.com/api/mcp"
    }
  }
}

Now when you ask Cursor to "calculate the ROI of this investment" in your codebase, it can call the actual ROI calculator instead of writing an approximation.

Architecture patterns

Single agent, multiple tools

The simplest setup. One agent with access to a tool server. The agent decides which tool to call based on the user's question.

User → Agent → MCP Server → Tool → Agent → User

Works for: chatbots, customer support, personal assistants.

Specialized agents with shared tools

Multiple agents, each handling a domain (finance, health, developer), all sharing the same tool server.

User → Router → Finance Agent → MCP Server → Tools
                Health Agent  → MCP Server → Tools
                Dev Agent     → MCP Server → Tools

Works for: complex applications with domain-specific logic but shared computation needs.

Agent chains with validation

Agent A generates a plan, Agent B executes computations via tools, Agent C validates the results.

User → Planner Agent → Compute Agent → MCP Server → Tools
                                     → Validator Agent → User

Works for: high-stakes applications (financial advice, medical calculations) where you need verification.

What tools are available?

The MCP server exposes tools across these categories:

Category Examples
Finance Mortgage, loan, compound interest, ROI, NPV, IRR, currency conversion
Math Percentage, fractions, quadratic equations, statistics, geometry
Health BMI, calorie calculator, macro nutrients, body fat
Developer JSON formatter, regex tester, UUID generator, hash generator
Conversion Temperature, speed, pressure, energy, digital storage
Date/Time Days between dates, business days, week number
Science Molarity, dilution, density, speed-distance-time

Each tool has typed input parameters and returns structured JSON. The agent handles the parameter mapping automatically.

Real example: home buying assistant

A user asks: "Can I afford a $450K house on a $95K salary with $50K savings?"

The agent needs to calculate mortgage payments, check debt-to-income ratio, and estimate closing costs. Without tools, it estimates all of them. With MCP:

Agent calls: mortgage-calculator (principal=450000, rate=6.5, years=30, downPayment=50000)
→ Monthly payment: $2,528.27

Agent calls: affordability-calculator (income=95000/12, debts=0, rate=6.5, term=30)
→ Max affordable home: $395,000, DTI with this mortgage: 38.2%

Agent calls: closing-costs-calculator (homePrice=450000, state="CA")
→ Estimated closing costs: $13,500

Agent responds: "At current rates, a $450K house would cost $2,528/month.
Your DTI would be 38.2%, which exceeds the recommended 36%. With $50K
savings, you would need about $63,500 for down payment plus closing costs.
You might want to look at homes under $395K, or save a larger down payment."

Every number is exact. The advice is grounded in real computation.

Building your own agent with MCP

If you are building an AI agent with the Anthropic SDK, Claude Agents SDK, or any MCP-compatible framework:

# The agent automatically discovers tools from the MCP server.
# No tool definitions needed in your code.
# Just point your agent to the MCP server URL.

mcp_config = {
    "type": "streamable-http",
    "url": "https://toolknife.com/api/mcp"
}

The server handles tool discovery, parameter validation, and execution. Your agent code stays clean.

Why this matters for product builders

If you are building an AI-powered product that involves any computation:

  • Financial apps: loan comparison, investment projections, tax estimates
  • Health apps: calorie tracking, workout planning, medical calculators
  • Developer tools: code analysis, configuration validation, performance calculations
  • Education: math tutoring, science problem solving, grade calculations

Delegating computation to deterministic tools means no hallucinated numbers, auditable results, consistent outputs, and no fine-tuning needed. The model does not need to learn math. It just needs to call the right tool.

Free vs paid

Tier MCP calls/day Price
Free (no signup) 50 $0
Free account 200 $0
Pro (API key) 5,000 €19/mo
Business 25,000 €99/mo

Free tier requires no signup and no API key. Add an API key header for higher limits:

{
  "mcpServers": {
    "toolknife": {
      "type": "streamable-http",
      "url": "https://toolknife.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Set up MCP in 2 minutes or browse the full tool list.