How to Build Your Own MCP Server in 30 Minutes

Published August 2026 • 9 min read • Target keyword: build MCP server

While hundreds of MCP servers already exist, the real power comes from writing your own. In this tutorial you will build a fully functional MCP server that connects an AI agent to the CoinGecko API for real-time crypto prices — perfect for trading bots and portfolio trackers.

Project Setup

mkdir mcp-coingecko && cd mcp-coingecko
python -m venv venv && source venv/bin/activate
pip install mcp httpx

Core Server Code (server.py)

from mcp.server import Server
from mcp.types import Tool, TextContent
import httpx
import asyncio

server = Server("coingecko-mcp")

@server.list_tools()
async def list_tools():
    return [
        Tool(
            name="get_crypto_price",
            description="Get current price of any cryptocurrency",
            inputSchema={
                "type": "object",
                "properties": {
                    "coin_id": {"type": "string", "description": "CoinGecko coin ID (bitcoin, ethereum, etc.)"}
                },
                "required": ["coin_id"]
            }
        )
    ]

@server.call_tool()
async def call_tool(name, arguments):
    if name == "get_crypto_price":
        coin = arguments["coin_id"]
        async with httpx.AsyncClient() as client:
            r = await client.get(f"https://api.coingecko.com/api/v3/simple/price?ids={coin}&vs_currencies=usd")
            data = r.json()
            price = data.get(coin, {}).get("usd", "N/A")
            return [TextContent(type="text", text=f"Current {coin} price: ${price}")]
    return [TextContent(type="text", text="Unknown tool")]

if __name__ == "__main__":
    asyncio.run(server.run())

Testing Locally

Run the server with python server.py. Then in Claude Code or Codex add it as a local MCP server pointing to the script. Test the tool by asking your agent for the current Bitcoin price.

Publishing to the Registry

1. Push your repo to GitHub.
2. Add a proper README with install instructions.
3. Submit a PR to the official mcp-servers repository or use the registry submission form at mcp.dev/registry.

Need inspiration? See our other MCP articles

5 MCP Servers That Replace Expensive SaaS →

FAQ

What is MCP and why should I care in 2026?

MCP is the emerging standard that lets AI models connect securely to external tools and data sources. It is quickly becoming essential for production AI agents.

Do I need coding experience to use MCP servers?

No. Many servers are one-command installs. Beginners start with Filesystem or Brave Search in under 5 minutes.

How does MCP help with making money using AI?

MCP turns LLMs into autonomous agents that can read files, search the web, manage repos, and query databases — exactly what is needed for automated trading, SEO, and lead gen systems.

Is MCP safe to run on my machine?

Yes when using official registry servers. They run with explicit, scoped permissions. Always review source for custom servers.