Data360 MCP Project
Project description
Data360 MCP Project
A Model Context Protocol (MCP) library and server for accessing and searching the World Bank Data360 Platform. This project provides both a reusable library and a ready-to-use MCP server implementation for integrating Data360 data into AI applications.
Overview
Data360 MCP Server enables AI assistants and applications to search, retrieve, and work with data from the World Bank's Data360 platform. It implements the MCP specification to provide a standardized interface for accessing Data360's extensive collection of development indicators.
What is Data360?
The World Bank's Data360 Platform is a comprehensive data platform that provides access to thousands of development indicators from the World Bank. It is a platform for data discovery, exploration, and analysis.
Features
- ๐ Powerful Search: Semantic search across Data360 data with relevance scoring
- ๐ Structured Responses: Type-safe response models with Pydantic validation
- ๐ก๏ธ Error Handling: Comprehensive error handling with graceful degradation
- ๐ FastMCP Integration: Built on FastMCP for high-performance MCP server implementation
- ๐ง Configurable: Environment-based configuration for API endpoints and settings
- ๐ฆ Modular Design: Separate library and server packages for flexibility
Project Structure
This repository contains two main packages:
data360-mcp: Core library providing Data360 MCP functionality. This library implements the MCP specification for the Data360 Platform that can be used to build MCP servers. Tools, resources, and prompts are implemented in this library.data360-mcp-server: MCP server implementation that exposes the MCP tools, resources, and prompts defined in thedata360-mcplibrary. This server is implemented using FastMCP.
Library
The core library provides an abstraction of the MCP specs for Data360 and utility functions to interact with Data360 programmatically.
Provided Tools (library interface)
| Tool | Description |
|---|---|
data360_search |
Search for Data360 indicators using the Data360 MCP. |
data360_get_metadata |
Get metadata for a Data360 indicator. |
data360_get_data |
Get the data for a Data360 indicator. |
Installation
Prerequisites
- Python 3.10 or higher
- uv (recommended) or pip
Using uv (Recommended)
# Clone the repository
git clone <repository-url>
cd data360-mcp
# Install dependencies
uv sync
# Install the packages
uv pip install -e data360-mcp
uv pip install -e data360-mcp-server
Using pip
# Install the library
pip install -e data360-mcp/
# Install the server
pip install -e data360-mcp-server/
Configuration
The server requires configuration via environment variables. Create a .env file or set the following:
# Required: Base URL for the Data360 API
DATA360_API_BASE_URL=https://data360api.worldbank.org
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
DATA360_API_BASE_URL |
Base URL for the Data360 API | Yes | - |
Usage
Running the MCP Server
Using the provided script:
./run_server.sh
Using uv:
uv run fastmcp run data360-mcp-server/src/data360_mcp_server/main.py:mcp --transport http --port 8021
Using Python directly:
python -m data360_mcp_server.main
The server will start on http://localhost:8021 by default.
Using the Library Directly
import asyncio
from data360_mcp.data360 import api as data360_api
async def main():
# Simple search
result = await data360_api.search(
query="food security",
n_results=10
)
if result.error:
print(f"Error: {result.error}")
else:
print(f"Found {result.count} results")
for item in result.items or []:
print(f"- {item.series_description.name} ({item.series_description.idno})")
asyncio.run(main())
Advanced Search with OData Filters
This will be abstracted away by the MCP tools and resources.
result = await data360_api.search(
query="food security",
n_results=20,
filter="type eq 'indicator'",
orderby="series_description/name",
select="series_description/idno, series_description/name, series_description/database_id",
skip=0,
count=True
)
MCP Tools
The server exposes the following MCP tools:
data360_search
Search for Data360 indicators using the World Bank Data360 API.
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | Yes | - | Search query string to find relevant data series |
n_results |
integer | No | 10 | Number of top results to return (1-50) |
filter |
string | No | None | OData filter expression (e.g., "type eq 'indicator'") |
orderby |
string | No | None | OData orderby expression (e.g., "series_description/name") |
select |
string | No | None | OData select expression (e.g., "series_description/idno, series_description/name") |
skip |
integer | No | 0 | Number of results to skip for pagination |
count |
boolean | No | False | Whether to include total count in response |
Example Request:
{
"query": "food security",
"n_results": 20,
"filter": "type eq 'indicator'",
"orderby": "series_description/name",
"select": "series_description/idno, series_description/name, series_description/database_id"
}
Example Response:
{
"items": [
{
"@search.score": 14.934074,
"series_description": {
"idno": "UN_SDG_SN_ITK_DEFC",
"name": "2.1.1 Prevalence of undernourishment",
"database_id": "UN_SDG"
}
}
],
"count": 1,
"error": null
}
OData Query Syntax
The search endpoint supports OData query syntax for advanced filtering and selection:
Filter Examples
# Filter by type
filter="type eq 'indicator'"
# Filter by topic
filter="series_description/topics/any(t: t/name eq 'Health') and type eq 'indicator'"
# Multiple conditions
filter="type eq 'indicator' and series_description/database_id eq 'WB_WDI'"
Order By Examples
# Sort by name
orderby="series_description/name"
# Sort by name descending
orderby="series_description/name desc"
# Multiple sort fields
orderby="series_description/database_id, series_description/name"
Select Examples
# Select specific fields
select="series_description/idno, series_description/name, series_description/database_id"
# Select all fields from series_description
select="series_description/*"
Development
Setting Up Development Environment
# Clone the repository
git clone <repository-url>
cd data360-mcp
# Install development dependencies
uv sync --dev
# Install pre-commit hooks
pre-commit install
Running Tests
# Run tests (when available)
uv run pytest
Code Quality
The project uses:
- ruff: For linting and code formatting
- pre-commit: For git hooks
# Format code
uv run ruff format .
# Lint code
uv run ruff check .
Project Structure
data360-mcp/
โโโ data360-mcp/ # Core library package
โ โโโ src/
โ โ โโโ data360_mcp/
โ โ โโโ data360/ # Data360 API client
โ โ โ โโโ api.py # API functions
โ โ โ โโโ config.py # Configuration
โ โ โ โโโ models.py # Pydantic models
โ โ โโโ ...
โ โโโ pyproject.toml
โโโ data360-mcp-server/ # MCP server package
โ โโโ src/
โ โ โโโ data360_mcp_server/
โ โ โโโ main.py # FastMCP server implementation
โ โโโ pyproject.toml
โโโ run_server.sh # Server startup script
โโโ pyproject.toml # Workspace configuration
Integration Examples
With LangChain MCP Adapters
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({
"data360": {
"transport": "streamable_http",
"url": "http://localhost:8021/mcp",
}
})
async def search_indicators():
async with client:
tools = await client.get_tools()
result = await client.call_tool(
"data360_search",
{
"query": "poverty",
"n_results": 10
}
)
print(result)
asyncio.run(search_indicators())
License
See the LICENSE file for details.
Support
For issues, questions, or contributions, please open an issue on the GitHub repository.
Acknowledgments
- Built with FastMCP
- Uses the Model Context Protocol specification
- Integrates with the World Bank Data360 API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file data360_mcp-0.1.1.tar.gz.
File metadata
- Download URL: data360_mcp-0.1.1.tar.gz
- Upload date:
- Size: 150.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
837f630b20028fc82f9ae549833a7217fccdaf777717974bebc3632303cd22c4
|
|
| MD5 |
ea64fb8ac4edfab9b5ec5286ce7c65ad
|
|
| BLAKE2b-256 |
4aabbde1954cca57a253645f4ac6ab4ee6f209c0eba5dded650721aafa2603ed
|
File details
Details for the file data360_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: data360_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af206ee33fed50d361f2388a3c53f78db638abfae765fceff77b55b3b03635e
|
|
| MD5 |
e2e48986996532041d4d0859c7607330
|
|
| BLAKE2b-256 |
252912103213d3e20b7e331c94919afebb9060276d27f68c18dee6a00861272e
|