<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by arunsadhasivam on Medium]]></title>
        <description><![CDATA[Stories by arunsadhasivam on Medium]]></description>
        <link>https://medium.com/@arunkumarsadhasivam?source=rss-15c2d5786220------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xPog9wDzrgK7lYof.</url>
            <title>Stories by arunsadhasivam on Medium</title>
            <link>https://medium.com/@arunkumarsadhasivam?source=rss-15c2d5786220------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:16:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arunkumarsadhasivam/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[MCP Explained for API Developers(Analogy)]]></title>
            <link>https://arunkumarsadhasivam.medium.com/mcp-explained-for-api-developers-analogy-3e1f0cf24820?source=rss-15c2d5786220------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e1f0cf24820</guid>
            <dc:creator><![CDATA[arunsadhasivam]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 23:25:11 GMT</pubDate>
            <atom:updated>2025-06-23T07:09:02.282Z</atom:updated>
            <content:encoded><![CDATA[<p>MCP Explained for API Developers(Analogy)</p><p>MVC Flow:</p><p>In spring we have below flows<br>1. controller <br>2. service<br>3. DAO ( hibernate, sql, solr)</p><p><strong>Requirement:</strong><br> we need to have web applications which uses search using hibernate , sql or solr based on the input. like if the user need data which wont change often we can make call to hibernate to fetch the results for your reports.<br>i we need to join 2 tables like some records in the linked server we might want to use sql server to use union to join 2 different tables which is easy with sql native queries. or if we want to do synonym search we can use SOLR to get the results.</p><p>here in spring we follow holly wood principle “dont call us , we will call you”.</p><p>in these use case we get the input from UI controller , pass to service and in service we have 3 DAO injection in service layer i.e sql, hibernate and solr.</p><p>here the service layer acts as a router to decide whether to call hibernate, sql or SOLR .</p><pre>@Service<br>public class EmployeeService {<br>    @Autowired private EmployeeSqlDao sqlDao;<br>    @Autowired private EmployeeHibernateDao hibernateDao;<br>    @Autowired private EmployeeSolrDao solrDao;<br><br>    <br>    public List&lt;Employee&gt; getEmployees(String requestType) {<br>        // YOUR LOGIC HERE - you write the routing<br>        if (requestType.equals(&quot;report&quot;)) return hibernateDao.findAll();<br>        if (requestType.equals(&quot;search&quot;)) return solrDao.search();<br>        if (requestType.equals(&quot;relationships&quot;)) return graphDao.findConnected();<br>        return sqlDao.findAll();<br>    }<br>}</pre><p>MCP:</p><p>in MCP lets say we input some math calculation mutiples of (95673*10) , if LLM does text prediction it might match some phone number of some one and might return wrong result. so LLM should be smart enough to do match instead of text prediction.</p><p>we follow similar to holly wood priniciple LLM has mcp client which has</p><p>LLM (acts as intelligent service layer)<br>↓<br>MCP Client (protocol handler) <br>↓<br>Multiple MCP Servers <br>- Math MCP Server<br>- Wiki MCP Server</p><p>MCP Client protocol handler is similar to Webservice handler pattern,there we use handler to handle request and response. we log the soap request and response using handler chains.</p><p>Webservice Handler chain, we log SOAP request and SOAP response by intercepting soap MessageContext request and response . similary ,in MCP based on user prompt protocol handler routes to different tools available like if input is math operation it routes to Math tool.</p><pre>HTTP Request → Handler1 → Handler2 → Handler3 → Business Logic → Response<br>                ↓         ↓         ↓<br>            Security   Logging   Validation</pre><p>Similar in MCP:</p><pre>User Query → LLM → MCP Client → Protocol → MCP Server → Tool → Response<br>              ↓       ↓          ↓         ↓         ↓<br>           Reasoning Routing   Transport Execution Action</pre><p>MCP Client like acts like protocol handler same way we have in SOA architecture , we have common WSDL (service description) adhere to SOAP protocol . users can generate client side stub and server side skeleton like user can have client as in any language and server skeleton in any language, both of them talk to each other using SOAP protocol so that common to both client and server regardless of language.</p><ul><li><strong>LLM = Intelligent Service Layer</strong> (does the routing decisions)</li><li><strong>MCP Client = Protocol Handler</strong> (like Spring’s DI container)</li><li><strong>MCP Server</strong> = Math, wiki search i.e like WSDL Server Skeleton (implements the actual functionality)</li><li><strong>MCP Client</strong> = WSDL Client Stub (handles protocol communication)</li><li><strong>MCP Protocol</strong> = like WSDL service Contract (defines unified language for communication between 2 parties between client &amp; server) similarly MCP proides provides unified communication between LLM/AI Agent and Tools .</li></ul><p>MCP Flow:</p><ul><li><strong>User input prompt</strong></li><li><strong>LLM does reasoning</strong> which tool to route and route using MCP Client</li><li><strong>MCP Client</strong> sends request via JSON-RPC protocol to appropriate MCP Server</li><li><strong>MCP Server</strong> receives request and routes to specific tool</li><li><strong>Tool</strong> executes the actual operation (calculation, database query, API call, etc.)</li><li><strong>Tool</strong> returns result to MCP Server</li><li><strong>MCP Server</strong> formats response and sends back via JSON-RPC protocol</li><li><strong>MCP Client</strong> receives response and passes to LLM</li><li><strong>LLM</strong> processes tool result and generates final user response</li><li><strong>User receives</strong> the complete answer</li></ul><pre>LLM Framework<br>├── Core LLM (reasoning)<br>└── Integrated MCP Client (protocol handler)<br>         ↓<br>    MCP Protocol (unified interface)<br>         ↓<br>    MCP Server (tool implementation)</pre><p>1) <strong>LLM/AI Agent</strong> (the intelligent reasoning party)<br>2) <strong>Tools/Services</strong> (the action-performing party)</p><p>MCP Protocol Definition → Creates: - MCP Client (consumer side) - MCP Server (provider side) MCP Client ←→ JSON-RPC Protocol ←→ MCP Server</p><p><strong>Comparison </strong>:</p><p>Webservice WSDL</p><p>Application → Client Stub → WSDL Interface → Server Skeleton → Service</p><p>. Uses SOAP Protocol</p><p><strong>MCP</strong></p><p>LLM → MCP Client → MCP Protocol → MCP Server → Tool</p><ul><li>Uses MCP Protocol</li></ul><p><strong>Similarities:</strong></p><p>Both use <strong>protocol-based communication</strong></p><ul><li>Both provide <strong>language-agnostic interfaces</strong></li><li>Both separate <strong>client logic</strong> from <strong>server implementation</strong></li><li>Both enable <strong>distributed service architecture</strong></li></ul><p><strong>The evolution:</strong></p><ul><li><strong>WSDL/SOAP</strong> = Heavy, XML-based, enterprise web services</li><li><strong>MCP</strong> = Lightweight, JSON-based, AI tool integration</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e1f0cf24820" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAG Explained for API Developers(Analogy)]]></title>
            <link>https://arunkumarsadhasivam.medium.com/mcp-explained-for-api-developers-analogy-98e798ace7bf?source=rss-15c2d5786220------2</link>
            <guid isPermaLink="false">https://medium.com/p/98e798ace7bf</guid>
            <dc:creator><![CDATA[arunsadhasivam]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 22:54:31 GMT</pubDate>
            <atom:updated>2025-06-21T22:55:06.156Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>RAG Explained for API Developers(Analogy)</strong></p><p><strong>1.MVC Flow:</strong></p><p>MVC — we have model , view controller. when user enter a input in UI controller we have service which is then injected with hibernate or sql dao which queries the db and return the result.</p><p>in MVC for e.g if we use hibernate, if the query is already cached, it hits the hibernate cache , if found it returns result from cache else hit the db and return the result and cache in hibernate cache.</p><p><strong>2.RAG Retrieval Augmented Generation flow :</strong></p><p>when user enters the prompt it then pass to LLM it converts to embedded vector and then search in vector db as <strong>vector similarity search </strong>and then get the result as text and send to LLM with input prompt + vector search result. here vector search result is used for adding context to the search in LLM.</p><p>Flow:</p><ol><li><strong>Query </strong>→ user prompt</li><li><strong>Embed the query</strong> → Convert query or prompt to vector using same embedding model.</li><li><strong>Search vector DB</strong> → Find similar content using vector similarity</li><li><strong>Retrieve relevant documents</strong> → Get the actual text content that matches</li><li><strong>Send to LLM</strong> → Pass original query + retrieved context to LLM for final answer</li></ol><p>Here in RAG Search the prompt you enter got translated to embed vector and search in the RAG and find the relevant top k matched documents and return response.</p><p><strong>Difference:</strong></p><p>In Rag vector is used for finding similarity search and once get the result , the input prompt + result text response not vector is send to the LLM for search.</p><p>RAG is like hibernate second level cache, but it is used for context enrichment i.e adding more context to the search.</p><p>in hibernate we cache entities, collections and queries e.g we catch frequently accessed information .similarly in RAG store business or domain specific details like in banking domain all key terminologies like ledger, account,saving account, transactions as knowledge base in RAG.</p><p>when the user enter the prompt using any banking domain terminologies it understand and adds more context to search by retrieving context from RAG to search in LLM to avoid hallucinations or wrong results. it does based on similarity score.</p><p><strong>Complete RAG flow:</strong> Query → Embed query → Search vector DB → Retrieve similar content → LLM generates answer using retrieved context</p><p>what if RAG layer is not there if user search for “banking transactions or details of saving account” if it does not have business context that user searching for banking , i.e does not have knowledge of these banking terminologies so it directly it search LLM and returns result which might not matches user intent and also if user enter again same prompt it again do analyze or reasoning in LLM which incur cost for tokens. this can be saved by having persistent layer like in hibernate to avoid LLM search so we can save reasoning cost in LLM.</p><p>The key insight: RAG optimizes the retrieval part and can use local models, but you still need language generation capabilities for the final answer.</p><p>RAG is an Architectural pattern which has combination of Retrieval Part + Augmented Generation <br>1) Retrieval part — You persist embeddings in actual vector databases like:</p><ul><li>Chroma</li><li>Pinecone</li><li>Weaviate and others</li></ul><p>2)Augmented Generation- LLM uses the response to predict the topk results based on context provided by RAG.</p><ul><li>Although RAG does not completely reduces LLM query cost but still</li></ul><p><strong>Advantages:</strong></p><p>Using local/smaller models instead of expensive API calls</p><ul><li>Reducing the need to re-process the same information</li><li>But you still need generation capabilities</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98e798ace7bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enable GPU]]></title>
            <link>https://arunkumarsadhasivam.medium.com/enable-gpu-0f03a177852c?source=rss-15c2d5786220------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f03a177852c</guid>
            <dc:creator><![CDATA[arunsadhasivam]]></dc:creator>
            <pubDate>Wed, 18 Jun 2025 08:08:15 GMT</pubDate>
            <atom:updated>2025-06-20T07:30:55.155Z</atom:updated>
            <content:encoded><![CDATA[<p>Steps to enable GPU</p><p><strong>Step 1:</strong></p><p>Make sure you purchase nvidia supported GPU with atleast 4GB.</p><p><strong>Step 2:</strong></p><p>install the Nvidia drivers from cuda toolkit from nvidia cuda toolkit site.</p><p><strong>Step 3:</strong></p><p>make sure CUDA toolkit binaries in the class path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*zB0UQx-2CVEqdmjlCpwK5Q.png" /></figure><p><strong>Step 4:</strong></p><p>create a kernel and install pytorch to support <strong>CUDA 12.4</strong></p><p>(PYTHON_CUDA_GPU_HOME) &gt;pip install torch torchvision torchaudio — index-url <a href="https://download.pytorch.org/whl/cu124">https://download.pytorch.org/whl/cu124</a></p><p><strong>Step 5:</strong></p><p>run sample program to test whether GPU is enabled. make sure run the</p><p>program using kernel where torchvision package installed.</p><p>for the GPU to use below python packages should be in use in your kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcWFnuayFwSMokHLe_zwsQ.png" /></figure><pre>import torch<br>print(&quot;PyTorch Version:&quot;, torch.__version__)<br>print(&quot;CUDA Available:&quot;, torch.cuda.is_available())<br>print(&quot;CUDA Version:&quot;, torch.version.cuda)<br>print(&quot;GPU Count:&quot;, torch.cuda.device_count())<br>print(&quot;GPU Name:&quot;, torch.cuda.get_device_name(0) if torch.cuda.is_available() else &quot;No CUDA Device Found&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3luJOC_8kd05N7zI97pDg.png" /></figure><p>above screen shot shows it is using kernel which has pytorch module which is compatible cuda 12.4 nvidia driver installed on our computer</p><p><strong>Step 6:</strong></p><p>if not work, make sure uninstall pytorch and install again with above command to make sure cuda supported pytorch is installed.</p><p><strong>check below things to debug if not working:</strong></p><ol><li>mostly it should automatically pickup CUDA gpu if you have cuda driver installed in our machine.</li><li>if not check once whether it is selected in nvidia controlpanel</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pc7Q1fpmIpuNwg35RnOcpQ.png" /></figure><p>3.try restart once to make sure kernel picks the CUDA GPU through the pytorch module.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f03a177852c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>