<?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 Vidya Vukanti on Medium]]></title>
        <description><![CDATA[Stories by Vidya Vukanti on Medium]]></description>
        <link>https://medium.com/@arnavidya?source=rss-8ce557237ef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lJ3tE9cDatXsJjAm</url>
            <title>Stories by Vidya Vukanti on Medium</title>
            <link>https://medium.com/@arnavidya?source=rss-8ce557237ef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:37:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arnavidya/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: Your LangChain Agent’s Superpower for Tools ]]></title>
            <link>https://medium.com/@arnavidya/mcp-your-langchain-agents-superpower-for-tools-442a66f408b6?source=rss-8ce557237ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/442a66f408b6</guid>
            <category><![CDATA[langchain-agents]]></category>
            <category><![CDATA[langchain-tools]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Vidya Vukanti]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 09:56:40 GMT</pubDate>
            <atom:updated>2025-12-09T10:14:23.489Z</atom:updated>
            <content:encoded><![CDATA[<p>Stop writing monolithic code. Start building powerful AI agents the easy, modular way.</p><p>So, you’re diving into the world of AI agents with LangChain. Awesome! You’ve probably realized that to make an agent truly useful, you need to give it <strong>tools</strong>. A tool can be anything from a simple calculator to a complex database connector.</p><p>But as you add more tools, your code can get messy. All that logic for searching the web, querying a database, or calling a weather API gets tangled up in your main application.</p><p>What if there was a ridiculously simple way to separate your tools from your agent? What if you could build each tool as its own mini-application and have your agent connect to them effortlessly?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*B42_gkX6iwGD-i1BGtAqQw.png" /></figure><p>Say hello to the <strong>LangChain Model Context Protocol (MCP)</strong>. It’s a fancy name for a simple idea: a standard way for your agent (the “client”) to talk to your tools (the “servers”). For a deeper dive, you can always check out the <a href="https://docs.langchain.com/oss/python/langchain/mcp"><strong>official LangChain documentation</strong></a>.</p><p>This guide will show you just how easy it is to get started. No complex theory, just practical code.</p><h3>The Big Idea: Think of it Like Ordering Pizza 🍕</h3><p>The MCP architecture is super intuitive.</p><ul><li><strong>Tool Servers:</strong> Imagine each tool is a different restaurant. You have a pizza place (your Math tool), a taco stand (your Weather tool), and a sushi bar (your Database tool). Each one is an expert at one thing.</li><li><strong>Agent Client:</strong> This is you! You have a phone (the MCP Client) and you can call any of these restaurants to order what you need.</li></ul><p>Your agent doesn’t need to know how to make pizza; it just needs the phone number for the pizza place. That’s the core of MCP: <strong>decoupling your agent from its tools.</strong></p><h3>Example 1: Your First Tool — The Math Server</h3><p>Let’s start with a simple agent that can do math. We need two files: the tool server (the restaurant) and the agent client (you with the phone).</p><h4>The Server: Building the “Math Restaurant”</h4><p>Creating a tool server is shockingly easy. You just write a standard Python function and add one line of code: the @mcp.tool() decorator.</p><p>Here’s the complete code for our math server (SingleServer/Server.py):</p><pre>from mcp.server.fastmcp import FastMCP<br>import math<br><br># Create the server and give it a name<br>mcp = FastMCP(&quot;Math&quot;)<br><br># Write a normal Python function and turn it into a tool with this one line!<br>@mcp.tool() <br>def add(a: int, b: int) -&gt; int | float:<br>    &quot;&quot;&quot;Add two numbers&quot;&quot;&quot;<br>    return a + b<br><br>@mcp.tool() <br>def multiply(a: int, b: int) -&gt; int | float:<br>    &quot;&quot;&quot;Multiply two numbers&quot;&quot;&quot;<br>    return a * b<br><br>@mcp.tool()<br>def divide(a: float, b: float) -&gt; float | str:<br>    &quot;&quot;&quot;<br>    Returns the result of a division (a / b).<br>    Returns an error message if division by zero is attempted.<br>    &quot;&quot;&quot;<br>    if b == 0:<br>        return &quot;Error: Cannot divide by zero.&quot;<br>    return a / b<br><br>@mcp.tool()<br>def power(base: float, exponent: float) -&gt; float:<br>    &quot;&quot;&quot;Calculates the base raised to the power of the exponent (base^exponent).&quot;&quot;&quot;<br>    return base ** exponent<br><br>@mcp.tool()<br>def square_root(number: float) -&gt; float | str:<br>    &quot;&quot;&quot;<br>    Calculates the square root of a non-negative number.<br>    Returns an error message if the number is negative.<br>    &quot;&quot;&quot;<br>    if number &lt; 0:<br>        return &quot;Error: Cannot calculate the square root of a negative number.&quot;<br>    return math.sqrt(number)<br><br>if __name__ == &quot;__main__&quot;:<br>    # Start the server<br>    mcp.run(transport=&quot;stdio&quot;)</pre><p>That’s it! You’ve just created a standalone “Math” tool server. Any function with the @mcp.tool() decorator is now available for your agent to use.</p><h4>The Client: Giving Your Agent the Phone</h4><p>Now, let’s set up the agent and connect it to our new tool.</p><pre># SingleServer/Client.py<br>import asyncio<br>from langchain_mcp_adapters.tools import load_mcp_tools<br>from langgraph.prebuilt import create_react_agent<br>from mcp import ClientSession, StdioServerParameters<br>from mcp.client.stdio import stdio_client<br>from config import llm<br>from pathlib import Path<br><br># Setup the parameters for the local tool server<br>script_dir = Path(__file__).resolve().parent<br>math_server_path = script_dir /  &quot;Server.py&quot;<br>server_params = StdioServerParameters(<br>    command=&quot;python&quot;,<br>    args=[str(math_server_path)],<br>)<br><br>async def main():<br>    print(&quot;Starting client and connecting to Math tool server...&quot;)<br>    async with stdio_client(server_params) as (read, write):<br>      async with ClientSession(read, write) as session:<br>        # Initialize the connection<br>        await session.initialize()<br>        print(&quot;Client connected to Math tool server.&quot;)<br>        # Get tools<br>        tools = await load_mcp_tools(session)<br>        # Create agent<br>        agent = create_react_agent(llm, tools)<br>        # Invoke the agent in interactive mode<br>        while True:<br>                print(f&quot;Tools loaded: {[tool.name for tool in tools]}&quot;)<br>                # 1. Get user input from the command line<br>                user_input = input(&quot;\nEnter an expression or \&quot;exit\&quot;,\&quot;quit\&quot;, \&quot;q\&quot; to exit: &quot;)<br><br>                # 2. Check for an exit command<br>                if user_input.lower() in [&quot;exit&quot;, &quot;quit&quot;, &quot;q&quot;]:<br>                    print(&quot;👋 Goodbye!&quot;)<br>                    break<br><br>                # 3. Add instructions for the desired output format<br>                prompt = (<br>                    f&quot;{user_input} Please provide the final answer in plain text, &quot;<br>                    &quot;without using any markdown or LaTeX formatting.&quot;)<br><br>                agent_response = await agent.ainvoke({&quot;messages&quot;: [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}]})<br>                print(agent_response)<br>                for message in agent_response[&quot;messages&quot;]:<br>                  message.pretty_print()<br><br><br>if __name__ == &quot;__main__&quot;:<br>    asyncio.run(main())<br></pre><p>The key takeaway is the load_mcp_tools(session) function. It connects to your server, automatically discovers all the functions you decorated, and makes them ready for LangChain. Your agent code stays clean and simple.</p><h4>stdio: The Private Pipe ↔️</h4><p><em>What we used in the first example is </em><strong><em>stdio</em></strong><em> communication. </em><strong><em>stdio</em></strong><em> stands for </em><strong><em>Standard Input/Output</em></strong><em>.</em></p><p><em>When your client script starts the server script using </em><em>stdio_client, it creates a direct, private pipe between them. The </em><em>stdio_client starts your </em><em>Server.py process and gives you back two communication lines:</em></p><ul><li><em>write: This is your client&#39;s connection to the server&#39;s </em><strong><em>Standard Input (stdin)</em></strong><em>. Anything your client writes here is received by the server as if it were typed directly into its terminal.</em></li><li><em>read: This is your client&#39;s connection to the server&#39;s </em><strong><em>Standard Output (stdout)</em></strong><em>. Anything the server </em><em>prints is captured by your client from this stream.</em></li></ul><p><strong><em>Why use it?</em></strong><em> It’s simple, private, and efficient for two processes communicating on the same machine, especially when one process manages the other.</em></p><h3>Example 2: Going Big with Multiple Servers</h3><p>Okay, one tool is cool. But what about four? This is where MCP’s elegance really shines.</p><p>Let’s upgrade our agent to connect to <strong>four independent tool servers at once</strong>:</p><ul><li><strong>Math</strong>: Our local server from before.</li><li><strong>Weather</strong>: A server that gets live weather data.</li><li><strong>Web Search</strong>: A server that can search the internet.</li><li><strong>Oracle DB</strong>: A server for querying a database.</li></ul><pre># weather.py<br>from mcp.server.fastmcp import FastMCP<br>import os<br>from dotenv import load_dotenv<br>import requests<br>load_dotenv()<br><br># Create a simple MCP server<br>mcp = FastMCP(&quot;Weather&quot;,<br>              port=8007,<br>              host=&quot;127.0.0.1&quot;,<br>              debug=True)<br><br><br>@mcp.tool()<br>def get_weather(location: str) -&gt; str:<br><br>    &quot;&quot;&quot;Gets the current weather for a given location using the OpenWeatherMap API.&quot;&quot;&quot;<br>   <br>    API_KEY = os.getenv(&quot;OPENWEATHERMAP_API_KEY&quot;)<br>    if not API_KEY:<br>        return &quot;Error: Server is missing the OPENWEATHERMAP_API_KEY.&quot;<br><br>    BASE_URL = &quot;https://api.openweathermap.org/data/2.5/weather&quot;<br>    params = {<br>        &quot;q&quot;: location,<br>        &quot;appid&quot;: API_KEY,<br>        &quot;units&quot;: &quot;metric&quot;<br>    }<br><br>    try:<br>        response = requests.get(BASE_URL, params=params)<br>        response.raise_for_status()<br>        data = response.json()<br>        description = data[&quot;weather&quot;][0][&quot;description&quot;]<br>        temp = data[&quot;main&quot;][&quot;temp&quot;]<br>        return f&quot;The weather in {location} is currently {description} with a temperature of {temp}°C.&quot;<br>    except requests.exceptions.RequestException as e:<br>        return f&quot;Error: Could not retrieve weather data. {e}&quot;<br><br>if __name__ == &quot;__main__&quot;:<br>    mcp.run(transport=&quot;sse&quot;)</pre><pre># web_server.py<br>from mcp.server.fastmcp import FastMCP<br>from langchain_community.tools import DuckDuckGoSearchRun<br><br># Create a simple MCP server<br>mcp = FastMCP(&quot;web search&quot;,<br>              port=8008,<br>              host=&quot;127.0.0.1&quot;,<br>              debug=True)<br><br>search = DuckDuckGoSearchRun()<br><br>@mcp.tool()<br>async def web_search(query: str) -&gt; dict:<br>    &quot;&quot;&quot;<br>    Perform a web search using DuckDuckGo.<br>    &quot;&quot;&quot;<br>    try:<br>        results = search.run(query)<br>        return {<br>            &quot;query&quot;: query,<br>            &quot;results&quot;: results<br>        }<br>    except Exception as e:<br>        return {&quot;error&quot;: f&quot;Failed to perform web search: {str(e)}&quot;}<br><br>if __name__ == &quot;__main__&quot;:<br>    mcp.run(transport=&quot;sse&quot;)</pre><pre># db.py<br>from mcp.server.fastmcp import FastMCP<br>import os<br>from dotenv import load_dotenv<br>import oracledb  <br><br><br>load_dotenv()<br><br># Database connection parameters from environment variables<br>DB_CONFIG = {<br>    &quot;user&quot;: os.getenv(&quot;DB_USER&quot;),<br>    &quot;password&quot;: os.getenv(&quot;DB_PASSWORD&quot;),<br>    &quot;host&quot;: os.getenv(&quot;DB_HOST&quot;),<br>    &quot;port&quot;: int(os.getenv(&quot;DB_PORT&quot;, 1521)),<br>    &quot;service_name&quot;: os.getenv(&quot;DB_SERVICE_NAME&quot;),<br>}<br><br># Create a simple MCP server<br>mcp = FastMCP(&quot;OracleDBServer&quot;,<br>              port=8006,<br>              host=&quot;127.0.0.1&quot;,<br>              debug=True)<br><br>@mcp.tool()<br>async def db_query(query: str):<br>    &quot;&quot;&quot;<br>    Execute a SELECT query on the Oracle database.<br>    Only SELECT queries are allowed for security reasons.<br>    &quot;&quot;&quot;<br>    # This security check<br>    if not query.strip().upper().startswith(&quot;SELECT&quot;):<br>        return {&quot;error&quot;: &quot;Security violation: Only SELECT queries are allowed.&quot;}<br><br>    try:<br>        dsn = f&quot;{DB_CONFIG[&#39;host&#39;]}:{DB_CONFIG[&#39;port&#39;]}/{DB_CONFIG[&#39;service_name&#39;]}&quot;<br>        <br>        conn = oracledb.connect(<br>            user=DB_CONFIG[&quot;user&quot;],<br>            password=DB_CONFIG[&quot;password&quot;],<br>            dsn=dsn<br>        )<br>        <br>        cur = conn.cursor()<br>        cur.execute(query)<br>        rows = cur.fetchall()<br>        <br>        <br>        column_names = [desc[0].lower() for desc in cur.description]<br>        result = [dict(zip(column_names, row)) for row in rows]<br><br>        cur.close()<br>        conn.close()<br>        <br>        return result<br>    <br>    except oracledb.DatabaseError as e:<br>        return {&quot;error&quot;: f&quot;Oracle Database Error: {str(e)}&quot;}<br>    except Exception as e:<br>        return {&quot;error&quot;: f&quot;An unexpected error occurred: {str(e)}&quot;}<br><br><br>if __name__ == &quot;__main__&quot;:<br>    mcp.run(&quot;sse&quot;)</pre><p>You might think this would make the client code complicated, but it’s barely different. Instead of one connection, we just list all four.</p><pre># Client.py<br>import asyncio<br>import os<br>from pathlib import Path<br>from langgraph.prebuilt import create_react_agent<br>from langchain_mcp_adapters.client import MultiServerMCPClient<br>from config import llm<br><br># Create a robust path for the local Math.py server<br>script_dir = Path(__file__).resolve().parent<br>math_server_path = script_dir / &quot;Servers&quot; / &quot;Math.py&quot;<br><br># Instantiate the client<br>client = MultiServerMCPClient({<br>    &quot;math&quot;: {<br>        &quot;command&quot;: &quot;python&quot;,<br>        &quot;args&quot;: [str(math_server_path)],<br>        &quot;transport&quot;: &quot;stdio&quot;,<br>    },<br>    &quot;oracle_db&quot;: {<br>       # Make sure you run &#39;python Weather.py&#39; before starting this client<br>        &quot;url&quot;: &quot;http://127.0.0.1:8006/sse&quot;,<br>        &quot;transport&quot;: &quot;sse&quot;,<br>    },<br>    &quot;weather&quot;: {<br>        # Make sure you run &#39;python Weather.py&#39; before starting this client<br>        &quot;url&quot;: &quot;http://127.0.0.1:8007/sse&quot;,<br>        &quot;transport&quot;: &quot;sse&quot;,<br>    },<br>    &quot;web search&quot;: {<br>        # Make sure you run &#39;python Web.py&#39; before starting this client<br>        &quot;url&quot;: &quot;http://127.0.0.1:8008/sse&quot;,<br>        &quot;transport&quot;: &quot;sse&quot;,<br>    },<br>})<br><br>async def main():<br>    print(&quot;Starting client and connecting to servers...&quot;)<br>    print(&quot;Client is ready.&quot;)<br>    <br>    # Load tools from ALL connected servers at once. This will establish connections.<br>    all_tools = await client.get_tools()<br>    # Create agent<br>    agent = create_react_agent(llm, all_tools)<br>    while True:<br>        print(f&quot;Tools loaded: {[tool.name for tool in all_tools]}&quot;)<br>        user_input = input(&quot;\nEnter your query or \&quot;exit\&quot;,\&quot;quit\&quot;, \&quot;q\&quot; to exit: &quot;)<br>        if user_input.lower() in [&quot;exit&quot;, &quot;quit&quot;, &quot;q&quot;]:<br>            print(&quot;👋 Goodbye!&quot;)<br>            break<br>        <br>        prompt = (f&quot;{user_input} Please provide the final answer in plain text, &quot;<br>                &quot;without using any markdown or LaTeX formatting.&quot;)<br><br>        # Invoke agent and get response<br>        agent_response = await agent.ainvoke({&quot;messages&quot;: [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}]})<br>        print(agent_response)<br>        for message in agent_response[&quot;messages&quot;]:<br>            message.pretty_print()<br><br>if __name__ == &quot;__main__&quot;:<br>    asyncio.run(main())</pre><p>Look at that! The MultiServerMCPClient handles everything. It connects to all the different servers, whether they&#39;re local (stdio) or on a network (sse), and client.get_tools() bundles everything up into a single list for your agent.</p><p>Your agent is now a powerhouse, capable of orchestrating tasks across all these tools without having any of their complex logic inside its own code.</p><h4><em>SSE &amp; Network Communication: The Public Storefront 🌐</em></h4><p><em>This is the communication method you’re likely most familiar with. Instead of a private pipe, a server “listens” on a specific network address, like </em><em>127.0.0.1:8007 (an IP address + port number).</em></p><ul><li><strong><em>How it works:</em></strong><em> The Weather, DB, and Web Search servers are started as independent, standalone processes before the client runs. Each one opens a “storefront” at its public address. Any client on the network that knows the address can send it a message.</em></li><li><strong><em>The key difference:</em></strong><em> Unlike </em><em>stdio, the client doesn&#39;t manage these servers. They are independent services. This means they can be running on a different computer, in a different data center, or anywhere on the internet.</em></li></ul><p><strong><em>Why use it?</em></strong><em> It’s incredibly flexible. It allows you to build your tools as true microservices that can be shared by multiple clients, scaled independently, and hosted anywhere.</em></p><h3>Putting It All Together: A Sample Interaction</h3><p>Here’s a snapshot of what it looks like when you run the MultiServer client and ask it a complex question that requires multiple tools.</p><pre>(.venv) PS C:MultiServer&gt; python .\Client.py<br>Starting client and connecting to servers...<br>Client is ready.<br>Tools loaded: [&#39;add&#39;, &#39;multiply&#39;, &#39;divide&#39;, &#39;power&#39;, &#39;square_root&#39;, &#39;db_query&#39;, &#39;get_weather&#39;, &#39;web_search&#39;]</pre><pre><strong>Enter your query or &quot;exit&quot;,&quot;quit&quot;, &quot;q&quot; to exit: sqrt(9)*3/3+2^3</strong><br>=================== Human Message ===================</pre><pre>sqrt(9)*3/3+2^3 Please provide the final answer in plain text, without using any markdown or LaTeX formatting.<br>=================== Ai Message ===================<br><strong>Tool Calls:</strong><br>  square_root (call_tFVIg4aTJl9Zfce5Mu6rTvsw)<br> Call ID: call_tFVIg4aTJl9Zfce5Mu6rTvsw<br>  Args:<br>    number: 9<br>  power (call_t4N2H7jThhmRH7XRjoNBfcnw)<br> Call ID: call_t4N2H7jThhmRH7XRjoNBfcnw<br>  Args:<br>    base: 2<br>    exponent: 3<br>=================== Tool Message ===================<br>Name: square_root</pre><pre>3.0<br>=================== Tool Message ===================<br>Name: power</pre><pre>8.0<br>=================== Ai Message ===================</pre><pre><strong>The final answer is 11.0.</strong><br>Tools loaded: [&#39;add&#39;, &#39;multiply&#39;, &#39;divide&#39;, &#39;power&#39;, &#39;square_root&#39;, &#39;db_query&#39;, &#39;get_weather&#39;, &#39;web_search&#39;]</pre><pre><strong>Enter your query or &quot;exit&quot;,&quot;quit&quot;, &quot;q&quot; to exit: how many employees are there</strong><br>=================== Human Message ===================</pre><pre>how many employees are there Please provide the final answer in plain text, without using any markdown or LaTeX formatting.<br>=================== Ai Message ===================<br><strong>Tool Calls:</strong><br>  db_query (call_au8aHCfOLGiENjfaeWMeGWAI)<br> Call ID: call_au8aHCfOLGiENjfaeWMeGWAI<br>  Args:<br>    query: SELECT COUNT(*) AS total_employees FROM employees<br>=================== Tool Message ===================<br>Name: db_query</pre><pre>{<br>  &quot;total_employees&quot;: 108<br>}<br>=================== Ai Message ===================</pre><pre><strong>108</strong><br>Tools loaded: [&#39;add&#39;, &#39;multiply&#39;, &#39;divide&#39;, &#39;power&#39;, &#39;square_root&#39;, &#39;db_query&#39;, &#39;get_weather&#39;, &#39;web_search&#39;]</pre><pre><strong>Enter your query or &quot;exit&quot;,&quot;quit&quot;, &quot;q&quot; to exit: how is the weather in Bangalore</strong></pre><pre>=================== Human Message ===================</pre><pre>how is the weather in Bangalore Please provide the final answer in plain text, without using any markdown or LaTeX formatting.<br>=================== Ai Message ===================<br><strong>Tool Calls:</strong><br>  get_weather (call_GCJNDwSi2OEGjgiZ6k3b6Hem)<br> Call ID: call_GCJNDwSi2OEGjgiZ6k3b6Hem<br>  Args:<br>    location: Bangalore<br>=================== Tool Message ===================<br>Name: get_weather</pre><pre>The weather in Bangalore is currently scattered clouds with a temperature of 27.44°C.<br>=================== Ai Message ===================</pre><pre><strong>The weather in Bangalore is currently scattered clouds with a temperature of 27.44 degrees Celsius.</strong><br>Tools loaded: [&#39;add&#39;, &#39;multiply&#39;, &#39;divide&#39;, &#39;power&#39;, &#39;square_root&#39;, &#39;db_query&#39;, &#39;get_weather&#39;, &#39;web_search&#39;]</pre><pre><strong>Enter your query or &quot;exit&quot;,&quot;quit&quot;, &quot;q&quot; to exit: summarize about langchain in 3 sentences</strong><br>=================== Human Message ===================</pre><pre>summarize about langchain in 3 sentences Please provide the final answer in plain text, without using any markdown or LaTeX formatting. <br>=================== Ai Message ===================<br><strong>Tool Calls:</strong><br>  web_search (call_MxyCnHaj2JTPUQhAY0RVaFd8)<br> Call ID: call_MxyCnHaj2JTPUQhAY0RVaFd8<br>  Args:<br>    query: summarize about langchain in 3 sentences<br>=================== Tool Message ===================<br>Name: web_search    <br>=================== Ai Message ===================</pre><pre><strong>LangChain is a framework designed to simplify the development of applications powered by large language models (LLMs). It provides tools and components for managing prompts, chaining multiple LLM calls, and integrating with external data sources like APIs and databases. LangChain is widely used for building chatbots, question-answering systems, and other AI-driven applications.</strong><br>Tools loaded: [&#39;add&#39;, &#39;multiply&#39;, &#39;divide&#39;, &#39;power&#39;, &#39;square_root&#39;, &#39;db_query&#39;, &#39;get_weather&#39;, &#39;web_search&#39;]</pre><pre>Enter your query or &quot;exit&quot;,&quot;quit&quot;, &quot;q&quot; to exit: q<br>👋 Goodbye!</pre><h3>Get the Code</h3><p><a href="https://github.com/Vidya-9791/langchain-mcp-agent-examples">https://github.com/Vidya-9791/langchain-mcp-agent-examples</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=442a66f408b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forget the Installer: Run Oracle DB the Modern Way]]></title>
            <link>https://medium.com/@arnavidya/forget-the-installer-run-oracle-db-the-modern-way-d092a7571438?source=rss-8ce557237ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/d092a7571438</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[oracle]]></category>
            <dc:creator><![CDATA[Vidya Vukanti]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 12:03:45 GMT</pubDate>
            <atom:updated>2025-09-22T12:26:08.774Z</atom:updated>
            <content:encoded><![CDATA[<h4>Your clean Oracle dev environment, ready in minutes</h4><h4>Tired of Lengthy Database Installations?</h4><p>We’ve all been there. You have a new project, and the first hurdle is setting up a local database. You brace yourself for a lengthy installation, hunting for the right drivers, and tweaking config files, all while cluttering your machine with software you’ll only use for one task.</p><p>What if you could skip all that?</p><p>This guide shows you the modern way to get a fully functional Oracle Database running in minutes, not hours. We’ll use Docker to create an isolated, clean, and reproducible environment, complete with the famous HR sample schema. By the end, you’ll be ready to connect your application and start coding.</p><p>Let’s dive in! 🚀</p><figure><img alt="Let Docker handle the heavy lifting for your Oracle database setup" src="https://cdn-images-1.medium.com/max/792/1*43ldIdxs8bq8sKlsm02rKA.png" /></figure><h3>Prerequisites</h3><p>Before we begin, make sure you have the following installed on your machine:</p><ul><li><a href="https://www.docker.com/products/docker-desktop/"><strong>Docker Desktop</strong></a>: The engine that will run our container.</li><li><a href="https://git-scm.com/downloads"><strong>Git</strong></a>: To download the sample schema scripts from GitHub.</li></ul><h3>Step 1: Pull the Oracle Database Docker Image</h3><p>First, we need to get the official Oracle Database Free image from the Oracle Container Registry. Open your terminal (PowerShell, Bash, etc.) and run the following command:</p><pre>docker pull container-registry.oracle.com/database/free:latest</pre><p>This downloads the latest version of the image to your local machine, ready for us to use.</p><h3>Step 2: Launch the Oracle Container</h3><p>This is the most important step. We’ll use the docker run command to create and start our database container. This single command configures everything we need: networking, passwords, and storage.</p><pre>docker run --name Oracle \<br>  -p 1521:1521 \<br>  -e ORACLE_PWD=123456 \<br>  -e ORACLE_PDB=FREEPDB1 \<br>  -v ${PWD}/oracle_data:/opt/oracle/oradata \<br>  container-registry.oracle.com/database/free:latest</pre><p><strong>Note for PowerShell users:</strong> If you are running this in standard PowerShell, replace the backslashes (\) with backticks (`).</p><p>Let’s quickly break down what’s happening here:</p><ul><li>--name Oracle: We&#39;re giving our container a simple, memorable name: Oracle.</li><li>-p 1521:1521: This maps port 1521 on our local machine to port 1521 inside the container. This is how our applications will connect to the database.</li><li>-e ORACLE_PWD=123456: We&#39;re setting the password for the SYS and SYSTEM admin users to 123456. ⚠️ <strong>Warning:</strong> This is a weak password for demonstration purposes only!</li><li>-e ORACLE_PDB=FREEPDB1: This creates a <strong>Pluggable Database (PDB)</strong> named FREEPDB1. This is the actual database instance where our schemas and data will live.</li><li>-v ${PWD}/oracle_data:/opt/oracle/oradata: This is crucial for <strong>data persistence</strong>. It maps a folder named oracle_data in your current directory to the folder where Oracle stores its data files inside the container. This means even if you stop or remove the container, your data will remain safe on your machine.</li><li>Once you run the command, Docker will start the container. The first boot can take a few minutes as Oracle initializes the database. You can check if it’s running and healthy with:</li></ul><pre>docker ps</pre><p>You should see your Oracle container listed with a &quot;healthy&quot; status. ✅</p><h3>Step 3: Download the Oracle Sample Schemas</h3><p>Now that our database is running, we need some data to work with. We’ll download the official Oracle sample schemas (like HR, OE, SH) directly from GitHub.</p><pre>git clone https://github.com/oracle/db-sample-schemas.git</pre><p>This creates a db-sample-schemas folder on your machine containing all the necessary SQL scripts. We&#39;ll be focusing on the human_resources (HR) schema.</p><h3>Step 4: Install the HR Schema</h3><p>To install the schema, we need to copy the script files into our running container and then execute them using sqlplus, Oracle&#39;s command-line tool.</p><p>1. Create a Directory Inside the Container to hold our scripts.</p><pre>docker exec -it Oracle mkdir -p /opt/oracle/sample_schemas</pre><p>2. Copy the human_resources folder from your local machine into the directory we just created inside the container.</p><pre>docker cp ./db-sample-schemas/human_resources Oracle:/opt/oracle/sample_schemas/human_resources</pre><h3>Step 5: Connect to the Database with SQL*Plus</h3><p>Alright, the files are in place. Now it’s time to go “inside” the container and talk directly to the database. Think of docker exec as opening a secure portal right into our Oracle instance.</p><p>The command below connects us as the all-powerful SYS user. The / as sysdba part uses OS authentication, which is a fancy way of saying Oracle trusts us because we&#39;re already the admin of the container—no password needed for this step!</p><pre>docker exec -it Oracle sqlplus / as sysdba</pre><p>Once you hit Enter, you’ll see an Oracle welcome banner, and your prompt will change to <strong>SQL&gt;</strong>. You&#39;re now directly connected to the database.</p><h3>Step 6: Install the HR Schema</h3><p>Inside the SQL&gt; prompt, our first job is to switch from the main database container (the CDB) to our specific pluggable database, FREEPDB1, where our data will live.</p><blockquote><strong><em>Note:</em></strong><em> All the following SQL commands will be run inside this </em><em>SQL&gt; prompt.</em></blockquote><pre>ALTER SESSION SET CONTAINER=FREEPDB1;</pre><p>With our session in the right place, we can now execute the main installation script. This single file handles creating the HR user, building the tables, and populating them with data.</p><pre>@/opt/oracle/sample_schemas/human_resources/hr_main.sql</pre><p>The script will become interactive and prompt you for the following information:</p><ul><li><strong>Password for HR user:</strong> Enter a secure password (e.g., 123456 for dev).</li><li><strong>Tablespace:</strong> Just press <strong>Enter</strong> to accept the default (USERS).</li><li><strong>Temp tablespace:</strong> Press <strong>Enter</strong> again to accept the default (TEMP).</li><li><strong>SYS Password:</strong> Enter the password we set in the docker run command (123456).</li></ul><p>After you provide the inputs, the script will create all the tables and show a verification report with the final row counts. Once it’s finished, disconnect from the database:</p><pre>EXIT;</pre><h3>Step 7: Verify the Installation (The Moment of Truth!)</h3><p>The script says it worked, but let’s prove it. The best way to verify the installation is to log in as the new HR user and query a table.</p><p>Run this command from your regular terminal (not the SQL prompt):</p><pre># Connect as the newly created HR user<br>docker exec -it Oracle sqlplus hr/123456@FREEPDB1</pre><p><em>(Remember to replace </em><em>123456 if you set a different password for the HR user).</em></p><p>Now that you’re connected as HR, run a simple query to see if the data is there:</p><pre>-- Fetch the first 5 employees to confirm data exists<br>SELECT first_name, last_name, salary FROM employees WHERE ROWNUM &lt;= 5;</pre><p>If you see a list of employee names and salaries, then congratulations! Your Oracle Database is fully configured and ready for action. Type EXIT to disconnect.</p><h3>You’re All Set!</h3><p>You now have a powerful, isolated, and easily reproducible Oracle development environment running in Docker. Your database is ready to accept connections from your applications on localhost:1521 using the service name FREEPDB1.</p><p>This clean workflow is perfect for modern development, saving you the time and hassle of traditional installations.</p><p>Happy coding! 💻</p><h3>Further Reading &amp; Official Resources</h3><ul><li><a href="https://www.google.com/search?q=https://container-registry.oracle.com/ords/f%3Fp%3D113:4:14502426996884::::P4_REPOSITORY_NAME,P4_TAGS:database/free,latest"><strong>Oracle Database Free Docker Image</strong></a><strong>:</strong> The official page for the Docker image we used in this guide.</li><li><a href="https://github.com/oracle/db-sample-schemas"><strong>Oracle DB Sample Schemas on GitHub</strong></a><strong>:</strong> The source repository for the HR schema and other sample datasets.</li><li><a href="https://www.google.com/search?q=%5Bhttps://docs.docker.com/engine/reference/commandline/exec/%5D(https://docs.docker.com/engine/reference/commandline/exec/)"><strong>Docker </strong></a><a href="https://www.google.com/search?q=%5Bhttps://docs.docker.com/engine/reference/commandline/exec/%5D(https://docs.docker.com/engine/reference/commandline/exec/)"><strong>exec Command Documentation</strong></a><strong>:</strong> To learn more about how to run commands inside a running container.</li></ul><p>Oracle, Docker, Database, SQL, Development, DevOps, Tutorial</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d092a7571438" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>