Morocco Open Data MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Morocco Open Data MCP What is the current USD/MAD exchange rate?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π²π¦ Morocco Open Data MCP Server
A comprehensive Model Context Protocol (MCP) server providing unified access to Moroccan government data sources, financial markets, geographic information, and more.
π Table of Contents
Related MCP server: GovUK MCP Server
β¨ Features
ποΈ National Open Data
Access to data.gov.ma - Morocco's national open data portal
Search datasets in Arabic, French, and English
Browse by organization, tags, and categories
Download resources in various formats (CSV, JSON, XML, etc.)
π° Financial & Macroeconomic Data
Bank Al-Maghrib (Central Bank)
Exchange rates (daily updates)
Key interest rates and monetary policy
Inflation and consumer price indices
Money supply aggregates (M1, M2, M3)
Treasury bills auction results
Foreign reserves data
Casablanca Stock Exchange (BVC)
Real-time stock quotes
Market indices (MASI, MASIX, etc.)
Company information and financials
Government and corporate bonds
Market statistics and trading data
π International Data
World Bank Indicators
GDP and economic growth
Population and demographics
Poverty and social indicators
Trade and balance of payments
Environmental statistics
π Islamic Services
Prayer times for all major Moroccan cities
Weekly and monthly prayer schedules
Qibla direction calculations
Hijri calendar integration
πΊοΈ Geography & GIS
Administrative divisions (12 regions)
City coordinates and metadata
Searchable city database
Regional information in multiple languages
π€ Humanitarian & Crisis Data
Humanitarian Data Exchange (HDX) integration
Emergency response datasets
Refugee and displacement data
Health and education statistics
π± Climate & Environment
Climate data and weather patterns
Environmental indicators
CO2 emissions tracking
Renewable energy statistics
π Quick Start
Prerequisites
Node.js 18.0 or higher
npm or yarn
Claude Desktop (for MCP integration)
1. Clone the Repository
cd "MoroccoOpenData MCP"2. Install Dependencies
npm install3. Build the Server
npm run build4. Configure Environment
cp .env.example .env
# Edit .env and add your API keys5. Test the Server
npm test6. Run the Server
# Development mode (with hot reload)
npm run dev
# Production mode
npm startπ¦ Installation
Using npm
npm install -g morocco-open-data-mcpFrom Source
git clone https://github.com/kcbdev/morocco-open-data-mcp.git
cd morocco-open-data-mcp
npm install
npm run buildUsing Docker
# Build the image
docker build -t morocco-open-data-mcp .
# Run the container
docker run -d \
--name morocco-mcp \
-e MCP_TRANSPORT=http \
-e MCP_PORT=3000 \
-e BAM_KEY_CHANGES=your_key \
morocco-open-data-mcpUsing Docker Compose
# Create .env file with your API keys
cp .env.example .env
# Start all services
docker-compose up -d
# View logs
docker-compose logs -fβοΈ Configuration
Environment Variables
Variable | Description | Default |
| Transport mode: |
|
| HTTP server port (when using HTTP transport) |
|
| HTTP server host |
|
| Bank Al-Maghrib API key for exchange rates | Required for BAM data |
| BAM API key for government obligations | Required for obligations |
| BAM API key for treasury bills | Required for T-bills |
| World Bank API key | Optional (some endpoints) |
| ACLED API key for crisis data | Optional |
| OpenWeatherMap API key | Optional |
| Default cache TTL (seconds) | 3600 |
| Short-term cache TTL (seconds) | 300 |
| Long-term cache TTL (seconds) | 86400 |
| Default rate limit (req/min) | 60 |
| Strict rate limit (req/min) | 10 |
Claude Desktop Configuration
Add to your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
For Local Development (stdio transport):
{
"mcpServers": {
"morocco-open-data": {
"command": "node",
"args": ["/home/kcb/Work/LABS/MOPD/MoroccoOpenData MCP/dist/index.js"],
"env": {
"BAM_KEY_CHANGES": "your_key_here",
"BAM_KEY_OBLIGATIONS": "your_key_here",
"BAM_KEY_TBILLS": "your_key_here"
}
}
}
}For Remote Server (HTTP SSE transport):
{
"mcpServers": {
"morocco-open-data": {
"url": "https://morocco-opendata-mcp.kcb.ma",
"transportType": "sse"
}
}
}Using mcp-remote:
{
"mcpServers": {
"morocco-open-data": {
"command": "npx",
"args": ["-y", "mcp-remote@latest"],
"env": {
"MCP_SERVER_URL": "https://morocco-opendata-mcp.kcb.ma/sse"
}
}
}
}π οΈ Available Tools
Open Data (data.gov.ma)
Tool | Description |
| Search for datasets on Morocco's open data portal |
| Get detailed information about a specific dataset |
| List all data-publishing organizations |
| Search datasets by tag |
Financial & Macroeconomic
Tool | Description |
| Get current exchange rates from Bank Al-Maghrib |
| Get key interest rates and monetary policy rates |
| Get inflation and CPI data |
| Get money supply aggregates (M1, M2, M3) |
| Get treasury bills auction results |
| Get World Bank development indicators |
| Get comprehensive economic summary |
Capital Markets
Tool | Description |
| Get stock quotes from Casablanca Stock Exchange |
| Get today's market summary |
| Get market indices (MASI, MASIX, etc.) |
| Get government and corporate bond quotes |
| Get detailed company information |
Geography & GIS
Tool | Description |
| Get all administrative regions of Morocco |
| Get coordinates for Moroccan cities |
| Search for cities by name or region |
Prayer Times
Tool | Description |
| Get prayer times for a specific date |
| Get prayer times for the next 7 days |
| Get the next upcoming prayer time |
| List all available Moroccan cities |
Humanitarian & Crisis
Tool | Description |
| Search humanitarian datasets from HDX |
Climate & Environment
Tool | Description |
| Get climate and weather data |
| Get environmental indicators (CO2, renewable energy, etc.) |
Knowledge Graph
Tool | Description |
| Search the Morocco knowledge graph |
| Get list of all available data sources |
π Usage Examples
Example 1: Search for Economic Datasets
Search for datasets about Morocco's economy on data.gov.maExample 2: Get Current Exchange Rates
What's the current exchange rate for EUR to MAD?
Show me all exchange rates from Bank Al-MaghribExample 3: Stock Market Information
Get me the current stock price for Attijariwafa Bank
Show me today's market summary from Casablanca Stock Exchange
What are the top gainers today?Example 4: Prayer Times
What are the prayer times for today in Marrakech?
When is the next prayer in Rabat?
Show me the weekly prayer schedule for CasablancaExample 5: Economic Indicators
Get Morocco's GDP growth rate for the last 5 years
Show me the current inflation rate
What's the unemployment rate in Morocco?Example 6: Geographic Data
List all regions of Morocco with their capitals
What are the coordinates of Fes?
Search for cities in the Souss-Massa regionπ Data Sources
Tier 1 - Native REST APIs
Source | Type | Status |
data.gov.ma | CKAN API | β Active |
Bank Al-Maghrib | REST API | β Active |
Casablanca Stock Exchange | REST API | β Active |
World Bank | REST API | β Active |
Aladhan (Prayer Times) | REST API | β Active |
Tier 2 - Structured Downloads
Source | Type | Status |
HCP (High Commission for Planning) | Portal | π Pending |
Ministry of Economy & Finance | Portal | π Pending |
Ministry of Health | Portal | π Pending |
Tier 3 - International Sources
Source | Type | Status |
Humanitarian Data Exchange | API | π Pending |
ACLED (Crisis Data) | API | π Pending |
OpenWeatherMap | API | π Pending |
π’ Deployment
Production Deployment with Docker
Build the production image:
docker build -t morocco-open-data-mcp:latest --target production .Run with environment variables:
docker run -d \
--name morocco-mcp \
--restart unless-stopped \
-e NODE_ENV=production \
-e MCP_TRANSPORT=http \
-e MCP_PORT=3000 \
-e BAM_KEY_CHANGES=your_key \
-e BAM_KEY_OBLIGATIONS=your_key \
-e BAM_KEY_TBILLS=your_key \
-e CACHE_TTL_DEFAULT=3600 \
-e RATE_LIMIT_DEFAULT=60 \
morocco-open-data-mcp:latestMonitor the container:
docker logs -f morocco-mcp
docker stats morocco-mcpCoolify Deployment
For deployment on Coolify (https://coolify.kcb.ma):
Create new resource from Git repository
Repository: https://github.com/kcbdev/morocco-open-data-mcp
Branch: main
Domain: morocco-opendata-mcp.kcb.ma
Environment Variables:
MCP_TRANSPORT=http MCP_PORT=3000 MCP_HOST=0.0.0.0 NODE_ENV=production BAM_KEY_CHANGES=your_key BAM_KEY_OBLIGATIONS=your_key BAM_KEY_TBILLS=your_key
Kubernetes Deployment (Optional)
apiVersion: apps/v1
kind: Deployment
metadata:
name: morocco-mcp
spec:
replicas: 3
selector:
matchLabels:
app: morocco-mcp
template:
metadata:
labels:
app: morocco-mcp
spec:
containers:
- name: mcp-server
image: ghcr.io/kcbdev/morocco-open-data-mcp:latest
env:
- name: NODE_ENV
value: "production"
- name: MCP_TRANSPORT
value: "http"
- name: BAM_KEY_CHANGES
valueFrom:
secretKeyRef:
name: mcp-secrets
key: bam-key-changes
resources:
limits:
cpu: "1"
memory: "512Mi"
requests:
cpu: "250m"
memory: "128Mi"π¨βπ» Development
Project Structure
morocco-open-data-mcp/
βββ src/
β βββ clients/ # API clients for each data source
β β βββ ckan.ts # data.gov.ma client
β β βββ bam.ts # Bank Al-Maghrib client
β β βββ worldbank.ts # World Bank client
β β βββ bvc.ts # Casablanca Stock Exchange client
β β βββ prayer.ts # Prayer times client
β β βββ geo.ts # Geography/GIS client
β β βββ hdx.ts # Humanitarian Data Exchange client
β β βββ weather.ts # Weather API client
β βββ lib/ # Core utilities
β β βββ cache.ts # Caching layer
β β βββ rateLimiter.ts # Rate limiting
β β βββ arabic.ts # Arabic text processing
β β βββ errors.ts # Error handling
β βββ sync/ # Data synchronization jobs
β βββ index.ts # Main server entry point
β βββ test.ts # Test suite
βββ package.json
βββ tsconfig.json
βββ Dockerfile
βββ docker-compose.yml
βββ claude_desktop_config.json
βββ README.mdDevelopment Commands
# Install dependencies
npm install
# Run in development mode with hot reload
npm run dev
# Build for production
npm run build
# Run tests
npm test
# Run sync jobs manually
npm run sync
# Start production server
npm startRunning Tests
# Run all tests
npm test
# Run tests with external APIs disabled
SKIP_EXTERNAL_APIS=true npm test
# Run specific test file
npx tsx src/test.tsπ API Keys
Required API Keys
Bank Al-Maghrib (BAM)
Registration: Visit Bank Al-Maghrib and request API access
Endpoints: Exchange rates, treasury bills, government obligations
Rate Limits: 30 requests/minute
World Bank
Registration: World Bank Data Connect
Free tier: 60 requests/minute
Documentation: World Bank API Docs
Optional API Keys
Service | Purpose | Registration |
ACLED | Crisis/conflict data | |
OpenWeatherMap | Weather data | |
HDX | Humanitarian data |
π Troubleshooting
Common Issues
1. "Module not found" errors
# Rebuild the project
rm -rf dist/
npm run build2. API rate limit errors
Check your rate limit status in logs
Increase
RATE_LIMIT_DEFAULTin .envImplement request caching
3. BAM API authentication errors
Verify API keys are correct
Check if keys have expired
Ensure keys have correct permissions
4. Claude Desktop integration issues
Verify path to
dist/index.jsis correctCheck Claude Desktop logs
Restart Claude Desktop after config changes
5. SSE Connection Failed
Ensure
MCP_TRANSPORT=httpis set in environment variablesVerify the server is running in HTTP mode
Check firewall allows connections to port 3000
Debug Mode
Enable verbose logging:
NODE_ENV=development DEBUG=* npm run devHealth Checks
# Check if server is running (HTTP mode)
curl https://morocco-opendata-mcp.kcb.ma/health
# Check if server is running (local stdio mode)
node -e "console.log('MCP server healthy')"
# The server will log status of all data sources on startupπ€ Contributing
We welcome contributions! Please follow these guidelines:
Getting Started
Fork the repository: https://github.com/kcbdev/morocco-open-data-mcp
Create a feature branch:
git checkout -b feature/your-featureMake your changes
Run tests:
npm testCommit your changes:
git commit -am 'Add new feature'Push to the branch:
git push origin feature/your-featureSubmit a pull request
Code Style
Follow TypeScript best practices
Use ESLint rules (coming soon)
Write meaningful commit messages
Add tests for new features
Update documentation
Areas for Contribution
Additional data sources (ministries, agencies)
More geographic data (provinces, communes)
Historical data archives
Data visualization tools
Arabic/French language improvements
Performance optimizations
Documentation translations
π License
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
See the LICENSE file for details.
What This Means:
β You CAN: Share, copy, redistribute, adapt, and build upon this material
β You MUST: Give appropriate credit, provide a link to the license, and indicate if changes were made
β You CANNOT: Use this material for commercial purposes
β You CANNOT: Apply legal terms or technological measures that restrict others from doing anything the license permits
For commercial licensing inquiries, contact: oss@kcb.ma
π Support
Issues: GitHub Issues
Email: oss@kcb.ma
π Acknowledgments
Bank Al-Maghrib - For providing financial and economic data
data.gov.ma - Morocco's national open data portal
World Bank - For development indicators and statistics
Casablanca Stock Exchange - For market data
Aladhan API - For prayer times services
MCP Project - For the Model Context Protocol framework
Built with β€οΈ for Morocco's open data community
Morocco Open Data MCP Server v1.0.0
Live Deployment: https://morocco-opendata-mcp.kcb.ma
Source Code: https://github.com/kcbdev/morocco-open-data-mcp
Available Tools
28 toolsget_bond_quotesB
Get government and corporate bond quotes from Casablanca Stock Exchange
Inputs: type.
get_city_coordinatesB
Get coordinates and administrative info for Moroccan cities
Inputs: city (required).
get_climate_dataB
Get climate and weather data for Morocco (temperature, precipitation, etc.)
Inputs: location, startDate, endDate.
get_company_infoC
Get detailed company information from Casablanca Stock Exchange
Inputs: symbol (required).
get_datasetB
Get detailed information about a specific dataset from data.gov.ma
Inputs: id (required).
get_data_sourcesA
Get list of all available data sources and their status
Inputs: no named parameters.
get_environmental_indicatorsB
Get environmental indicators for Morocco (CO2 emissions, renewable energy, forest area)
Inputs: indicator.
get_exchange_ratesB
Get current exchange rates from Bank Al-Maghrib (Morocco's central bank)
Inputs: currency, date.
get_humanitarian_datasetsB
Search humanitarian datasets for Morocco from Humanitarian Data Exchange (HDX)
Inputs: query, limit.
get_inflation_dataA
Get inflation and consumer price index data from Bank Al-Maghrib
Inputs: year.
get_interest_ratesB
Get key interest rates and monetary policy rates from Bank Al-Maghrib
Inputs: type.
get_market_indicesB
Get all market indices from Casablanca Stock Exchange (MASI, MASIX, etc.)
Inputs: index.
get_market_summaryA
Get today's market summary from Casablanca Stock Exchange (indices, top gainers/losers, volume)
Inputs: no named parameters.
get_money_supplyB
Get money supply aggregates (M1, M2, M3) from Bank Al-Maghrib
Inputs: startDate, endDate.
get_morocco_economic_summaryA
Get comprehensive economic summary for Morocco from World Bank (GDP, inflation, unemployment, trade, etc.)
Inputs: no named parameters.
get_morocco_regionsB
Get all administrative regions of Morocco with metadata
Inputs: language.
get_next_prayerA
Get the next upcoming prayer time for a Moroccan city
Inputs: city (required).
get_prayer_timesB
Get Islamic prayer times for Moroccan cities (Fajr, Dhuhr, Asr, Maghrib, Isha)
Inputs: city (required), date.
get_stock_quotesB
Get stock quotes from Casablanca Stock Exchange (Bourse de Casablanca)
Inputs: symbols.
get_treasury_billsB
Get treasury bills auction results from Bank Al-Maghrib
Inputs: type, limit.
get_weekly_prayer_timesA
Get prayer times for the next 7 days for a Moroccan city
Inputs: city (required).
get_world_bank_indicatorsB
Get World Bank development indicators for Morocco (GDP, population, poverty, etc.)
Inputs: indicator (required), years.
list_organizationsB
List all organizations publishing data on data.gov.ma
Inputs: limit.
list_prayer_citiesA
List all Moroccan cities available for prayer times
Inputs: no named parameters.
search_by_tagB
Search datasets by tag on data.gov.ma
Inputs: tag (required), limit.
search_citiesC
Search for Moroccan cities by name or region
Inputs: query, region.
search_datasetsB
Search for datasets on Morocco's national open data portal (data.gov.ma). Supports Arabic, French, and English queries.
Inputs: query (required), limit, organization, format.
search_knowledge_graphB
Search the Morocco knowledge graph for entities and relationships
Inputs: query (required), type.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 28 tools
Some tools overlap, e.g., multiple prayer time tools (get_next_prayer, get_prayer_times, get_weekly_prayer_times) and economic summaries (get_morocco_economic_summary vs get_world_bank_indicators). However, descriptions generally clarify distinctions.
Tools follow a mostly consistent verb_noun pattern with 'get_', 'search_', and 'list_' prefixes. The few mixed verbs (get vs search vs list) are predictable but not uniform.
28 tools is on the higher end for an open data MCP. The scope is broad (finance, religion, climate, etc.), which justifies the count, but some domains could be consolidated.
Covers diverse domains but lacks depth in each. Missing CRUD operations (expected for read-only) and missing some plausible tools like order book or trade history for finance, or category browsing for datasets.
Related MCP Connectors
140+ data APIs for agents: finance, banking validation, geo, weather, text. One API key.
Real-time data API for AI Agents: stocks, weather, forex, logistics, search, scrape, news, IP.
Official public & government APIs, dozens of countries: registers, statistics, open data. Keyless.
Search, read and call 125+ data APIs: sanctions, barcodes, IP intelligence, companies, holidays
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to discover and search authentic Moroccan tourism experiences, cultural activities, and local operators through natural language queries with real-time data from verified sources.-
- AlicenseBqualityCmaintenanceProvides access to 27 UK government data sources and services, enabling queries about transport, business, healthcare, and more via natural language.332MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for the Moroccan Open Data portal (data.gov.ma) enabling search and retrieval of datasets, resources, organizations, and groups via CKAN API.2MIT
- AlicenseNot gradedqualityBmaintenanceProvides queryable access to official UAE open data through MCP tools, resources, and prompts, with bilingual support and multiple data connectors.28 npm3MIT