Sitemap

Create a simple MCP Server and view it with the Inspector

2 min readApr 4, 2025

--

First, the MCP site provides a way to create a server with Quickstart.

I’m going to create a simpler MCP server than the example above.

from mcp.server.fastmcp import FastMCP

mcp = FastMCP()

@mcp.tool()
def top_song(genre: str) -> str:
top_songs = {
"pop": "Blinding Lights - The Weeknd",
"rock": "Bohemian Rhapsody - Queen",
"jazz": "So What - Miles Davis",
"classical": "Canon in D - Pachelbel",
"hiphop": "SICKO MODE - Travis Scott",
"kpop": "Dynamite - BTS"
}
return top_songs.get(genre, f"No top song found for genre: {genre}")

if __name__ == "__main__":
mcp.run(transport='stdio')

With this code, I have created an MCP server called top_song.

I’ll use the inspector to test that it works well in practice.
The inspector is an outlet for debugging MCP.

To test the code with the Inspector, execute the command.

npx @modelcontextprotocol/inspector uvx uv run /Users/seobs/mcp/song.py
Press enter or click to view image in full size

Now let’s verify that top_song is working.

Get Seobs’s stories in your inbox

Join Medium for free to get updates from this writer.

First, make a connection by pressing the Connect button in the bottom left corner.
After that, navigate to the Tools menu at the top.

Press enter or click to view image in full size

Press List Tools and you’ll see top_song directly below.

At the bottom, you’ll see the results of the call in History, where you can also see detailed data about the Request and Response.

Press enter or click to view image in full size

To run the tool, let’s type pop in gerne on the right and Run Tool.

You can see the Tool Result at the bottom, and you can see the detailed Request and Response in the History.

Press enter or click to view image in full size

In the next article, I’ll try the above top_song on Amazon Bedrock.

--

--