<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vinay Kumar K S</title>
    <description>The latest articles on DEV Community by Vinay Kumar K S (@vinay_kumarks_9d8ca4e45).</description>
    <link>https://dev.to/vinay_kumarks_9d8ca4e45</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2791102%2F074e1368-409c-4943-8643-a16030c458c6.jpg</url>
      <title>DEV Community: Vinay Kumar K S</title>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinay_kumarks_9d8ca4e45"/>
    <language>en</language>
    <item>
      <title>Why AI Agents Need Verifiable Evidence: Building an MCP-Native Retrieval Engine with PostgreSQL</title>
      <dc:creator>Vinay Kumar K S</dc:creator>
      <pubDate>Fri, 18 Sep 2026 04:59:50 +0000</pubDate>
      <link>https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o</link>
      <guid>https://dev.to/vinay_kumarks_9d8ca4e45/why-ai-agents-need-verifiable-evidence-building-an-mcp-native-retrieval-engine-with-postgresql-4b1o</guid>
      <description>&lt;h1&gt;
  
  
  Why standard RAG fails agentic workflows, and how we built &lt;a href="https://github.com/sagarv48/knowledge-fabric" rel="noopener noreferrer"&gt;Knowledge Fabric&lt;/a&gt; using PostgreSQL, pgvector, and FastMCP.
&lt;/h1&gt;

&lt;p&gt;Most Retrieval-Augmented Generation (RAG) setups treat context retrieval as a simple black box: prompt in, cosine similarity ranking, top-k text dump out.&lt;/p&gt;

&lt;p&gt;In conversational chatbots, a slightly noisy chunk is usually harmless. But in agentic architectures—where models make tool calls, plan execution steps, and trigger real-world actions—retrieval without provenance is a major vulnerability. If an agent cannot verify where an excerpt originated, what version of a document it reflects, or whether the text was modified, policy checks fail and downstream execution becomes unreliable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftzr2ngrkuufzn2f1dn34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftzr2ngrkuufzn2f1dn34.png" alt="Knowledge Fabric &amp;amp; Intent Fabric" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To address this, we built Knowledge Fabric: an open-source, vendor-neutral evidence retrieval engine designed natively for the Model Context Protocol (MCP) and built on PostgreSQL with pgvector.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: Naive RAG vs. Agentic Evidence
&lt;/h3&gt;

&lt;p&gt;When an agent needs context to answer an enterprise query or decide on an action, standard vector stores present three common issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Exact-Term Blind Spots: Pure dense vector search often misses exact identifiers (e.g., invoice IDs, function signatures, error codes).&lt;/li&gt;
&lt;li&gt;Missing Citations &amp;amp; Provenance: Agents receive text strings without cryptographic hashing, source revision IDs, or bounding offsets.&lt;/li&gt;
&lt;li&gt;Bloated Context Windows: Shoveling sprawling context into prompts increases latency and token costs while confusing agent decision boundaries.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Architectural Design: The Three-Tier Fabric
&lt;/h3&gt;

&lt;p&gt;Rather than building an all-in-one monolith that handles planning, retrieval, and write executions simultaneously, we separate concerns into three distinct roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Knowledge Fabric (The Librarian): Collects, indexes, searches, and provides verifiable evidence packages with clear citations.&lt;/li&gt;
&lt;li&gt;Intent Fabric (The Planner &amp;amp; Referee): Translates user intent and evidence into policy-validated plans.&lt;/li&gt;
&lt;li&gt;Enterprise Adapters (The Controlled Doors): Read from external systems and execute approved write mutations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Workflow:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7phdxbc2binbp7wmeso0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7phdxbc2binbp7wmeso0.png" alt="Work Flows" width="500" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage Engine: Standard Infrastructure First
&lt;/h3&gt;

&lt;p&gt;We deliberately avoided introducing custom daemons or proprietary vector databases. Knowledge Fabric is built directly on PostgreSQL + pgvector:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hybrid Search with Reciprocal Rank Fusion (RRF): Fuses PostgreSQL BM25-style lexical search (tsvector) with semantic vector embeddings (pgvector) to ensure exact keyword recall alongside conceptual relevance.&lt;/li&gt;
&lt;li&gt;Evidence Packaging: Every retrieved passage includes document URI, offset boundaries, chunk hash, and retrieval explanation metadata.&lt;/li&gt;
&lt;li&gt;Native FastMCP Interface: Exposes retrieval directly over stdio and HTTP endpoints for Claude Code, Cursor, Codex, and custom agent harnesses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  FastMCP Tool Surface
&lt;/h3&gt;

&lt;p&gt;Knowledge Fabric exposes five core MCP tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieve_evidence: Performs hybrid search and returns bounded, cited evidence packages.&lt;/li&gt;
&lt;li&gt;get_document: Fetches full document content and metadata by ID or URI.&lt;/li&gt;
&lt;li&gt;list_sources: Inspects currently indexed collections and document trees.&lt;/li&gt;
&lt;li&gt;explain_retrieval: Returns the scoring breakdown (lexical vs. vector RRF ranks) for an evidence query.&lt;/li&gt;
&lt;li&gt;health: Confirms database connectivity and vector index status.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3-Minute Quickstart
&lt;/h3&gt;

&lt;p&gt;You can test Knowledge Fabric locally using Docker Compose:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clone and launch PostgreSQL with pgvector:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/sagarv48/knowledge-fabric.git
cd knowledge-fabric
docker compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install dependencies &amp;amp; initialize the database:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m venv .venv
source .venv/bin/activate
pip install -e .
python -m knowledge_fabric.cli init-db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run the FastMCP Server:
&lt;code&gt;python -m knowledge_fabric.mcp.server&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can now add the server to your Claude Desktop or Cursor MCP configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "mcpServers": {
    "knowledge-fabric": {
      "command": "python",
      "args": ["-m", "knowledge_fabric.mcp.server"],
      "env": {
        "DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/knowledge_fabric"
      }
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What's Next &amp;amp; Getting Involved
&lt;/h3&gt;

&lt;p&gt;Knowledge Fabric is early and actively developed. We are currently refining local embedding pipelines (Ollama integration) and chunking strategies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/sagarv48/knowledge-fabric" rel="noopener noreferrer"&gt;https://github.com/sagarv48/knowledge-fabric&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Roadmap &amp;amp; Issues: Check out our open issues for connector ideas and hybrid search tuning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are building with MCP or experimenting with agent architectures, I would love to hear how you currently tackle citation and evidence verification in your workflows!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
