← cd ~/projects

MF-RAG: Mutual Fund Document Search

LLM-free RAG system that lets Claude search 500+ Indian mutual fund schemes — semantic search with pgvector and Ollama embeddings, 10x faster than local LLM approaches.

TypeScriptMCPPostgreSQLpgvectorBun

Overview

An LLM-free Retrieval-Augmented Generation system that enables Claude Desktop and Claude Code to search and answer questions about Indian mutual fund documents. Instead of using a local LLM to generate answers (slow, inaccurate, jailbreak-prone), it embeds queries and retrieves relevant document chunks, leaving synthesis to Claude.

Why LLM-Free?

With Local LLMMF-RAG
Latency8–16 seconds300–500ms
AccuracyMisses table dataParses tables correctly
SecurityJailbreak-proneNo LLM to jailbreak
CostLLM inference per queryEmbedding only

Architecture

Claude Desktop/Code → HTTP → MCP Server (Bun)

                              Embedder (Ollama bge-m3)

                              pgvector search (PostgreSQL)

                              Return chunks → Claude synthesizes

MCP Tools

  • query_mutual_funds — Semantic search returning chunks with citations for Claude to synthesize
  • search_mutual_fund_docs — Lower-level vector search
  • list_schemes — Browse all 500+ indexed mutual fund schemes
  • check_status — Health check for pgvector and Ollama

Document Coverage

  • 500+ mutual fund schemes across 50+ AMCs
  • 3 document types: SID (Scheme Info), KIM (Key Memorandum), Factsheets
  • 13,500+ chunks indexed with 1024-dimension vectors
  • 90.8% SEBI citation coverage with source URLs and page numbers

Tech Stack

  • Bun runtime with TypeScript (strict)
  • MCP SDK for Claude integration (HTTP + stdio transports)
  • PostgreSQL 16 + pgvector with HNSW indexing for similarity search
  • Ollama + bge-m3 for open-source embeddings
  • Drizzle ORM for type-safe database queries
  • unpdf + pdfplumber (Python) for text and table extraction
  • Caddy reverse proxy with auto TLS

Try It

Add this to your Claude Desktop MCP settings to query Indian mutual fund documents:

{
  "mcpServers": {
    "mf-rag": {
      "url": "https://mf-rag.samuelnittala.dev/mcp"
    }
  }
}

Then ask Claude anything about Indian mutual fund schemes — holdings, NAV, risk factors, expense ratios, and more.