<?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: Sumanth B R</title>
    <description>The latest articles on DEV Community by Sumanth B R (@sumanthbr).</description>
    <link>https://dev.to/sumanthbr</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F157615%2F0e288ed1-4ca6-4480-b5ce-578e03a00732.png</url>
      <title>DEV Community: Sumanth B R</title>
      <link>https://dev.to/sumanthbr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sumanthbr"/>
    <language>en</language>
    <item>
      <title>From Localhost to Production: A Guide to Remote Model Context Protocol (MCP) Servers</title>
      <dc:creator>Sumanth B R</dc:creator>
      <pubDate>Tue, 01 Jul 2025 06:39:47 +0000</pubDate>
      <link>https://dev.to/sumanthbr/from-localhost-to-production-a-guide-to-remote-model-context-protocol-mcp-servers-527b</link>
      <guid>https://dev.to/sumanthbr/from-localhost-to-production-a-guide-to-remote-model-context-protocol-mcp-servers-527b</guid>
      <description>&lt;p&gt;As AI developers, we’re rapidly moving toward building more sophisticated multi-agent systems. But to make them work well, it’s not just about making smarter agents — it’s about getting them to share a common understanding of the world. That’s where the &lt;strong&gt;Model Context Protocol (MCP)&lt;/strong&gt; comes in: an emerging standard that acts as a universal connector, enabling agents to access tools and data in a consistent, scalable way.&lt;/p&gt;

&lt;p&gt;When I started building with MCP for a work project, I hit a wall. Most tutorials focus on local MCP servers communicating over STDIN/STDOUT, which is great for prototyping. But I needed a &lt;strong&gt;remote MCP server&lt;/strong&gt;, something robust and production-ready that could run on Kubernetes. Unfortunately, good resources were scarce.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond APIs: Why MCP Matters in an Agentic World
&lt;/h2&gt;

&lt;p&gt;For decades, APIs have been the standard way systems talk to each other. Developers read docs, authenticate, and write custom code to integrate services. But that doesn’t scale when agents need to autonomously interact with dozens or hundreds of tools.&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.amazonaws.com%2Fuploads%2Farticles%2Fl6e3qp03fxmd8txl2qqq.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.amazonaws.com%2Fuploads%2Farticles%2Fl6e3qp03fxmd8txl2qqq.png" alt="API" width="610" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MCP offers a &lt;strong&gt;paradigm shift&lt;/strong&gt;. It provides a standardized protocol—a common language—that lets tools present themselves to agents in a predictable way. Instead of agents learning how every API works, &lt;strong&gt;tools learn to speak MCP&lt;/strong&gt;. This makes the integration layer simpler, smarter, and scalable.&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.amazonaws.com%2Fuploads%2Farticles%2F3ly56z8dyv8qb30p404q.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.amazonaws.com%2Fuploads%2Farticles%2F3ly56z8dyv8qb30p404q.png" alt="MCP" width="611" height="697"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Code &amp;amp; Deployment Blueprint
&lt;/h2&gt;

&lt;p&gt;Here’s a high-level overview of what goes into building and deploying a remote MCP server:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Python Server with FastMCP
&lt;/h3&gt;

