Ever wished you could just chat with your trading platform and get it to do the heavy lifting—like fetching stock prices or placing orders? That’s where the Model Context Protocol (MCP) comes in, and I’m here to break it down for you in simple words. I’ll also share how I connected MCP with OpenAlgo (a Flask-based algo-trading platform) to let Claude Desktop fetch quotes and place orders for me. Stick with me—this is a game-changer!
What’s MCP, and Why Should You Care?
Imagine telling your computer, “Hey, get me the current price of Reliance,” or “Place a buy order for 10 shares of Zomato,” and it just does it—no complicated coding needed. MCP makes this possible! It’s a tool created by Anthorpic that lets apps like Claude Desktop, Cursor, Windsurf or any other AI tools talk to trading platforms (or any other application/database) using plain English.
Here’s the magic: MCP acts like a translator between you, Claude, and your trading platform. You say something, Claude understands it, and MCP tells your platform what to do—like fetching a stock quote or placing an order. For traders like us, this means less time messing with APIs and more time focusing on the market.
How Does MCP Work? A Simple Picture
Let’s look at a diagram to make this crystal clear:

This picture shows how MCP works at its core:
- Your Computer: This is where everything happens.
- Host (Claude Desktop): Claude is the “host” app that talks to MCP servers.
- MCP Servers: These are like little helpers you create. They connect to different data sources—like your trading platform (OpenAlgo in my case).
- Data Sources: These can be local (like a database on your computer) or online (like OpenAlgo’s server via the internet).
Claude uses MCP to chat with these servers, which then grab data or perform actions for you. Here’s another diagram that breaks it down further:

This one shows the pieces inside MCP:
- MCP Client: This lives inside Claude and sends your requests.
- MCP Server: This is the helper you set up to talk to your trading platform.
- Tools: These are the actions your server can do—like placing an order or getting a quote.
- Transport Layers: This is how Claude and the server talk (like over the internet or directly on your computer).
How I Connected MCP with OpenAlgo
I use OpenAlgo, a Flask-based trading platform, and wanted Claude Desktop to fetch quotes and place orders for me. Here’s how I did it, step-by-step:
- Setting Up My MCP Server: I wrote a simple Python script (mcp-openalgo.py) to create an MCP server that connects to OpenAlgo. Here’s the code:
from mcp.server.fastmcp import FastMCP
from openalgo import api
from dotenv import load_dotenv
import os
# Load my API key from a .env file
load_dotenv()
api_key = os.getenv("OPENALGO_API_KEY")
client = api(api_key=api_key, host='http://127.0.0.1:5000') # My local OpenAlgo server
# Create an MCP server called "openalgo"
mcp = FastMCP("openalgo")
# Tool to place an order
@mcp.tool()
def place_order(symbol: str, quantity: int, action: str, exchange: str = "NSE", price_type: str = "MARKET", product: str = "MIS", strategy: str = "Python") -> str:
try:
response = client.placeorder(
strategy=strategy,
symbol=symbol.upper(),
action=action.upper(),
exchange=exchange.upper(),
price_type=price_type.upper(),
product=product.upper(),
quantity=quantity
)
order_id = response.get("orderid", "Unknown ID")
status = response.get("status", "Unknown")
return f"Order placed successfully: Order ID {order_id}" if status.lower() == "success" else f"Order failed: {status}"
except Exception as e:
return f"Error placing order: {str(e)}"
# Tool to get a stock quote
@mcp.tool()
def get_quote(symbol: str, exchange: str = "NSE") -> str:
try:
quote = client.quotes(symbol=symbol.upper(), exchange=exchange.upper())
return f"Quote for {symbol}: {quote}"
except Exception as e:
return f"Error: {str(e)}"
if __name__ == "__main__":
mcp.run(transport='stdio')
This script creates a server named openalgo with two tools: place_order to buy or sell stocks and get_quote to fetch current prices from OpenAlgo.
Telling Claude Where to Find My Server: I set up Claude Desktop to connect to my server by adding a configuration file (claude_desktop_config.json) in %APPDATA%\Claude\. Here’s what it looks like:

{
"mcpServers": {
"openalgo": {
"command": "D:\\Python\\openalgo-ami25\\venv\\Scripts\\python.exe",
"args": [
"D:\\Python\\openalgo-ami25\\mcp-server\\mcp-openalgo.py"
]
}
}
}
- This tells Claude to run my script using Python from my virtual environment.
- Chatting with Claude: Once set up, I could say things like:
- “Use the openalgo server to get_quote with RELIANCE.” Claude fetched the price: ₹1247.90 for Reliance, along with other details like the day’s high and low.
- “Use the openalgo server to place_order with RELIANCE, 10, BUY.” It placed a market order on NSE and gave me an order ID.

Why MCP is Awesome for Traders
MCP makes trading feel like a conversation:
- No Coding Needed: Just tell Claude what you want—like fetching Reliance’s price or buying Zomato shares.
- Quick Actions: Place orders or get quotes in seconds without navigating a trading app.
- Customizable: I set defaults like NSE and MARKET orders to match my trading style.
- Scalable: I can add more tools—like fetching historical data—to analyze trends.
Try It Out!
Want to chat with your trading platform? Grab the MCP SDK with pip install mcp, check out the basics at modelcontextprotocol.io, and set up your own server. With MCP, OpenAlgo, and Claude, trading has never been this easy—let’s talk our way to better trades! Got questions? Hit me up in the comments!