mcp-crypto-ticker

The MCP Crypto Ticker tool integrates real-time cryptocurrency data into AI-powered IDEs like Cursor AI. It uses the Coinpaprika API, allowing developers to fetch crypto prices and 24-hour changes through natural language commands within their coding environment, simplifying crypto-related development workflows.

GitHubスター

1

ユーザー評価

未評価

お気に入り

0

閲覧数

5

フォーク

0

イシュー

0

README

Below is the updated README file with the new configuration instructions:


MCP Crypto Ticker Tool
Overview

MCP (Model Context Protocol) is a framework that allows you to integrate custom tools into AI-assisted development environments—such as Cursor AI. MCP servers expose functionality (like data retrieval or code analysis) so that an LLM-based IDE can call these tools on demand. Learn more about MCP in the Model Context Protocol Introduction.

This project demonstrates an MCP server that provides a crypto ticker tool. It uses the Coinpaprika API Node.js client to fetch real-time cryptocurrency data from Coinpaprika API. Users pass the full coin name (e.g., "bitcoin") and the tool returns its current price in USD along with the 24-hour percentage change.

Requirements
  • Node.js: Version 20 or higher is required.
Features
  • MCP Integration: Exposes tool functionality to LLM-based IDEs.
  • Crypto Ticker Data: Retrieves current ticker information for a given coin.
  • Input Validation: Uses Zod for schema validation.
  • Standard I/O Transport: Connects via StdioServerTransport for integration with development environments.
Installation
  1. Clone the Repository

    git clone <repository_url>
    cd <repository_directory>
    
  2. Install Dependencies

    You can install the project dependencies in one of two ways:

    Option 1: Install using the existing package.json

    Simply run:

    npm install
    

    Option 2: Install dependencies manually

    If you prefer, delete the existing package.json and install the required packages manually:

    npm install @modelcontextprotocol/sdk @coinpaprika/api-nodejs-client zod
    

    Then, update the newly generated package.json file to include the following line, which enables ES Modules:

    "type": "module"
    
Integrating with Cursor AI

This project now includes a .cursor subdirectory that contains an mcp.json file for configuring the MCP server. Open the file and update the following fields:

  • command: Replace this field with the absolute path to your Node.js executable. For example:

    /home/john/.nvm/versions/node/v20.13.1/bin/node
    
  • argument: Replace this field with the absolute path to your MCP server JavaScript file. For example:

    /home/john/mcp-crypto-ticker/mcp-crypto-ticker.js
    

You can verify the absolute path to your Node.js executable by running which node in your terminal.

Optional: Global Configuration

If you prefer, you can move the mcp.json file from the .cursor subdirectory to your global Cursor AI configuration directory located at ~/.cursor. This allows Cursor AI to recognize your MCP server configuration globally.

Using the MCP Tool in Cursor Composer (Agent Mode)

With the MCP server integrated into Cursor AI and with Agent mode enabled in Cursor Composer, simply use a natural language prompt like:

get the bitcoin price

The AI agent will infer the available getTicker tool from your MCP server and execute it to retrieve the current ticker data for Bitcoin.

Code Overview

The project comprises the following key parts:

  • MCP Server Initialization:
    The MCP server is instantiated using McpServer from the MCP SDK and connected via StdioServerTransport.

  • Tool Definition:
    The getTicker tool is defined with a Zod schema that accepts a coin’s full name (defaulting to "bitcoin"). The tool fetches the list of coins from the Coinpaprika API to map the friendly coin name to the corresponding coin ID. It then calls getAllTickers with quotes: ['USD'] to retrieve ticker data in USD, extracts the price and 24-hour change, and returns the information.

What is MCP?

Model Context Protocol (MCP) provides a standardized approach to integrate custom tools into AI-assisted development environments. With MCP, you can define tools that perform specific tasks—such as retrieving external data, validating code, or enforcing coding standards—and the AI assistant in your IDE can call these tools automatically based on context. This helps improve developer productivity, ensures consistent quality, and streamlines workflows.

Reference

Use Your Own MCP on Cursor in 5 Minutes

License

This project is licensed under the MIT License.

作者情報
Luciano Ayres

Curious developer eager to learn and explore new technologies. Passionate about collaboration and contributing to open-source projects.

Brazil

46

フォロワー

95

リポジトリ

0

Gist

0

貢献数