crypto-oracle-feed
Retrieve instantaneous fiat valuation for specified digital assets against Tether (USDT) utilizing the public data streams provided by the Bitget exchange infrastructure.
Author

pwh-pwh
Quick Info
Actions
Tags
Digital Asset Valuation Service (DAVS) 📈
This utility furnishes up-to-the-minute pricing data for various cryptocurrencies relative to USDT, interfacing exclusively with the Bitget trading platform's market data endpoints. Engineered with the FastMCP framework and leveraging zod for rigorous input schema validation, this service acts as a reliable conduit for real-time financial metrics.
中文文档 | English
Core Functionality 🧐
This deployment establishes an accessible server interface permitting queries for the prevailing exchange rate of any supported digital asset (denominated in USDT) via Bitget's specialized API.
- Utility:
getTokenPrice - Objective: Secure the most recent trading value for an asset identifier (e.g.,
BTC,ETH,XRP). -
Advantage: Optimized performance and straightforward integration, powered by
FastMCP! -
Utility:
getAnnoucements -
Objective: Acquire official notices and platform updates.
-
Utility:
getCoinInfo - Objective: Obtain granular descriptive metadata for a designated token.
- Advantage: Delivers comprehensive details including asset mobility status, supported blockchain networks, and network operational health.
Key Attributes ✨
- 🎯 Simplified Interface: Input asset ticker, receive precise valuation. Minimal setup required.
- 🛡️ Schema Integrity: Parameter inputs are subjected to strict
zodschema checks. - 📡 Bitget Integration: Directly taps into Bitget’s live market ticker feeds.
- 🧠 Resilience: Robust error trapping mechanisms log operational anomalies for post-mortem analysis.
Deployment Guide 🚀
To bring this price retrieval mechanism online:
Prerequisites
- Deno Runtime: Installation of Deno is mandatory, adhering to modern JavaScript execution standards. Obtain it from here.
- Bitget Access: No private credentials are needed as we utilize public endpoints. However, a custom Bitget base URL can be specified via the
BGURLenvironment variable.
Initial Setup
-
Secure a local copy of the repository: bash git clone https://github.com/pwh-pwh/coin-mcp-server.git cd coin-mcp-server
-
Dependencies are managed implicitly through Deno's import resolution.
Server Execution
Initiate the service using: bash deno run --allow-net --allow-env --allow-read main.ts
Or, reference the remote deployment: bash deno run --allow-net --allow-env --allow-read https://deno.land/x/coin_mcp_server/main.ts
--allow-net: Enables external communication for API calls.--allow-env: Permits reading of system environment variables (likeBGURL).
The process will commence in standard input/output (stdio) mode, poised to dispense pricing information.
- For deployment without local installation, configure the service on deno.land/dash, set
StartType=sseas an environment parameter to utilize the assigned Deno domain for persistent server-sent event connectivity.
Configuration Blueprint
config.json snippet:
{ "mcpServers": { "crypto-oracle-feed": { "command": "deno", "args": [ "run", "--allow-net", "--allow-read", "--allow-env", "https://deno.land/x/coin_mcp_server/main.ts" ] } } }
Operational Example 🛠️
Requesting the valuation via getTokenPrice:
{ "tool": "getTokenPrice", "parameters": { "token": "BGB" } }
Expected Output: (A raw numerical string representing the market price)
"42.069" // Hypothetical BGB/USDT valuation
If the requested asset is invalid or the API experiences a service interruption, a descriptive error will be generated and logged.
Internal Mechanism Overview ⚙️
- FastMCP: Orchestrates the server initialization with designated service metadata.
- Zod: Enforces the strict format compliance of the
tokeninput parameter. - Bitget API: Fetches trading pair metrics from
https://api.bitget.com/api/v2/spot/market/tickers.
The getBitgetPrice internal function is paramount, extracting the crucial lastPr (last traded price) from the server's JSON reply. Monitor operational logs for price updates or amusing error narratives! 😂
Environmental Variables 🌐
BGURL: Overrides the default Bitget API root endpoint (https://api.bitget.com). Set as: bash export BGURL="https://your-custom-bitget-url.com"
Debugging Guidance 🛑
- “HTTP error! status: 404”: Ensure symbol accuracy.
BGBUSDTdiffers fundamentally fromBGBin API calls. - “Network error”: Verify active internet connectivity and the presence of the Deno
--allow-netdirective. - Unresolved Issues?: Report via an issue ticket. Collaborative problem-solving initiated! 🙌
Rationale for Existence 💡
To satisfy the perpetual requirement for transparent, immediate cryptocurrency valuation. Essential for traders, long-term holders, and the merely crypto-curious. Furthermore, it serves as an engaging demonstration of Deno capabilities integrated with external financial APIs. 😎
Contributions Welcome 🤝
Ideas, bug fixes, or proposals for advanced features (e.g., predictive modeling based on lunar cycles)? Fork the repository, implement changes, and submit a Pull Request! Let's elevate this into the premier MCP data provider. 🌌
Licensing Information ⚖️
MIT License – Freedom to utilize, modify, and distribute. Disclaimer: Liability is disclaimed should your asset portfolio experience parabolic growth or sudden decline! 🌑📉
May your digital asset holdings consistently trend upward! 💚
Note on Underlying Technology: The concept mirrors XMLHttpRequest (XHR), a browser API enabling asynchronous HTTP communication post-page load, central to Ajax methodologies. XHR originated with Microsoft Outlook in 2000, implemented first in IE5, and is now a universal W3C standard maintained by WHATWG since 2012, supporting methods for request control, headers, and progressive data handling.
