关键矿物数据工具
一套MCP服务器和支持API,用于从权威来源访问关键矿物和材料数据。专为人工智能驱动的分析、供应链研究和LLM集成而设计。
数据源
| 来源 | 描述 | 覆盖范围 | 数据类型 |
|---|---|---|---|
| 克莱姆(NETL-EDX) | 美国关键矿产和材料 | 200多个数据集 | 研究数据、CSV、模式 |
| BGS世界矿产统计 | 全球矿产生产和贸易 | 1970-2023,70+种矿产 | 生产、进口、出口 |
项目概述
Data_Needs/
├── CLaiMM/ # CLAIMM MCP servers (standard + agnostic)
├── BGS_MCP/ # BGS MCP server + REST API
├── UNComtrade_MCP/ # UN Comtrade MCP server
├── GoogleScholar_MCP/ # Google Scholar MCP server
├── ArXiv_MCP/ # ArXiv MCP server
├── CMM_API/ # Legacy unified API (deprecated)
└── README.md # This file快速比较
| 项目 | 接口 | 数据源 | 需要LLM | 最适合 |
|---|---|---|---|---|
| 索赔 (标准) | MCP | CLAIMM | 是 | 人工智能搜索和摘要 |
| 索赔 (不可知) | MCP | CLAIMM | 否 | 直接CLAIMM数据访问 |
| BGS_MCP | MCP+REST | BGS | 否 | 全球生产统计 |
| 联合国贸_MCP | MCP | 联合国商品贸易统计数据库 | 否 | 按HS编码的国际贸易流量 |
| 谷歌奖学金_MCP | MCP | 谷歌学者(SerpAPI) | 否 | 学术文献搜索 |
| ArXiv_MCP | MCP | arXiv+可选LLM摘要 | 可选 | 预印本搜索和摘要 |
| CMM_API(遗留) | MCP+REST | 两者都有 | 否 | 仅向后兼容 |
选择正确的工具
适用于克劳德桌面/克劳德代码用户
| 需要 | 推荐 | 命令 |
|---|---|---|
| 美国数据集+人工智能搜索 | CLaiMM标准 | claimm-mcp |
| 美国数据集(原始数据) | CLaiMM不可知 | claimm-mcp-agnostic |
| 全球生产统计 | BGS_MCP | bgs-mcp |
| 一个工作流中的两个源 | 使用 claimm-mcp + bgs-mcp 一起 | 两个命令 |
其他LLM(OpenAI、Anthropic、谷歌、Ollama)
| 需要 | 推荐 | 端点 |
|---|---|---|
| 全球生产统计 | BGS_MCP REST | http://localhost:8000 |
| 仅美国数据集 | CLaiMM MCP工具 | N/A(MCP) |
| 旧版统一端点(已弃用) | CMM_API REST | http://localhost:8000 |
适用于没有LLM密钥的协作者
使用任何LLM不可知选项:
claimm-mcp-agnostic-通过MCP传输CLAIMM数据bgs-mcp-通过MCP传输BGS数据cmm-mcp-传统的统一MCP(已弃用)- 任何REST API-直接HTTP访问
安装
所有项目使用 紫外线 用于依赖性管理。
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone/navigate to Data_Needs directory
cd Data_Needs
# Install each project
cd CLaiMM && uv sync && cd ..
cd BGS_MCP && uv sync && cd ..
cd UNComtrade_MCP && uv sync && cd ..
cd GoogleScholar_MCP && uv sync && cd ..
cd ArXiv_MCP && uv sync && cd ..
# Optional legacy package:
cd CMM_API && uv sync && cd ..快速开始
启动所有服务
# Terminal 1: BGS REST API
cd BGS_MCP && uv run bgs-api
# Optional legacy unified REST API (deprecated)
cd CMM_API && uv run cmm-api测试API
# BGS API - top lithium producers
curl "http://localhost:8000/production/ranking?commodity=lithium%20minerals&top_n=5"
# BGS API - cobalt supply chain
curl "http://localhost:8000/production/ranking?commodity=cobalt,%20mine"Claude桌面配置
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"bgs": {
"command": "uv",
"args": ["--directory", "/path/to/BGS_MCP", "run", "bgs-mcp"]
},
"claimm-agnostic": {
"command": "uv",
"args": ["--directory", "/path/to/CLaiMM", "run", "claimm-mcp-agnostic"],
"env": {
"EDX_API_KEY": "your_edx_key"
}
}
}
}推荐设置:
- 使用
bgs加上claimm-mcp或claimm-mcp-agnostic - 添加旧版
cmm-mcp仅用于向后兼容性
项目详细信息
索赔(CLaiMM/)
用于NETL EDX CLAIMM(关键矿物和材料)数据的MCP服务器。
两种变体:
| 变量 | 命令 | 工具 | 需要LLM |
|---|---|---|---|
| 标准 | claimm-mcp | 8 | 是(OpenAI、Anthropic等) |
| 不可知论者 | claimm-mcp-agnostic | 10 | 否 |
诊断工具:
search_claimm_datasets-按查询/标签搜索get_dataset_details-完整元数据list_claimm_datasets-列出所有数据集search_resources-搜索文件get_resource_details-文件元数据get_download_url-直接下载链接detect_file_schema-CSV/Excel列检测detect_dataset_schemas-所有文件的架构get_claimm_statistics-格式/标签统计信息get_datasets_by_category-按主题组织
数据类别:
- 稀土元素(75个数据集)
- 产出水(27个数据集)
- 地质学(33个数据集)
- 地球化学(18个数据集)
- 煤炭和煤炭副产品(11个数据集)
- 矿山废弃物(4个数据集)
- 锂(1个数据集)
BGS_MCP(BGS_MCP/)
用于BGS世界矿产统计的MCP服务器和REST API。
接口:
| 接口 | 命令 | 用例 |
|---|---|---|
| MCP服务器 | bgs-mcp | 克劳德桌面/代码 |
| REST API | bgs-api | 任何LLM、HTTP客户端 |
MCP工具(8):
list_commodities-可用矿物质list_countries-有数据的国家search_production-按筛选器搜索get_commodity_ranking-顶级生产商get_time_series-历史趋势compare_countries-国家比较get_country_profile-国家商品get_api_info-文件
REST端点:
GET /commodities-列出矿物GET /countries-列出国家GET /production/search-搜索数据GET /production/ranking-顶级生产商GET /production/timeseries-趋势GET /production/compare-比较国家GET /countries/{iso}/profile-国家概况GET /openai/functions-LLM工具定义
关键矿物(28):
- 电池:锂、钴、镍、石墨、锰
- 稀土:矿物、氧化物
- 战略:铂、钨、钒、铬、钽/铌
- 工艺:镓、锗、铟、绿柱石
- 基体:铜、锌、铅、金、银、锑、钼、铁
CMM_API公司(CMM_API/,遗留/弃用)
状态:因新用途而弃用。保留以实现向后兼容性。
结合CLAIMM和BGS数据源的统一API。
接口:
| 界面 | 命令 | 描述 |
|---|---|---|
| MCP服务器 | cmm-mcp | 克劳德桌面/代码 |
| REST API | cmm-api | 任何LLM、HTTP客户端 |
MCP工具(8):
get_data_overview-所有来源概述search_all_sources-统一搜索list_bgs_commodities-BGS矿物search_bgs_production-BGS数据get_commodity_ranking-顶级生产商search_claimm_datasets-CLAIMM搜索get_claimm_dataset-数据集详细信息get_claimm_categories-CLAIMM类别
REST端点:
GET /overview-所有来源概述GET /search?q=-统一搜索GET /bgs/commodities-BGS矿物GET /bgs/production-BGS数据GET /bgs/ranking/{commodity}-顶级生产商GET /claimm/datasets-CLAIMM搜索GET /claimm/datasets/{id}-数据集详细信息GET /claimm/categories-CLAIMM类别GET /openai/functions-LLM工具定义
LLM集成
开放人工智能
import httpx
from openai import OpenAI
API_BASE = "http://localhost:8000" # BGS_MCP REST API
client = OpenAI()
# Get function definitions
functions = httpx.get(f"{API_BASE}/openai/functions").json()["functions"]
# Use with chat completions
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Top lithium producers?"}],
tools=[{"type": "function", "function": f} for f in functions],
)人类克劳德(API)
import anthropic
import httpx
API_BASE = "http://localhost:8000" # BGS_MCP REST API
client = anthropic.Anthropic()
functions = httpx.get(f"{API_BASE}/openai/functions").json()["functions"]
tools = [{"name": f["name"], "description": f["description"],
"input_schema": f["parameters"]} for f in functions]
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
tools=tools,
messages=[{"role": "user", "content": "Search for rare earth datasets"}]
)Ollama(当地法学硕士)
import httpx
import json
API_BASE = "http://localhost:8000"
OLLAMA_BASE = "http://localhost:11434"
# Fetch data first
data = httpx.get(f"{API_BASE}/bgs/ranking/cobalt,%20mine").json()
# Ask LLM to analyze
response = httpx.post(
f"{OLLAMA_BASE}/api/chat",
json={
"model": "phi4",
"messages": [
{"role": "system", "content": "You are a minerals analyst."},
{"role": "user", "content": f"Analyze: {json.dumps(data)}"}
],
"stream": False
},
timeout=120.0
)
print(response.json()["message"]["content"])纯HTTP
# Top cobalt producers
curl "http://localhost:8000/production/ranking?commodity=cobalt,%20mine&top_n=10"
# Country profile
curl "http://localhost:8000/countries/AU/profile"
# Commodity list
curl "http://localhost:8000/commodities?critical_only=true"环境变量
| 变量 | 必需 | 描述 |
|---|---|---|
EDX_API_KEY | CLAIMM访问 | NETL EDX API密钥 |
OPENAI_API_KEY | CLaiMM标准 | OpenAI API密钥 |
ANTHROPIC_API_KEY | CLaiMM标准 | 人类学API密钥 |
GOOGLE_API_KEY | CLaiMM标准 | Google AI API密钥 |
XAI_API_KEY | CLaiMM标准 | xAI(Grok)API密钥 |
注: BGS数据不需要API密钥(开放数据)。
用例
供应链分析
# Identify concentration risk
curl "http://localhost:8000/bgs/ranking/cobalt,%20mine?top_n=10"
# Result: DRC produces 69% of global cobalt
# Compare alternative sources
curl "http://localhost:8000/bgs/production?commodity=cobalt,%20mine&country=AUS"研究数据发现
使用 claimm-mcp 或 claimm-mcp-agnostic 工具:
search_claimm_datasets通过查询查找数据集get_dataset_details检索完整元数据并下载URL
市场情报
# Production trends
curl "http://localhost:8000/production/search?commodity=lithium%20minerals&year_from=2018"
# Country mineral profile
curl "http://localhost:8000/countries/AU/profile"AI驱动的分析
与Claude Desktop一起使用:
- “稀土生产大国有哪些,供应链风险有哪些?”
- “查找有关产出水的CLAIMM数据集并显示其模式”
- “比较过去5年澳大利亚和智利的锂产量”
测试
可用测试脚本
| 项目 | 测试文件 | 描述 |
|---|---|---|
| BGS_MCP | test_openai.py | OpenAI集成 |
| BGS_MCP | test_ollama.py | Ollama集成 |
| CMM_API(遗留) | test_openai.py | OpenAI集成 |
| CMM_API(遗留) | test_ollama.py | Ollama集成 |
运行测试
# BGS with OpenAI
cd BGS_MCP
export OPENAI_API_KEY=your_key
uv run python test_openai.py
# Legacy CMM API with Ollama
cd CMM_API
uv run python test_ollama.py建筑
┌─────────────────────────────────────────────────────────────┐
│ Client Applications │
├─────────────────────────────────────────────────────────────┤
│ Claude Desktop │ Claude Code │ OpenAI │ Ollama │ ... │
└────────┬─────────┴───────┬───────┴────┬─────┴────┬─────┴─────┘
│ │ │ │
│ MCP │ MCP │ HTTP │ HTTP
▼ ▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────────┐
│ CLaiMM MCP │ │ BGS MCP │ │ REST APIs │
│ (standard/ │ │ Server │ │ (BGS primary, │
│ agnostic) │ │ │ │ CMM legacy) │
└────────┬────────┘ └────────┬────────┘ └──────────┬──────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────────┐
│ EDX Client │ │ BGS Client │ │ Legacy Unified │
│ │ │ │ │ Client (optional) │
└────────┬────────┘ └────────┬────────┘ └──────────┬──────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ NETL EDX API │ │ BGS OGC API │
│ (CKAN-based) │ │ (OGC Features) │
└─────────────────┘ └─────────────────┘数据许可证
| 源 | 许可证 | URL |
|---|---|---|
| CLAIMM(NETL EDX) | 美国政府工作 | https://edx.netl.doe.gov |
| BGS世界矿产统计 | 开放政府许可证 | https://www.bgs.ac.uk |
贡献
每个项目都接受捐款。请确保:
- 代码在适用的情况下维护LLM无关模式
- REST API包括OpenAI函数定义
- MCP服务器遵循FastMCP模式
- 文档已更新
许可证
所有项目均获得麻省理工学院许可。
