Skip to main content
Glama
paywithextend

Extend AI Toolkit MCP Server

Official

AIツールキットの拡張

概要

Extend AI Toolkitは、AnthropicのModel Context Protocol(MCP)OpenAILangChainCrewAIなど、複数のAIフレームワークのExtend APIと統合するためのツールをPythonベースで実装します。これにより、ユーザーは支出管理フローにおける特定のアクションをAIエージェントやClaudeデスクトップなどのMCP対応クライアントに委任できます。

これらのツールは、APIキーをお持ちの既存のExtendユーザー向けに設計されています。Extendにまだご登録いただいておらず、中小企業向けの最新かつ使いやすいバーチャルカードおよび支出管理プラットフォームについて詳しく知りたい方は、 paywithextend.comをご覧ください。

Related MCP server: Interswitch MCP Server

特徴

  • 複数の AI フレームワークのサポート: Anthropic Model Context Protocol、OpenAI Agents、LangChain LangGraph & ReAct、CrewAI フレームワークで動作します。

  • 包括的なツールセット: クレジットカード、バーチャルカード、取引、経費管理エンドポイントにわたるExtendの主要なAPI機能をすべてサポートします。

インストール

パッケージを変更する場合を除き、このソースコードは必要ありません。パッケージを使用するだけの場合は、以下を実行してください。

pip install extend_ai_toolkit

要件

  • Python : バージョン3.10以上

  • Extend APIキー: paywithextend.comにサインアップしてAPIキーを取得します

  • フレームワーク固有の要件:

    • LangChain: langchainおよびlangchain-openaiパッケージ

    • OpenAI: openaiパッケージ

    • CrewAI: crewaiパッケージ

    • Anthropic: anthropicパッケージ (Claude 用)

構成

ライブラリは、環境変数またはコマンドライン引数を使用して、Extend API キーと API を使用して構成する必要があります。

--api-key=your_api_key_here --api-secret=your_api_secret_here 

または環境変数経由:

EXTEND_API_KEY=your_api_key_here
EXTEND_API_SECRET=your_api_secret_here

利用可能なツール

ツールキットには、機能別に整理された包括的なツール セットが用意されています。

バーチャルカード

  • get_virtual_cards : オプションのフィルターを使用して仮想カードを取得します

  • get_virtual_card_detail : 特定の仮想カードの詳細情報を取得する

クレジットカード

  • get_credit_cards : すべてのクレジットカードを一覧表示する

  • get_credit_card_detail : 特定のクレジットカードの詳細情報を取得する

取引

  • get_transactions : さまざまなフィルターを使用してトランザクションを取得する

  • get_transaction_detail : 特定のトランザクションに関する詳細情報を取得する

  • update_transaction_expense_data : トランザクションの経費関連データを更新する

経費管理

  • get_expense_categories : すべての経費カテゴリを一覧表示する

  • get_expense_category : 特定の経費カテゴリの詳細を取得する

  • get_expense_category_labels : 経費カテゴリのラベルを取得する

  • create_expense_category : 新しい経費カテゴリを作成する

  • create_expense_category_label : 経費カテゴリにラベルを追加する

  • update_expense_category : 既存の経費カテゴリを変更する

  • create_receipt_attachment : 領収書をアップロードする(オプションで取引に添付する)

  • automatch_receipts : アップロードされた領収書と取引を自動照合する非同期ジョブを開始します。

  • get_automatch_status : 自動マッチジョブのステータスを取得する

  • send_receipt_reminder : レシートがない取引のリマインダーを(メールで送信)送信します

使用例

モデルコンテキストプロトコル

ツールキットは、MCP サーバーの構築に役立つリソースをextend_ai_toolkit.modelcontextprotocolパッケージに提供します。

発達

MCP Inspector を使用してローカルで MCP サーバーの拡張をテストします。

npx @modelcontextprotocol/inspector python extend_ai_toolkit/modelcontextprotocol/main.py --tools=all

クロードデスクトップ統合

設定ファイルを編集して、このツールを MCP サーバーとして Claude Desktop に追加します。

MacOS の場合: ~/Library/Application\ Support/Claude/claude_desktop_config.json Windows の場合: %APPDATA%/Claude/claude_desktop_config.json

claude デスクトップで create_receipt_attachment ツールを使用する場合はnpm install @modelcontextprotocol/server-filesystem add を使用してファイルシステム mcp サーバーをインストールし、構成ファイルにも追加する必要があります。

ご注意:現在の制限により、Claude Desktopに直接アップロードされた画像はExtendにアップロードできません。これは、Claude Desktopアプリが基盤となる画像データにアクセスできないためです。そのため、ファイルシステムMCPサーバーが必要となります。

ファイルシステムの追加により、レシート専用のフォルダを作成し、Claude にレシートをアップロードして、最も可能性の高い取引と自動照合するように指示できます。また、レシートを添付したい取引が分かっている場合は、その取引のレシートをアップロードするように指示することで、自動照合プロセスをスキップできます。

