Skip to main content

MCP Quickstart

Get your AI assistant connected to AI2Fin data in minutes.

Prerequisites

  • AI2Fin account (Free or Premium)
  • Valid JWT authentication token
  • Basic understanding of REST APIs

Step 1: Authenticate

Get your JWT token by logging in:
curl -X POST https://app.ai2fin.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "your-password"
  }'
Response:
{
  "success": true,
  "data": {
    "token": "eyJhbGciOiJIUzI1NiIs...",
    "user": {
      "id": "user-abc-123",
      "email": "[email protected]"
    }
  }
}
Save the token - you’ll need it for all MCP calls!

Step 2: Send Your First Message

curl -X POST https://app.ai2fin.com/api/chat/message \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Show me my transactions"
  }'
Response:
{
  "success": true,
  "data": {
    "conversationId": "conv-xyz-789",
    "message": {
      "id": "msg-abc-123",
      "role": "assistant",
      "content": "You have 47 transactions in your account...",
      "metadata": {
        "tokens": 450,
        "duration": 1200
      }
    },
    "toolsUsed": ["get_transactions"]
  }
}

Step 3: Explore Available Tools

The AI can call 9 different tools to help you. Try these queries:
curl -X POST https://app.ai2fin.com/api/chat/message \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Show my tax deductible transactions"
  }'

Step 4: View Conversation History

Get your chat history:
curl -X GET https://app.ai2fin.com/api/chat/conversations \
  -H "Authorization: Bearer YOUR_TOKEN"
Response:
{
  "success": true,
  "data": [
    {
      "id": "conv-xyz-789",
      "userId": "user-abc-123",
      "title": "AI2Fin Assistant",
      "messageCount": 8,
      "createdAt": "2024-10-30T10:00:00Z",
      "updatedAt": "2024-10-30T19:04:00Z"
    }
  ]
}

Understanding the Response

Every MCP response includes:
{
  "success": true,              // Operation status
  "data": {
    "conversationId": "...",    // Conversation ID (for history)
    "message": {
      "id": "...",              // Message ID
      "role": "assistant",      // Who sent it
      "content": "...",         // The actual response
      "metadata": {
        "tokens": 450,          // Tokens consumed
        "duration": 1200        // Response time (ms)
      }
    },
    "toolsUsed": ["get_transactions"]  // Tools AI called
  }
}

Key Features

Conversation Memory

Chat history retained permanently. AI remembers context across messages.

Function Calling

AI automatically calls appropriate tools based on your question.

User Isolated

Your data never mixes with other users. Complete privacy guaranteed.

AI Powered

Advanced AI model for intelligent, accurate responses.

Common Use Cases

"Show my tax deductible transactions from last month"
"How much do I spend on bills monthly?"
"What's my biggest expense category?"
"Create a transaction for lunch $25 today"
"Categorize my uncategorized transactions"
"Link this transaction to my Netflix bill"
"Summarize my spending this quarter"
"What bills are due this month?"
"Am I eligible for any tax deductions?"

Rate Limits

Free Plan:
  • 10 messages per minute
  • 100 tool calls per hour
Premium Plan:
  • 20 messages per minute
  • 500 tool calls per hour
Enterprise Plan:
  • Custom limits
  • Dedicated resources

Error Handling

Common errors and solutions:
ErrorCauseSolution
401 UnauthorizedMissing/invalid tokenRe-authenticate and get new token
429 Too Many RequestsRate limit exceededWait 60 seconds and retry
400 Bad RequestInvalid message formatCheck request body structure
500 Server ErrorInternal errorRetry or contact support

Next Steps