&lt;p&gt;Use &lt;a href="https://gofastmcp.com/getting-started/welcome" rel="noopener noreferrer"&gt;FastMCP&lt;/a&gt; (a FastAPI-based server) to define your MCP tool schema and expose context via HTTP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# mcp_joke_server.py
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastmcp&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;MCPTool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;create_app&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JokeTool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MCPTool&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;describe_context&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;joke&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Why did the server cross the road?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;JokeTool&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Dockerfile for Containerization
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; python:3.11-slim&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . /app&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;fastmcp uvicorn
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["uvicorn", "mcp_joke_server:app", "--host", "0.0.0.0", "--port", "8000"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;🔥 &lt;strong&gt;Important&lt;/strong&gt;: The &lt;code&gt;--host 0.0.0.0&lt;/code&gt; flag is essential. Binding to &lt;code&gt;127.0.0.1&lt;/code&gt; (the default) will make your service inaccessible from outside the container.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  3. Kubernetes Manifests
&lt;/h3&gt;

&lt;p&gt;Here’s a simplified example of the Ingress manifest with the required settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;networking.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Ingress&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-joke-ingress&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;nginx.ingress.kubernetes.io/proxy-buffering&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;off"&lt;/span&gt;
    &lt;span class="na"&gt;nginx.ingress.kubernetes.io/proxy-read-timeout&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3600"&lt;/span&gt;
    &lt;span class="na"&gt;nginx.ingress.kubernetes.io/proxy-send-timeout&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3600"&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;joke-tool.example.com&lt;/span&gt;
    &lt;span class="na"&gt;http&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
        &lt;span class="na"&gt;pathType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Prefix&lt;/span&gt;
        &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-joke-service&lt;/span&gt;
            &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;number&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;✅ &lt;strong&gt;Tip&lt;/strong&gt;: Disabling proxy buffering and extending timeouts is critical for supporting MCP's streamable HTTP mode. Without these, the connection will hang or timeout prematurely.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Lessons from the Trenches
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Binding to &lt;code&gt;0.0.0.0&lt;/code&gt; is Non-Negotiable
&lt;/h3&gt;

&lt;p&gt;Inside Docker or Kubernetes, binding to localhost means only the container can talk to itself. External traffic (even from other pods) won't reach it. Always bind your app to &lt;code&gt;0.0.0.0&lt;/code&gt; to make it network-accessible.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Streamable HTTP is Not Plug-and-Play
&lt;/h3&gt;

&lt;p&gt;MCP relies on long-lived JSON-RPC-over-HTTP connections. Many HTTP servers and proxies aren't tuned for this. The Nginx Ingress Controller in particular &lt;strong&gt;buffers responses by default&lt;/strong&gt;, breaking stream behavior. You have to explicitly disable buffering and increase timeouts.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Debugging Ingress is Half the Battle
&lt;/h3&gt;

&lt;p&gt;Expect to spend a fair amount of time tweaking your Ingress config. Tools like &lt;code&gt;kubectl logs&lt;/code&gt; and &lt;code&gt;curl -v&lt;/code&gt; are invaluable here.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. FastMCP Just Works (Mostly)
&lt;/h3&gt;

&lt;p&gt;Despite the learning curve, FastMCP does a lot of heavy lifting for you. Schema validation, async support, and streamable connections are all baked in.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Security Frontier
&lt;/h2&gt;

&lt;p&gt;One of the most important (and still under-documented) areas of MCP is &lt;strong&gt;security&lt;/strong&gt;. By design, MCP endpoints are open by default. That’s great for rapid development, but risky in production.&lt;/p&gt;

&lt;p&gt;Open questions that deserve attention:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How should agents authenticate to MCP servers?&lt;/li&gt;
&lt;li&gt;What does fine-grained permissioning look like?&lt;/li&gt;
&lt;li&gt;How should we manage secrets (e.g., API keys for underlying tools)?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This space is evolving, and it’s exciting to be part of the conversation. I recommend following the &lt;a href="https://github.com/modelcontextprotocol" rel="noopener noreferrer"&gt;Model Context Protocol GitHub&lt;/a&gt; for updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;The Model Context Protocol is an essential piece of the puzzle for building powerful agentic systems. Going from a local script to a networked Kubernetes service can be tricky, but it’s absolutely doable.&lt;/p&gt;

&lt;p&gt;By embracing the principles of standardization, streamability, and security, we can build MCP servers that are not only production-grade but also future-ready.&lt;/p&gt;

&lt;p&gt;If you're exploring this space or have your own MCP lessons, I'd love to connect.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>agenticai</category>
      <category>genai</category>
      <category>remotemcpserver</category>
    </item>
  </channel>
</rss>
