Python Server MCP

GPL 3.0
  • Linux
  • Apple

Integrations

  • Integrates with CoinMarketCap API to retrieve real-time cryptocurrency price information and market data

Python Server MCP - 暗号通貨価格サービス

このプロジェクトは、暗号通貨の価格情報を提供するMCP(Model Context Protocol)サーバーを実装します。このサーバーはPythonとMCPフレームワークを使用して構築され、さまざまなクライアントが利用できるAPIを作成します。

特徴

  • リアルタイムの暗号通貨価格検索
  • 環境ベースの構成(開発、本番、ステージング、ローカル)
  • CoinMarketCap API統合
  • Dockerコンテナのデプロイメント

要件

  • Python 3.12以上
  • uv (パッケージおよび仮想環境マネージャー)
  • Docker(オプション、コンテナ実行用)

インストール

uvの使用(推奨)

# Clone the repository git clone <repository-url> cd PythonServerMcp

UVで仮想環境を作成してアクティブ化する

uv venv source .venv/bin/activate

依存関係をインストールする

uv sync

構成

  1. 次の変数を含む.envファイルをプロジェクト ルートに作成します。
ENVIRONMENT=DEV # Options: LOCAL, DEV, STAGING, PROD COINMARKETCAP_API_KEY=your_api_key_here
  1. 各環境ごとに特定の環境ファイルを作成することもできます。
    • .dev.env - 開発環境用
    • .staging.env - ステージング環境用
    • .prod.env - 本番環境用

使用法

ローカル実行

python main.py

これにより、標準入出力 (stdio) を介して要求をリッスンする MCP サーバーが起動します。

Dockerの使用

# Build the image docker build -t test-mcp -f Dockerfile --platform linux/amd64 . # Run the container docker run -it test-mcp

プロジェクト構造

. ├── Dockerfile # Docker configuration ├── main.py # Application entry point ├── pyproject.toml # Dependencies configuration ├── start.sh # Docker startup script └── src/ # Source code ├── __init__.py # MCP server initialization └── core/ # Core modules ├── common/ # Shared schemas and models ├── config.py # Application configuration ├── services/ # Application services ├── settings/ # Environment-specific settings └── utils/ # Utilities

発達

MCP サーバーに新しいツールを追加する

MCP サーバーに新しいツールを追加するには、次の手順に従います。

  1. src/__init__.pyファイルで関数を定義する
  2. main()関数でツールを登録する
  3. ドキュメント文字列でツールを文書化する

例:

@server.add_tool def my_new_tool(parameter1: str, parameter2: int) -> str: """ Description of what the tool does. Args: parameter1: Description of parameter 1 parameter2: Description of parameter 2 Returns: Description of what is returned """ # Tool implementation return result
-
security - not tested
A
license - permissive license
-
quality - not tested

CoinMarketCap API 統合による MCP (モデル コンテキスト プロトコル) フレームワークを通じてリアルタイムの暗号通貨価格情報を提供する暗号通貨価格サービス。

  1. Features
    1. Requirements
      1. Installation
        1. Using uv (recommended)
        2. Create and activate virtual environment with uv
      2. Install dependencies
        1. Configuration
        2. Usage
        3. Project Structure
        4. Development
      ID: 4s04su7as4