plg-knowledge

Shipped private

A secure, multi-user MCP server that indexes Pace Loan Group's loan documents from OneDrive into a structured Postgres database and exposes them to Claude Desktop via typed tools.

Repository

36 commits over 5 days

What it is

This is a production internal knowledge system built for Pace Loan Group (PLG), a commercial C-PACE lender. It solves a critical business problem: aggregating and querying historical loan data scattered across hundreds of OneDrive documents (PDFs, Word docs, Excel files). Instead of naive RAG, the system uses LLM-powered structured extraction to build a relational model (deals, people, organizations, deal_parties) with field-level provenance, entity resolution, and a reconciliation layer that picks the most authoritative value when documents conflict. PLG employees authenticate via Entra ID OAuth and interact through Claude Desktop to run queries like "list all brokers we've worked with, their emails, deal count, and close rate."

Why I built it

Built to centralize institutional knowledge for a fast-growing direct lender whose loan history lived in disorganized OneDrive folders. The developer (likely a PLG employee or contractor learning agentic software engineering) wanted structured aggregation – not just document search – and needed multi-user security (audit logs, OAuth, sensitive-field filtering) suitable for confidential loan data including PII. The provenance and reconciliation features suggest real operational pain around conflicting data across deal stages (application → term sheet → closing docs).

Tech stack

Python (FastAPI, FastMCP for Streamable HTTP MCP), Supabase Postgres with pgvector for embeddings, Microsoft Graph API (OneDrive sync + webhooks), OpenAI API (structured extraction via instructor + Pydantic), Entra ID OAuth (AzureProvider), Railway (hosting, cron jobs), Tesseract OCR + Ghostscript (scanned PDFs), pymupdf/pdfplumber/openpyxl (document parsers), HubSpot API (optional contact enrichment). Includes a Flask admin dashboard for corpus/usage analytics.

Timeline & effort

Last active Jun 14, 2025 — 36 commits across 5 active days (spanning 10 days).

Developed intensively over 10 calendar days (5 active commit days, 36 commits) in June 2026. The short calendar span with dense commit activity indicates a focused build sprint, likely with substantial daily effort. The mature architecture (migrations, evals, multi-service deploy, provenance system, webhook integration) suggests this was a serious production push rather than casual experimentation.

Did it turn out useful?

This is a fully deployed, production-grade internal tool: comprehensive deploy documentation for Railway multi-service setup (MCP server + webhook worker), Microsoft Graph webhook integration, Entra ID OAuth for multi-user auth, audit logging, field provenance with reconciliation, eval framework against golden sets, security documentation covering PII/sensitive data handling, and migration automation. The private repo, detailed deploy/security docs, company-specific context (plg-context.md with real business background), and HubSpot integration confirm it's serving real users at Pace Loan Group.

#mcp-server #llm-extraction #knowledge-management #postgres #pgvector #oauth