Skip to main content
Glama
nohosa001-pixel

Critical Raw Minerals & Urban Mining Oracle (x402)

핵심 원자재 및 도시 광업 오라클 (minerals-oracle-x402)

Python 3.11+ FastAPI Protocol Agent Protocol MCP

자율 거래, 공급망 및 RWA(실물 자산) 에이전트를 위해 설계된 고성능 결정론적 마이크로 오라클 서비스입니다. 핵심 원자재 물리적 상품에 대한 실시간 현물 가격, COMEX/LME 교차 거래소 차익 스프레드, 도시 광업 스크랩 벤치마크 수익률 평가를 제공합니다.


⚡ 주요 기능

  1. 정규화된 핵심 상품 가격 피드:

    • 은(Ag): LBMA 및 COMEX 현물, USD/troy_oz, USD/g, USD/kg 단위.

    • 백금(Pt): LPPM 및 NYMEX 현물, USD/troy_oz, USD/g 단위.

    • 구리(Cu): LME Grade A Cathode 및 COMEX, USD/mt, USD/lb, USD/kg 단위.

    • 리튬(Li): 배터리 등급 99.5% $\text{Li}_2\text{CO}_3$ / $\text{LiOH}$, USD/mt, USD/kg 단위.

    • 희토류(NdDy): 영구자석 등급 네오디뮴-디스프로슘($\text{PrNd}/\text{DyFe}$) 복합재, USD/kg 단위.

  2. 지역별 차익 거래 및 베이시스 스프레드:

    • 대서양 횡단 해상 운임 및 수입 관세를 반영한 COMEX vs. LME 구리 차익 거래 계산.

    • COMEX vs. LBMA Loco London 은 스프레드.

    • SMM 중국 내수 vs. Fastmarkets CIF Rotterdam 리튬 프리미엄/할인.

    • NYMEX vs. LPPM 백금 스프레드.

  3. 도시 광업 및 순환 경제 가치 평가 엔진:

    • EV_BATTERY_BLACK_MASS: 지불 가능한 회수 수율과 처리 수수료(TC/RC)를 적용한 $\text{Li}$, $\text{Ni}$, $\text{Co}$, $\text{Mn}$ 습식 제련 회수.

    • AUTO_CATALYST_CERAMIC: 세라믹 모노리스 분석을 통한 폐촉매 변환기 PGM($\text{Pt}$, $\text{Pd}$, $\text{Rh}$) 회수.

    • E_WASTE_HIGH_GRADE_PCB: 파쇄된 PCB 원료에서 귀금속 및 비철금속($\text{Au}$, $\text{Ag}$, $\text{Cu}$) 추출.

    • WIND_EV_PERMANENT_MAGNETS: 분리된 희토류 산화물($\text{Nd}$, $\text{Dy}$, $\text{Pr}$) 회수를 위한 NdFeB 스크랩 재활용.

  4. Base에서 x402를 통한 Web3 수익화:

    • Base(체인 ID 8453)에서 HTTP 402 챌린지-응답을 통한 소액 결제(쿼리당 0.005 USDC) 강제.

    • 네이티브 Base USDC 토큰: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.

    • EIP-712/EIP-191 암호화 서명 및 파실리테이터 검증 지원.

  5. 멀티 에이전트 표준 네이티브:

    • Google AP2 (/.well-known/ap2): Agent Protocol v2 매니페스트.

    • Model Context Protocol (MCP): 도구 스키마 정의(mcp_tool_spec.json) 및 /mcp/invoke 디스패처.

    • OpenAPI / Swagger (/docs): 표준 기계 판독 가능 및 대화형 API 문서.


Related MCP server: hyperd-mcp

📁 저장소 구조