{
  "extend-mcp": {
    "command": "python",
    "args": [
      "-m",
      "extend_ai_toolkit.modelcontextprotocol.main",
      "--tools=all"
    ],
    "env": {
      "EXTEND_API_KEY": "apik_XXXX",
      "EXTEND_API_SECRET": "XXXXX"
    }
  },
  // optional: if you want to use the create_receipt_attachment tool
  "filesystem": { 
    "command": "npx",
    "args": [
      "-y",
      "@modelcontextprotocol/server-filesystem",
      "/path/to/receipts/folder"
    ]
  }
}

リモート実行

サーバーをリモートで実行し、SSE トランスポート経由で通信することもできます。

python -m extend_ai_toolkit.modelcontextprotocol.main_sse --tools=all --api-key="apikey" --api-secret="apisecret"

オプションでMCPターミナルクライアントを使用して接続します。

python -m extend_ai_toolkit.modelcontextprotocol.client.mcp_client --mcp-server-host localhost --mcp-server-port 8000 --llm-provider=anthropic --llm-model=claude-3-5-sonnet-20241022

オープンAI

import os
from langchain_openai import ChatOpenAI
from extend_ai_toolkit.openai.toolkit import ExtendOpenAIToolkit
from extend_ai_toolkit.shared import Configuration, Scope, Product, Actions

# Initialize the OpenAI toolkit
extend_openai_toolkit = ExtendOpenAIToolkit.default_instance(
    api_key=os.environ.get("EXTEND_API_KEY"),
    api_secret=os.environ.get("EXTEND_API_SECRET"),
    configuration=Configuration(
        scope=[
            Scope(Product.VIRTUAL_CARDS, actions=Actions(read=True)),
            Scope(Product.CREDIT_CARDS, actions=Actions(read=True)),
            Scope(Product.TRANSACTIONS, actions=Actions(read=True)),
        ]
    )
)

# Create an agent with the tools
extend_agent = Agent(
    name="Extend Agent",
    instructions="You are an expert at integrating with Extend",
    tools=extend_openai_toolkit.get_tools()
)

ランチェーン

import os
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from extend_ai_toolkit.langchain.toolkit import ExtendLangChainToolkit
from extend_ai_toolkit.shared import Configuration, Scope, Product, Actions

# Initialize the LangChain toolkit
extend_langchain_toolkit = ExtendLangChainToolkit.default_instance(
    api_key=os.environ.get("EXTEND_API_KEY"),
    api_secret=os.environ.get("EXTEND_API_SECRET"),
    configuration=Configuration(
        scope=[
            Scope(Product.VIRTUAL_CARDS, actions=Actions(read=True)),
            Scope(Product.CREDIT_CARDS, actions=Actions(read=True)),
            Scope(Product.TRANSACTIONS, actions=Actions(read=True)),
        ]
    )
)

# Create tools for the agent
tools = extend_langchain_toolkit.get_tools()

# Create the agent executor
langgraph_agent_executor = create_react_agent(
    ChatOpenAI(model="gpt-4"),
    tools
)

クルーAI

import os
from extend_ai_toolkit.crewai.toolkit import ExtendCrewAIToolkit
from extend_ai_toolkit.shared import Configuration, Scope, Product, Actions

# Initialize the CrewAI toolkit
toolkit = ExtendCrewAIToolkit.default_instance(
    api_key=os.environ.get("EXTEND_API_KEY"),
    api_secret=os.environ.get("EXTEND_API_SECRET"),
    configuration=Configuration(
        scope=[
            Scope(Product.VIRTUAL_CARDS, actions=Actions(read=True)),
            Scope(Product.CREDIT_CARDS, actions=Actions(read=True)),
            Scope(Product.TRANSACTIONS, actions=Actions(read=True)),
        ]
    )
)

# Configure the LLM (using Claude)
toolkit.configure_llm(
    model="claude-3-opus-20240229",
    api_key=os.environ.get("ANTHROPIC_API_KEY")
)

# Create the Extend agent
extend_agent = toolkit.create_agent(
    role="Extend Integration Expert",
    goal="Help users manage virtual cards, view credit cards, and check transactions efficiently",
    backstory="You are an expert at integrating with Extend, with deep knowledge of virtual cards, credit cards, and transaction management.",
    verbose=True
)

# Create a task for handling user queries
query_task = toolkit.create_task(
    description="Process and respond to user queries about Extend services",
    agent=extend_agent,
    expected_output="A clear and helpful response addressing the user's query",
    async_execution=True
)

# Create a crew with the agent and task
crew = toolkit.create_crew(
    agents=[extend_agent],
    tasks=[query_task],
    verbose=True
)

# Run the crew
result = crew.kickoff()

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A production-grade MCP server for personal finance management, enabling AI agents to add, update, search expenses, manage budgets and credit cards, and generate financial reports.
    2
    MIT
  • A
    license
    C
    quality
    D
    maintenance
    An MCP server that enables AI assistants to interact with Interswitch APIs for payments, transfers, VAS, cardless paycodes, Transaction Search, Card 360, lending, payouts, agency banking, and fintech card-processing utilities.
    74
    36 npm
    1
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    An MCP server for managing SAP Concur expense reports, allowing AI agents to create and update expenses, attach receipts and attendees, and read report data, while leaving submission and approval to humans.
    -