CBN MCP Server ๐ฆ
A Model Context Protocol (MCP) server for accessing Central Bank of Nigeria (CBN) data and circulars. Connect this server to Cursor, Claude Desktop, or any MCP-compatible application to access CBN regulatory information directly in your AI conversations. ๐
Built with mcp_server_dart - A developer-friendly MCP framework for Dart with annotations and code generation that I created. ๐ช
Features โจ
MCP Tools ๐ ๏ธ
Circulars Tools ๐
- getAllCirculars: Fetch all CBN circulars with optional filtering by date range and category ๐
- getCircularById: Get a specific CBN circular by its ID ๐
- searchCirculars: Search CBN circulars by title or description keywords ๐
- fetchCircularPdf: Download and read PDF content of CBN circulars ๐
- fetchCircularPdfById: Download PDF content by circular ID ๐ฅ
- getCircularPdfUrl: Get the direct download URL for a CBN circular PDF by its ID ๐
- getCircularsForLLMAnalysis: Get recent CBN circulars with PDF URLs formatted for LLM analysis ๐ค
Exchange Rates Tools ๐ฑ
- getAllExchangeRates: Fetch all CBN exchange rates with optional filtering by date range and currency ๐ฑ
- getExchangeRateById: Get a specific CBN exchange rate by its ID ๐
Financial Data Tools ๐
- getAllFinancialData: Fetch all CBN financial data with optional filtering by date range and financial metrics ๐
- getFinancialDataById: Get a specific CBN financial data by its ID ๐
MCP Resources ๐
- cbnApiStatus: Current status and health of the CBN API connection ๐
- serverInfo: Information about this CBN MCP server โน๏ธ
- availableCircularPdfs: List of available circular PDFs with their URIs ๐
- randomFact: A random fact about the CBN ๐ฒ
MCP Prompts ๐ฌ
- circularSummary: Generate a summary prompt for CBN circulars analysis ๐
- regulatoryAnalysis: Generate prompts for regulatory compliance analysis of CBN circulars โ๏ธ
Quick Start ๐
Option 1: Download Pre-built Binary (Easiest) โก
- Go to Releases ๐ฆ
- Download the
cbn_mcp
executable โฌ๏ธ - Make it executable:
chmod +x cbn_mcp
๐ง - Use path:
/path/to/cbn_mcp
๐
Option 2: Run with Dart (If you have Dart installed) ๐ฏ
- Clone this repository:
git clone https://github.com/chiziaruhoma/cbn_mcp.git
๐ - Navigate to directory:
cd cbn_mcp
๐ - Install dependencies:
dart pub get
๐ฆ - Use command:
dart run bin/main.dart
โถ๏ธ
Option 3: Build from Source ๐จ
- Follow Option 2 steps 1-3 โฌ๏ธ
- Build executable:
dart compile exe bin/main.dart -o cbn_mcp
๐๏ธ - Use path:
/path/to/cbn_mcp
๐
Integration with AI Applications ๐ค
Cursor IDE ๐ป
Open Cursor settings (Cmd/Ctrl + ,) โ๏ธ
Go to "Features" โ "Model Context Protocol" ๐ง
Add a new MCP server with one of these configurations: ๐
Using pre-built binary: โก
{ "name": "cbn-mcp", "command": "/path/to/cbn_mcp" }
Using Dart (if you have Dart installed): ๐ฏ
{ "name": "cbn-mcp", "command": "dart", "args": ["run", "bin/main.dart"], "cwd": "/path/to/cbn_mcp" }
Restart Cursor ๐
Now you can ask questions like: "What are the latest CBN circulars?" or "Find CBN regulations about forex trading" ๐ฌ
Claude Desktop ๐ฅ๏ธ
Open Claude Desktop settings โ๏ธ
Navigate to the MCP servers configuration ๐ง
Add the CBN MCP server with one of these configurations: ๐
Using pre-built binary: โก
{ "mcpServers": { "cbn-mcp": { "command": "/path/to/cbn_mcp" } } }
Using Dart (if you have Dart installed): ๐ฏ
{ "mcpServers": { "cbn-mcp": { "command": "dart", "args": ["run", "bin/main.dart"], "cwd": "/path/to/cbn_mcp" } } }
Restart Claude Desktop ๐
The CBN tools will be available in your conversations ๐
Other MCP-Compatible Applications ๐
For any application that supports MCP: ๐
- Add the server configuration pointing to the
cbn_mcp
executable ๐ - The server will expose CBN data access tools to your AI assistant ๐ค
Usage Examples ๐ก
Once integrated, you can ask your AI assistant: ๐ฃ๏ธ
Circulars Examples ๐
- "What are the latest CBN circulars from this month?" ๐
- "Find all CBN regulations related to cryptocurrency" ๐ฐ
- "Get me the details of CBN circular BSD/DIR/GEN/LAB/11/020" ๐
- "Summarize the key points from recent CBN monetary policy circulars" ๐
- "What are the compliance requirements for banks based on recent CBN circulars?" โ๏ธ
Exchange Rates Examples ๐ฑ
- "What is the current USD/NGN exchange rate?" ๐ต
- "Show me the exchange rates for the past week" ๐
- "Get the official CBN rate for EUR to NGN" ๐ถ
Financial Data Examples ๐
- "What are the current CBN monetary policy parameters?" ๐๏ธ
- "Show me the repo rates for the last month" ๐
- "What is the current cash reserve ratio?" ๐ฐ
- "Get the opening balance data for this quarter" ๐
Development ๐จโ๐ป
Prerequisites ๐
- Dart SDK ^3.9.2
- Git
Setup ๐ ๏ธ
Clone the repository:
git clone https://github.com/chiziaruhoma/cbn_mcp.git cd cbn_mcp
Install dependencies:
dart pub get
Generate mappable classes (if needed):
dart run build_runner build
Running the Server โถ๏ธ
# Run directly with Dart
dart run bin/main.dart
# Or build and run executable
dart compile exe bin/main.dart -o cbn_mcp
./cbn_mcp
Testing ๐งช
dart test
Building for Distribution ๐ฆ
# Build executable
dart compile exe bin/main.dart -o cbn_mcp
# The executable can be distributed and run on any compatible system
Project Structure ๐
lib/
โโโ cbn.dart # Main MCP server class
โโโ cbn.mcp.dart # Generated MCP annotations
โโโ core/
โ โโโ api/
โ โ โโโ api_client.dart # HTTP client for CBN API
โ โโโ utils/
โ โโโ logger.dart # Logging utilities
โโโ models/ # Data models with mappable annotations
โ โโโ circular.dart # Circular data models
โ โโโ financials.dart # Financial data models
โ โโโ rates.dart # Exchange rates models
โ โโโ random.dart # Random fact models
โ โโโ models.dart # Base model classes
โโโ services/ # Business logic services
โโโ circulars.dart # Circulars API service
โโโ financials.dart # Financial data service
โโโ rates.dart # Exchange rates service
โโโ prompt.dart # MCP prompt service
โโโ status.dart # Status and info service
โโโ services.dart # Base service classes
Contributing ๐ค
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
API Documentation ๐
This project integrates with the Central Bank of Nigeria's public API. For more information about the available endpoints, visit the CBN Developer Portal.
License ๐
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments ๐
- Central Bank of Nigeria for providing the public API
- The MCP community for the protocol specification
- mcp_server_dart for the Dart MCP framework