Model Context Protocol (MCP) Servers For The Absolute Beginner



This content originally appeared on DEV Community and was authored by Michael Levan

Anything AI is moving incredibly fast. Just roughly one year ago, everyone was talking about RAG and how fine-tuning was the correct approach to ensuring that the Model you’re using has the data it needs.

Now, it’s all MCP (even though MCP is roughly 6 or so months old).

Whenever anything new comes out from a “tech perspective”, there are a lot of moving parts. One person says “this is the de facto method for using X technology” and then within a few months, the de facto method changes. It comes with the territory of new tools and platforms.

In this blog, you’ll get a quick breakdown of the timeline that led us to MCP and why it’s important.

Why “Training” Matters

Every Model, whether it’s from OpenAI, Claude, Google, or wherever else, is trained based on particular data. This data comes in the form of primarily books and “whatever is on the internet” that it’s allowed to use. A good example of this is StackOverflow forums.

The “data” is a collected of data sets that are used to train said Models.

The problem is that the data isn’t specific, it’s very general, which doesn’t give the “exact” information necessary. That’s why you can use a Model for some AI-generated code and it’s possible you’ll get good results, but it’s also possible you’ll get not-so-great results.

Training Models in a particular way or taking a Model that already exists and training it with data that you need it to have (RAG, fine-tuning, etc.) is drastically important to get the results that you and perhaps even your organization are expecting.

The timeline to ensure that the data and the responses from said data are accurate has come in 3 waves so far:

  1. Training Models
  2. Fine-tuning and RAG
  3. MCP

Training Models

First, everyone was thinking about how to train Models and a lot of large organizations are still doing this including:

  1. Microsoft
  2. Google
  3. OpenAI

And even some smaller organizations like Anthropic (as long as they have the right funding).

The reason that every company both big and small aren’t training Models is because it’s very expensive. It costs millions of dollars to train a Model. Because of that, not every organization has the funds to train Models and even if they do, it’s entirely possible that they simply want to use a Model that already exists because they aren’t in the business of “AI”, they’re just users of AI.

Training a Model consists of having a collection of data sets, running those data sets through ML tooling to train the data and then eventually, all of those data sets are “combined” and turned into a Model.

Fine-Tuning and RAG

As mentioned in the previous section, organizations want to use AI, but not every organization wants to spend millions of dollars to do so. However, on the flipside, those organizations still need specific output from the AI tooling that they use.

That’s why fine-tuning and RAGs were created.

Fine-tuning a Model takes an existing Model and trains it on particular data sets, which are usually much smaller. Retrieval Augmented Generation (RAG) allows you to connect the LLM you’re using (at the time of using it/at runtime) to external sources. For example, you can create a RAG within an application to call out to documentation and blog posts.

Something like a RAG is great, but the problem is it’s application-centric. What that means is you create a RAG and you’re using it within one application stack. That means if you want to take it and use it in another application stack, that’s a lot of refactoring various code bases.

Instead, people wanted a method of calling out to specific data that they wanted to use within an application or a system (like a Kubernetes cluster) without refactoring a code base to implement a RAG.

That’s where MCP comes into play.

Enter MCP

Model Context Protocol (MCP) is, as the name suggests, a specific context (the data that’s needed for what you’re trying to do) in one central location. The term “MCP Server” has caught traction, but not because it’s an actual server running (although, some MCPs are like that), but because MCP uses a client/server architecture.

MCP is nothing more than a specific “server” (written as an application) that calls out to specific data.

One example that pops up on Google if you search “How to create an MCP server” is a Weather app, and it’s quite good.

  1. Use an MCP generator via the MCP Python package.
  2. Call out to a specific API (in this case, a Weather API) to get data.
  3. Take the data that’s collected via the specific API and use it as a response to the user that’s calling upon the MCP server.
    @mcp.tool
    def get_weather(location: str) -> str:
        """Gets the current weather for a given location."""
        NWS_API_BASE = "https://api.weather.gov"
        USER_AGENT = "weather-app/1.0"
        try:
            response = httpx.get(
                f"{NWS_API_BASE}/points/{location}",
                headers={"User-Agent": USER_AGENT},
            )
            response.raise_for_status()
            data = response.json()
            forecast_url = data["properties"]["forecast"]
            forecast_response = httpx.get(forecast_url, headers={"User-Agent": USER_AGENT})
            forecast_response.raise_for_status()
            forecast_data = forecast_response.json()
            return forecast_data["properties"]["periods"]["shortForecast"]
        except httpx.RequestError as e:
            return f"Error fetching weather data: {e}"
        except (KeyError, IndexError) as e:
            return f"Error parsing weather data: {e}"

If you’re writing a client to use/connect to an MCP “server”, the MCP server could simply be a package.

    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            tools_result = await session.list_tools()
            print("Available tools:", [tool.name for tool in tools_result.tools])

        session.call_tool("tool_name", arguments={})

Here’s an MCP Server for EKS that’s quite literally a Python pip package: https://pypi.org/project/awslabs.eks-mcp-server/

You can call the package and use it in your client by either having the package locally via JSON or embedding it within your client.

{
    "mcpServers": {
        "awslabs.eks-mcp-server": {
            "command": "uvx",
            "args": [
                "awslabs.eks-mcp-server",
                "--allow-write"
            ],
            "env": {
                "AWS_PROFILE": "default",
                "AWS_REGION": "us-west-2",
                "FASTMCP_LOG_LEVEL": "INFO"
            }
        }
    }
}
    server_params = StdioServerParameters(
        command="uvx",
        args=["awslabs.eks-mcp-server", "--allow-write"],
        env={
            "AWS_PROFILE": "default",
            "AWS_REGION": "us-west-2",
            "FASTMCP_LOG_LEVEL": "INFO"
        }
    )

Here’s a great post on Reddit from Anthropic using the MCP Framework that they created: https://www.reddit.com/r/ClaudeAI/comments/1hoafi1/introducing_mcpframework_build_a_mcp_server_in_5/

If you want a video-centric breakdown on MCP, here’s one I recently created.

https://www.youtube.com/watch?v=jNWyB06XJgE


This content originally appeared on DEV Community and was authored by Michael Levan