Extend AI Toolkit MCP Server
Official扩展AI工具包
概述
Extend AI 工具包提供了基于 Python 的工具实现,可与多种 AI 框架的 Extend API 集成,包括 Anthropic 的模型上下文协议 (MCP) 、 OpenAI 、 LangChain和CrewAI 。它允许用户将支出管理流程中的某些操作委托给 AI 代理或与 MCP 兼容的客户端,例如 Claude 桌面。
这些工具专为拥有 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 或更高版本
扩展 API 密钥:在paywithextend.com注册以获取 API 密钥
框架特定要求:
LangChain:
langchain和langchain-openai包OpenAI:
openai包CrewAI:
crewai软件包Anthropic:
anthropic包(适用于 Claude)
配置
该库需要通过环境变量或命令行参数使用您的扩展 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:针对缺少收据的交易发送提醒(通过电子邮件)
使用示例
模型上下文协议
该工具包在extend_ai_toolkit.modelcontextprotocol包中提供了资源,以帮助您构建MCP服务器。
发展
使用 MCP Inspector 在本地测试扩展 MCP 服务器:
npx @modelcontextprotocol/inspector python extend_ai_toolkit/modelcontextprotocol/main.py --tools=allClaude 桌面集成
通过编辑配置文件将此工具作为 MCP 服务器添加到 Claude Desktop:
在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
如果您想将 create_receipt_attachment 工具与 claude 桌面一起使用,您需要通过npm install @modelcontextprotocol/server-filesystem add 安装文件系统 mcp 服务器,然后将其添加到配置文件中。
请注意:由于目前的限制,直接上传到 Claude Desktop 的图像无法上传到 Extend,因为 Claude Desktop 应用无法访问底层图像数据。因此, Filesystem MCP Server是必不可少的。
通过添加文件系统,您可以设置一个专门的收据文件夹,并告诉 Claude 上传该收据并将其自动匹配到最可能的交易。或者,如果您知道要将收据附加到哪笔交易,则可以告诉 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-20241022OpenAI
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
)CrewAI
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()贡献
欢迎贡献代码!欢迎提交 Pull 请求。
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
This server cannot be deployed
Maintenance
Related MCP Connectors
The Ramp MCP server enables users to securely connect Ramp with AI assistants like ChatGPT and Claude to query financial data and take actions using natural language. It transforms Ramp's developer API into a SQL interface that LLMs can query, allowing admins to analyze spend trends, identify cost savings, and run complex SQL analyses on comprehensive datasets (transactions, purchase orders, vendors, users), while all users can manage cards, view transactions, request reimbursements, and get expense policy answers.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA 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.2MIT
- AlicenseCqualityDmaintenanceAn 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.7436 npm1MIT
- FlicenseNot gradedqualityCmaintenanceAI-powered expense tracking MCP server that connects LLM clients to PostgreSQL for natural language expense management.-
- FlicenseNot gradedqualityBmaintenanceAn 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.-