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.
mkdir mcp-coingecko && cd mcp-coingecko
python -m venv venv && source venv/bin/activate
pip install mcp httpx
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())
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.
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.
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.
No. Many servers are one-command installs. Beginners start with Filesystem or Brave Search in under 5 minutes.
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.
Yes when using official registry servers. They run with explicit, scoped permissions. Always review source for custom servers.