Extend Mcp

by paywithextend

17 stars
267 downloads
Not rated
GitHub

About

Extend Mcp is a Python-based implementation within the Extend AI Toolkit that integrates Extend's spend management APIs with Anthropic’s Model Context Protocol (MCP). It enables existing Extend users to delegate actions such as managing virtual cards, credit cards, transactions…

Details

Author
paywithextend
GitHub stars
17
Downloads
267
Categories
Developer Tools

- Supports multiple AI frameworks including MCP, OpenAI, LangChain, and CrewAI
- Provides comprehensive tools for virtual cards, credit cards, transactions, and expense management
- Configurable via environment variables or command-line arguments
- Supports custom authorization with Bearer tokens for Extend API 2.0+
- Can run locally via stdio or remotely via SSE transport

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Extend Mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install the package via pip install extend_ai_toolkit, then configure your Extend API key and secret via environment variables (EXTEND_API_KEY, EXTEND_API_SECRET) or command-line arguments (--api-key, --api-secret). Run the MCP server locally with MCP Inspector (npx @modelcontextprotocol/inspector python ...) or integrate it into Claude Desktop by editing the claude_desktop_config.json to add the Extend MCP server. For remote execution, use the SSE transport with python -m extend_ai_toolkit.modelcontextprotocol.main_sse.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

McpServers

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

Extend AI Toolkit

Overview

The Extend AI Toolkit provides a python based implementation of tools to integrate with Extend APIs for multiple AI frameworks including Anthropic's Model Context Protocol (MCP), OpenAI, LangChain, and CrewAI. It enables users to delegate certain actions in the spend management flow to AI agents or MCP-compatible clients like Claude desktop.

These tools are designed for existing Extend users with API keys. If you are not signed up with Extend and would like to learn more about our modern, easy-to-use virtual card and spend management platform for small- and medium-sized businesses, you can check us out at paywithextend.com.

Features

- Multiple AI Framework Support: Works with Anthropic Model Context Protocol, OpenAI Agents, LangChain LangGraph & ReAct, and CrewAI frameworks
- Comprehensive Tool Set: Supports all of Extend's major API functionalities, spanning our Credit Card, Virtual Card, Transaction & Expense Management endpoints

Installation

You don't need this source code unless you want to modify the package. If you just
want to use the package run:

pip install extend_ai_toolkit

Requirements

- Python: Version 3.10 or higher
- Extend API Key: Sign up at paywithextend.com to obtain an API key
- Framework-specific Requirements:
- LangChain: langchain and langchain-openai packages
- OpenAI: openai package
- CrewAI: crewai package
- Anthropic: anthropic package (for Claude)

Configuration

The library needs to be configured with your Extend API key and API, either through environment variables or command line arguments:

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

or via environment variables:

EXTEND_API_KEY=your_api_key_here
EXTEND_API_SECRET=your_api_secret_here

Custom Authorization (paywithextend 2.0+)

When you upgrade to paywithextend>=2.0.0, the SDK accepts reusable authorization
strategies. You can pass any implementation (including the new BearerAuth) to
the toolkit:

from extend.auth import BearerAuth
from extend_ai_toolkit.shared import ExtendAPI

extend_api = ExtendAPI.from_auth(BearerAuth(jwt_token="your-jwt-token"))

If you're still using paywithextend 1.x, continue providing api_key and
api_secret; the toolkit adapts automatically.

Available Tools

The toolkit provides a comprehensive set of tools organized by functionality:

Virtual Cards

- get_virtual_cards: Fetch virtual cards with optional filters - get_virtual_card_detail: Get detailed information about a specific virtual card

Credit Cards

- get_credit_cards: List all credit cards - get_credit_card_detail: Get detailed information about a specific credit card

Transactions

- get_transactions: Fetch transactions with various filters - get_transaction_detail: Get detailed information about a specific transaction - update_transaction_expense_data: Update expense-related data for a transaction

Expense Management

- get_expense_categories: List all expense categories - get_expense_category: Get details of a specific expense category - get_expense_category_labels: Get labels for an expense category - create_expense_category: Create a new expense category - create_expense_category_label: Add a label to an expense category - update_expense_category: Modify an existing expense category - create_receipt_attachment: Upload a receipt (and optionally attach to a transaction) - automatch_receipts: Initiate async job to automatch uploaded receipts to transactions - get_automatch_status: Get the status of an automatch job - send_receipt_reminder: Send a reminder (via email) for a transaction missing a receipt

Usage Examples

Model Context Protocol

The toolkit provides resources in the extend_ai_toolkit.modelcontextprotocol package to help you build an MCP server.

Development

Test Extend MCP server locally using MCP Inspector:

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

Claude Desktop Integration

Add this tool as an MCP server to Claude Desktop by editing the config file:

On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json

if you want to use the create_receipt_attachment tool with claude desktop you'll need to install the filesystem mcp server via npm install @modelcontextprotocol/server-filesystem add then add to the config file as well.

Please note: due to current limitations images uploaded directly to the Claude Desktop cannot be uploaded to Extend due to the fact that the Claude Desktop app does not have access to the underlying image data. This is why the Filesystem MCP Server is necessary.

With the addition of Filesystem, you can setup a dedicated folder for receipts, and tell Claude it to upload the receipt and automatch it to the most likely transaction. Alternatively, if you know the transaction you want to attach the receipt to then you can tell Claude to upload the receipt for that transaction (and skip the automatch process.

{
  "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"
    ]
  }
}

Remote Execution

You can also run your server remotely and communicate via SSE transport:

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

and optionally connect using the MCP terminal client:

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

OpenAI

```python
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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.