minerals-oracle-x402/
├── app/
│   ├── __init__.py
│   ├── main.py              # FastAPI application, routing & MCP endpoints
│   ├── feed_engine.py       # Deterministic commodity pricing, spread & scrap engine
│   ├── x402_verifier.py     # HTTP 402 challenge & EIP-712 payment verifier
│   └── schemas.py           # Pydantic data contracts & schemas
├── tests/
│   ├── __init__.py
│   └── test_client.py       # Autonomous agent payment test suite
├── .well-known/
│   └── ap2.json             # Google Agent Protocol AP2 manifest
├── mcp_tool_spec.json       # FastMCP tool definition for LLM agents
├── Dockerfile               # Ultra-lightweight multi-stage container
├── requirements.txt         # Python dependencies
└── README.md                # Documentation & quickstart

🚀 빠른 시작

1. 로컬 설정

# Clone and enter directory
cd minerals-oracle-x402

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run development server
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

대화형 문서는 http://localhost:8000/docs에서 확인할 수 있습니다.

2. Docker로 실행

# Build lightweight container
docker build -t minerals-oracle-x402 .

# Run container
docker run -p 8000:8000 minerals-oracle-x402

💳 x402 결제 흐름 사양

sequenceDiagram
    autonumber
    actor Agent as Autonomous AI Agent
    participant Oracle as minerals-oracle-x402
    participant Base as Base Network (USDC)

    Agent->>Oracle: GET /api/v1/oracle/prices
    Oracle-->>Agent: HTTP 402 Payment Required<br/>(Nonce, Price: 0.005 USDC, Base Chain ID: 8453)
    Note over Agent: Agent signs payment challenge<br/>using private key (EIP-712/EIP-191)
    Agent->>Oracle: GET /api/v1/oracle/prices<br/>Header: Authorization: x402 <base64_payload>
    Oracle->>Oracle: Verify signature / Facilitator settle
    Oracle-->>Agent: HTTP 200 OK<br/>Certified Oracle Feeds & Attestation Hashes

결제 승인 헤더 형식

Authorization: x402 eyJub25jZSI6ICIxYTIz...IiwgInNpZ25hdHVyZSI6ICIweDk5...In0=

디코딩된 JSON 페이로드에는 다음이 포함됩니다:

{
  "nonce": "7f8b92c4a90184b2ef019a823b102938",
  "signature": "0x...",
  "signer": "0xYourAgentWalletAddress"
}

🤖 MCP(Model Context Protocol) 통합

Claude Desktop, Cursor, Gemini 또는 Antigravity 에이전트와 함께 사용하려면 mcp_tool_spec.json을 로드하세요.

사용 가능한 도구:

  1. get_mineral_prices: 모든 현재 현물 가격 및 단위 변환 조회.

  2. get_arbitrage_spreads: COMEX/LME/SMM 베이시스 스프레드 및 마진 조회.

  3. calculate_urban_mining_value: EV 블랙매스, 자동차 촉매, 전자폐기물 또는 영구자석의 배치 회수 수율 계산.

Python 에이전트 MCP 도구 호출 예시:

import httpx

resp = httpx.post(
    "http://localhost:8000/mcp/invoke",
    json={
        "name": "calculate_urban_mining_value",
        "arguments": {
            "scrap_category": "EV_BATTERY_BLACK_MASS",
            "quantity_metric_tons": 5.0,
            "custom_assay_overrides": {"Li": 4.1, "Co": 6.5}
        }
    },
    headers={"X-Dev-Bypass": "true"}  # Or with valid x402 signature
)
print(resp.json())

🧪 테스트 실행

402 챌린지 흐름, EIP-712 암호화 검증, 스크랩 계산 및 AP2 엔드포인트를 검증하는 자동화된 테스트 스위트 실행:

pytest -v tests/test_client.py

📜 라이선스

MIT 라이선스. 자율 에이전트 상거래 및 핵심 광물 회복탄력성을 위해 구축되었습니다.

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Pay-per-call web scraping for AI agents via x402 on Base USDC. Six tools, no signup.

  • Pay-per-call data tools for AI agents: crypto signal, web reader, SEO audit. x402 USDC on Base.

  • 63 pay-per-call tools for agents: vision, text, data, web, blockchain. USDC on Base via x402.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nohosa001-pixel/minerals-oracle-x402'

If you have feedback or need assistance with the MCP directory API, please join our Discord server