TA

ttjslbz001/akshare_mcp_server

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

53 stars 20 forks 品質 56 トレンド 0

ttjslbz001/akshare mcp server は [https://github.com/ttjslbz001/akshare_mcp_server.] からインポートされた MCP サーバーの候補です

概要

ttjslbz001/akshare mcp server は [https://github.com/ttjslbz001/akshare_mcp_server.] からインポートされた MCP サーバーの候補です

概要(AI 翻訳)

AKShareライブラリを使用して財務データ分析機能を提供するモデルコンテキストプロトコル(MCP)サーバー。

##特徴

  • AKShareによる中国およびグローバル金融市場データへのアクセス
  • MCPプロトコルによるClaudeデスクトップとの統合 ・各種財務データ照会・分析のサポート

インストール

uv の使用 (推奨)

##pip の使用

使用法

サーバーの実行

##Claudeデスクトップとの統合

1。 Claudeデスクトップの設定に次の設定を追加します。

  1. クロードデスクトップを再起動する
  2. 利用可能なツールから AKShare MCP サーバーを選択します。

利用可能なツール

AKShare MCP サーバーでは、以下のツールを提供しています。

  • 株式データ問い合わせ
  • ファンドデータクエリ
  • ボンドデータクエリ
  • 将来のデータクエリ
  • 外国為替データクエリ
  • マクロ経済データクエリ
  • もっと…

新しいツールの追加

MCP サーバーに新しいツールを追加するには、次の手順に従ってください。

1.[[src/mcp_server_akshare/api.py]に新しいAPI機能を追加:

2.src/mcp_server_akshare/server.pyの列に新しいツールを追加します。:

3.[src/mcp_server_akshare/server.pyの新機能をインポートする]:

4.[handle_list_tools()関数にツール定義を追加します:

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

AKShare MCP Server

A Model Context Protocol (MCP) server that provides financial data analysis capabilities using the AKShare library.

Features

  • Access to Chinese and global financial market data through AKShare
  • Integration with Claude Desktop via MCP protocol
  • Support for various financial data queries and analysis

Installation

# Clone the repository
git clone https://github.com/yourusername/akshare_mcp_server.git
cd akshare_mcp_server

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

# Install dependencies with uv
uv pip install -e .

Using pip

# Clone the repository
git clone https://github.com/yourusername/akshare_mcp_server.git
cd akshare_mcp_server

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

# Install dependencies
pip install -e .

Usage

Running the server

# Activate the virtual environment
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Run the server
python run_server.py

Integrating with Claude Desktop

  1. Add the following configuration to your Claude Desktop configuration:
"mcpServers": {
    "akshare-mcp": {
        "command": "uv",
        "args": [
            "--directory",
            "/path/to/akshare_mcp_server",
            "run",
            "akshare-mcp"
        ],
        "env": {
            "AKSHARE_API_KEY": ""
        }
    }
}
  1. Restart Claude Desktop
  2. Select the AKShare MCP server from the available tools

Available Tools

The AKShare MCP server provides the following tools:

  • Stock data queries
  • Fund data queries
  • Bond data queries
  • Futures data queries
  • Forex data queries
  • Macroeconomic data queries
  • And more…

Adding a New Tool

To add a new tool to the MCP server, follow these steps:

  1. Add a new API function in src/mcp_server_akshare/api.py:

    async def fetch_new_data_function(param1: str, param2: str = "default") -> List[Dict[str, Any]]:
        """
        Fetch new data type.
        
        Args:
            param1: Description of param1
            param2: Description of param2
        """
        try:
            df = ak.akshare_function_name(param1=param1, param2=param2)
            return dataframe_to_dict(df)
        except Exception as e:
            logger.error(f"Error fetching new data: {e}")
            raise
    
  2. Add the new tool to the enum in src/mcp_server_akshare/server.py:

    class AKShareTools(str, Enum):
        # Existing tools...
        NEW_TOOL_NAME = "new_tool_name"
    
  3. Import the new function in src/mcp_server_akshare/server.py:

    from .api import (
        # Existing imports...
        fetch_new_data_function,
    )
    
  4. Add the tool definition to the handle_list_tools() function:

GitHub で README 全文を見る

インストール

docker run -p 8000:8000 akshare-mcp-server
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

"mcpServers": { "akshare-mcp": { "command": "uv", "args": [ "--directory", "/path/to/akshare_mcp_server", "run", "akshare-mcp" ], "env": { "AKSHARE_API_KEY": "<your_api_key_if_needed>" } } }