Docs/MCP / AI Agents
Guides

MCP / AI Agents

Make ReceiptConverter natively available to Claude, Cursor, or any Model Context Protocol (MCP) client. Your AI agent can scan receipts on demand without writing custom glue code every time.

What is MCP? The Model Context Protocol is an open standard by Anthropic that lets AI models call tools defined by third-party servers. Claude Desktop, Cursor, and other MCP clients can discover and call your tools automatically.

Auto-discovery via OpenAPI

ReceiptConverter publishes a machine-readable OpenAPI 3.0 spec. Tools like LangChain, AutoGPT, and LlamaIndex can import this URL to automatically generate a working integration — no manual setup.

# LangChain — load ReceiptConverter as a toolkit
from langchain_community.agent_toolkits.openapi import planner
from langchain_community.utilities import RequestsWrapper
import yaml, requests

spec_url = "https://receiptconverter.com/api/v1/openapi.json"
raw_spec = requests.get(spec_url).json()

headers = {"Authorization": "Bearer sk_live_your_key"}
requests_wrapper = RequestsWrapper(headers=headers)

agent = planner.create_openapi_agent(raw_spec, requests_wrapper, llm)
result = agent.run("Parse this receipt image: https://example.com/lunch.jpg")

Building a minimal MCP server

Create a custom MCP server that exposes a parse_receipt tool. Claude Desktop and Cursor can then call it directly.

// receipt-mcp-server.js  (Node 18+)
import { Server }   from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { readFileSync } from "node:fs";

const API_KEY = process.env.RECEIPTCONVERTER_API_KEY;

const server = new Server(
  { name: "receipt-converter", version: "1.0.0" },
  { capabilities: { tools: {} } }
);

server.setRequestHandler("tools/list", async () => ({
  tools: [{
    name:        "parse_receipt",
    description: "Parse a receipt image or PDF and return structured JSON data (vendor, total, date, line items, taxes).",
    inputSchema: {
      type: "object",
      properties: {
        url: { type: "string", description: "Public URL of the receipt image or PDF" },
      },
      required: ["url"],
    },
  }],
}));

server.setRequestHandler("tools/call", async (req) => {
  const { name, arguments: args } = req.params;
  if (name !== "parse_receipt") throw new Error(`Unknown tool: ${name}`);

  const res = await fetch("https://receiptconverter.com/api/v1/convert", {
    method:  "POST",
    headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
    body:    JSON.stringify({ url: args.url }),
  });

  if (!res.ok) throw new Error(`API error ${res.status}`);
  const { data } = await res.json();

  return {
    content: [{
      type: "text",
      text: JSON.stringify(data, null, 2),
    }],
  };
});

const transport = new StdioServerTransport();
await server.connect(transport);
npm install @modelcontextprotocol/sdk

Connect to Claude Desktop

Add your MCP server to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "receipt-converter": {
      "command": "node",
      "args": ["/path/to/receipt-mcp-server.js"],
      "env": {
        "RECEIPTCONVERTER_API_KEY": "sk_live_your_key_here"
      }
    }
  }
}

Restart Claude Desktop. You can now ask: "Parse this receipt for me: https://example.com/lunch.jpg" and Claude will call your tool automatically.

Connect to Cursor

In Cursor, go to Settings → MCP and add:

{
  "receipt-converter": {
    "command": "node",
    "args": ["/path/to/receipt-mcp-server.js"],
    "env": { "RECEIPTCONVERTER_API_KEY": "sk_live_your_key" }
  }
}

AI discovery files

ReceiptConverter publishes several files that AI agents can use for auto-discovery: