Casablanca Stock Exchange MCP logo

Casablanca Stock Exchange MCP

BVC MCP Server gives AI assistants real-time and historical access to the Casablanca Stock Exchange — covering 80+ listed stocks with live prices, top gainers/losers, volume rankings, and technical indicators (RSI, Bollinger Bands, moving averages). A built-in scheduler automatically collects hourly snapshots during market hours, enabling multi-week historical analysis, price evolution tracking, and stock screening directly from your AI client. Whether you're monitoring Moroccan equities, building watchlists, or running correlation analysis, this server turns Claude or any MCP-compatible assistant into a full-featured BVC trading companion.

mcp
sse
real-time-streaming
+4
|

BVC MCP Server — Real-Time & Historical Casablanca Stock Exchange Data for AI Assistants The BVC MCP Server is a production-ready Model Context Protocol (MCP) server that gives any MCP-compatible AI assistant — Claude, Cursor, LM Studio, or any other client — direct, natural-language access to the Casablanca Stock Exchange (Bourse de Valeurs de Casablanca). Instead of manually checking financial websites or wrestling with raw APIs, you simply ask your AI assistant questions like "What are the top gainers on the BVC today?" or "Show me the RSI for Attijariwafa Bank over the last 14 periods" — and get structured, accurate answers in seconds. What makes this server unique is its dual architecture: a live data layer that fetches real-time market data with a 5-minute cache, and a historical data layer powered by an autonomous background scheduler that automatically collects and persists hourly snapshots to a SQLite database every trading day between 09:00 and 15:30 Casablanca time. This means the longer the server runs, the richer the historical dataset becomes — enabling week-over-week trend analysis, multi-period technical indicators, and performance comparisons that simply aren't possible with live-only data feeds. 33 tools across 6 categories cover every angle of Moroccan equity analysis. The live market tools give you instant access to all 80+ listed stocks with full OHLC data, bid/ask spreads, trading volumes, and real-time variation percentages. The historical tools let you query price evolution over custom date ranges, retrieve volume history, and browse the database snapshot timeline. The technical analysis suite — built entirely in pure Python with zero external dependencies — includes Simple Moving Averages, RSI with Wilder smoothing, Bollinger Bands, annualised volatility from log returns, Pearson correlation between any two stocks, momentum indicators, and support/resistance levels. The market analysis tools provide market breadth indicators (percentage of stocks above their moving average), period performance rankings, and cross-stock correlation analysis. The screening tools let you filter stocks by price range, variation thresholds, or unusual volume spikes — perfect for identifying trading opportunities. Finally, the watchlist management system lets you create, manage, and track named portfolios of BVC stocks, with full performance reporting over any date range. Security and multi-user isolation are built in from the ground up. API keys are never stored in plain text — they are hashed to a 16-character SHA-256 digest before being written to the database, ensuring that each user's watchlists are completely invisible to all other users. All database queries use parameterised SQL with zero string interpolation, making SQL injection attacks impossible. Input validation with regex patterns protects every text parameter, and numeric parameters are clamped to safe bounds to prevent denial-of-service through oversized queries. The server is deployed on Railway with a persistent volume for the SQLite database, ensuring that historical data survives container restarts and accumulates continuously over time. The background scheduler runs as a daemon thread inside the same process as the MCP server, meaning no external cron job or orchestration system is required — everything is self-contained in a single Docker container. The HTTP/SSE transport makes it compatible with any MCP client that supports remote servers, and the /health endpoint provides real-time server status including cache state and latest snapshot ID for monitoring and uptime tracking. Whether you are a retail investor tracking Moroccan equities, a financial analyst building automated market reports, or a developer integrating BVC data into an AI-powered application, the BVC MCP Server gives you the most comprehensive programmatic access to Casablanca Stock Exchange data available today — all accessible through natural language, with no API keys, no complex authentication, and no financial data subscription required.

Updated Apr 8, 2026