Many developers already expose useful functionality via REST APIs. The Model Context Protocol (MCP) enables making those existing capabilities available to AI clients without rewriting the underlying application logic.
In an episode of Zero to Agent in 30 Minutes, Bruce Hopkins — an AI developer, author, and longtime software educator — demonstrates how to build an MCP server around an existing API. His demo wraps the Twelve Data stock-data REST API with an MCP server so an MCP client can call its services.
From REST API to MCP, step by step
- Start with an existing API
- Identify which operations and data you want an AI client to access. The demo uses the Twelve Data API to retrieve current and historical stock prices.
- Create an MCP server
- Use an MCP SDK to create a layer between the AI client and your existing application logic. In Bruce’s Python example, FastMCP handles the MCP interface while the stock-data functions remain separate.
- Expose capabilities as tools and resources
- Register the operations the client should be able to discover and call. In the demo, stock-price data is exposed through MCP resources and tools that reuse the same underlying functions.
- Describe how the client should use them
- Define clear names, inputs, descriptions, and prompts so the client understands what each capability does and what information it requires. The example includes prompts for current prices, historical prices, and expected symbol and date formats.
- Connect the server to an MCP client
- Run the server over a supported transport so the client can discover and invoke its tools and resources.
Why this matters
You do not need to replace systems that already implement your application logic to make them usable by agents. Adding an MCP interface around existing capabilities provides a standardized way for AI clients to discover and use those capabilities.
Code and what’s next
Bruce Hopkins’s GitHub repository contains working code you can adapt for your own APIs. Next week, AI engineer Sajal Sharma returns to Zero to Agent in 30 Minutes to build a personal assistant on OpenClaw; he will show how an agent can keep tasks and notes in Markdown, run proactive automations, and deliver scheduled updates such as a regular morning briefing.
Follow Zero to Agent in 30 Minutes on Radar, or watch the latest episode on YouTube, Spotify, Apple, or other podcast platforms. O’Reilly members can watch live.
Author
This article is by Michelle Smith.



