Skip to main content
Glama
akraradets
by akraradets

Boilerplate MCP

This repository follow the tutorial here

From Zero to Hero

There are many resources out there teaching you about MCP. What I have found is it usually an overview, thus too simple.

Anyhow, they are great when you start to learn this new thing.

Hence, I recommend you this series of youtue videos for you to watch.

  1. MCP In 26 Minutes (Model Context Protocol): https://www.youtube.com/watch?v=kOhLoixrJXo

  2. you need to learn MCP RIGHT NOW!! (Model Context Protocol): https://www.youtube.com/watch?v=GuTcle5edjk

They talk about MCP from overview/general use to developing (sort of vibe coding level).

Now, when it comes to an actual developing a MCP server, you will need to do the document reading yourself. The only good place to do that is here: https://modelcontextprotocol.io

This repository

This repository is the boilerplate/template for developing a MCP server. It provides

  1. Resources/steps for learning MCP

  2. A devcontainer/environment setup for MCP server development

Developing tools

FastMCP

link

MCP is a protocol. FastMCP is a framework that helps you build MCP servers quickly which seem to be something else than the MCP SDK and build on top of the idea of FastAPI.

If you know FastAPI, FastMCP is very similar to it.

MCP Inspector

link

MCP Inspector is similar to the Postman for the MCP protocol. It runs via the npx. This repository creates a task. You can spawn MCP Inspector using cmd + shift + P find, Tasks: Run Task, then select RUN MCP Inspector.

Then you can navigator to http://localhost:6274 to get to the MCP Inspect UI.

You can do nothing yet, you will have to run the MCP server first.

Postman

Yes, Postman also support MCP. The feature is locked behind the login. You must login first.

At the day of writing this document, Postman seems to work equally with the MCP Inspector.

MCP Server

link

First, learn terminology of the MCP server.

  • Resources: Expose data through Resources (think of these sort of like GET endpoints; they are used to load information into the LLM's context)

  • Tools: Provide functionality through Tools (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)

  • Prompts: Define interaction patterns through Prompts (reusable templates for LLM interactions)

Stateful VS Stateless

link

One major decision you should be making before deciding to choose the how your MCP server is going to live in the production is Horizontal Scaling. You should read the manual but in a nutshell, FastMCP is a statefull framework. However, if you want to put this behind the loadbalancer, it won't work. (even with the sticky session enabled because LLM does not use cookie) Thus, force you to choose stateless design.

You will lose two MCP features

Transport option

MCP server has three transport options. (1) STDIO (2) Stream HTTP (3) SSE (deprecated)

This boilerplate uses (2) Stream HTTP as we intend for this to be a production ready template.

Running the server

The server will be served with via uvicorn. You can use the vscode task RUN MCP Server which will spawn uvicorn server at 0.0.0.0:8000.

Then you can put in the URL in MCP Inspector as http://localhost:8080/mcp. Make sure to select Transportation Type as Streamable HTTP and Connection Type as Direct.

MCP Client

link

Just like server situation, the client can consume server in a couple of ways.

# In-memory server (ideal for testing) server = FastMCP("TestServer") client = Client(server) # HTTP server client = Client("https://example.com/mcp") # Local Python script client = Client("my_mcp_server.py")

In this repository, we will only focus in using client to connect with HTTP MCP server.

Running the Client

Client is just a normal python file. To run it, simply use uv run python src/client/client.py

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/akraradets/boilerplate-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server