diff --git a/.gitignore b/.gitignore index ba27f74..543ebcc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ node_modules/ # Build output dist/ *.tsbuildinfo +*.mcpb # Environment files .env diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..ed93592 --- /dev/null +++ b/manifest.json @@ -0,0 +1,125 @@ +{ + "manifest_version": "0.3", + "name": "pex-api-mcp", + "display_name": "PEX Card", + "version": "1.0.3", + "description": "PEX is a B2B spend management platform for corporate card issuance, expense control, and real-time transaction tracking. The PEX MCP Server lets AI assistants query spend data, view cardholder accounts, review and categorize expenses, check spending policies, and surface financial insights across Charge and Prepaid accounts — all through natural language. Read-only access.", + "author": { + "name": "PEX Card", + "url": "https://www.pexcard.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/pexcard/mcp" + }, + "server": { + "type": "node", + "entry_point": "dist/index.js", + "mcp_config": { + "command": "node", + "args": ["${__dirname}/dist/index.js"], + "env": { + "PEX_API_URL": "${user_config.pex_api_url}", + "PEX_API_TOKEN": "${user_config.pex_api_token}" + } + } + }, + "tools": [ + { "name": "pex_get_business_profile", "description": "Get business profile details including name, address, phone, and status" }, + { "name": "pex_get_business_balance", "description": "Get business account balance" }, + { "name": "pex_get_business_admins", "description": "Get list of all business administrators" }, + { "name": "pex_get_business_admin", "description": "Get a specific business administrator by ID" }, + { "name": "pex_get_business_tags", "description": "Get all business tags" }, + { "name": "pex_get_business_tag", "description": "Get a specific business tag by ID" }, + { "name": "pex_get_business_linked", "description": "Get linked businesses" }, + { "name": "pex_get_business_bank_account", "description": "Get business bank account details" }, + { "name": "pex_get_business_one_time_transfer", "description": "Get business one-time transfer details" }, + { "name": "pex_get_business_my_profile", "description": "Get the current user's business profile" }, + { "name": "pex_get_business_billing", "description": "Get business billing information" }, + { "name": "pex_get_business_settings", "description": "Get business settings" }, + { "name": "pex_get_card", "description": "Get card profile/details by card account ID" }, + { "name": "pex_get_card_spend_rules", "description": "Get spending rules for a specific card" }, + { "name": "pex_get_card_advanced_spend_rules", "description": "Get advanced spending rules for a specific card" }, + { "name": "pex_get_card_load_limit_remaining", "description": "Get remaining card load limit for a specific card" }, + { "name": "pex_get_card_order", "description": "Get a specific card order by ID" }, + { "name": "pex_get_card_scheduled_funding_rules", "description": "Get scheduled funding rules for a specific card" }, + { "name": "pex_get_card_orders", "description": "Get card orders within an optional date range" }, + { "name": "pex_get_account_details", "description": "Get cardholder account details by account ID" }, + { "name": "pex_get_advanced_account_details", "description": "Get advanced cardholder account details by account ID" }, + { "name": "pex_get_network_transactions", "description": "Get network transactions for the business within a date range" }, + { "name": "pex_get_cardholder_network_transactions", "description": "Get network transactions for a specific cardholder within a date range" }, + { "name": "pex_get_transaction_detail", "description": "Get transaction details for a specific transaction by ID" }, + { "name": "pex_get_all_account_details", "description": "Get all cardholder account details for the business" }, + { "name": "pex_get_account_balance", "description": "Get account balance for a specific cardholder" }, + { "name": "pex_get_account_remaining_limits", "description": "Get remaining spending limits for a specific cardholder" }, + { "name": "pex_get_transaction_details", "description": "Get transaction details for the business within a date range" }, + { "name": "pex_get_all_cardholder_transactions", "description": "Get all cardholder transactions within a date range" }, + { "name": "pex_get_business_transactions", "description": "Get business transactions within a date range" }, + { "name": "pex_get_business_transaction", "description": "Get a specific business transaction by ID" }, + { "name": "pex_get_cardholder_transactions", "description": "Get transactions for a specific cardholder within a date range" }, + { "name": "pex_get_cardholder_transaction", "description": "Get a specific cardholder transaction by ID" }, + { "name": "pex_get_cardholder_purchases", "description": "Get purchases for a specific cardholder within a date range" }, + { "name": "pex_get_cardholder_purchase", "description": "Get a specific cardholder purchase by ID" }, + { "name": "pex_get_cardholder_declines", "description": "Get declined transactions for a specific cardholder within a date range" }, + { "name": "pex_get_transaction_attachments", "description": "Get all attachments for a transaction" }, + { "name": "pex_get_transaction_attachment", "description": "Get a specific attachment for a transaction" }, + { "name": "pex_get_transaction_tags", "description": "Get tags for a specific transaction" }, + { "name": "pex_get_mcc_categories", "description": "Get MCC merchant category codes" }, + { "name": "pex_list_spending_rulesets", "description": "Get all spending rulesets for the business" }, + { "name": "pex_get_spending_ruleset", "description": "Get a specific spending ruleset by ID" }, + { "name": "pex_get_spending_ruleset_cards", "description": "Get cards assigned to a specific spending ruleset" }, + { "name": "pex_list_advanced_spending_rulesets", "description": "Get all advanced spending rulesets for the business" }, + { "name": "pex_get_advanced_spending_ruleset", "description": "Get a specific advanced spending ruleset by ID" }, + { "name": "pex_get_advanced_spending_ruleset_cards", "description": "Get cards assigned to a specific advanced spending ruleset" }, + { "name": "pex_list_groups", "description": "Get all cardholder groups for the business" }, + { "name": "pex_get_group_cardholders", "description": "Get cardholders belonging to a specific group" }, + { "name": "pex_get_current_token", "description": "Get details of the current authentication token" }, + { "name": "pex_list_tokens", "description": "Get all tokens for the authenticated user" }, + { "name": "pex_get_auth_tokens", "description": "Get basic token details for the authenticated user and app" }, + { "name": "pex_get_token_provisioning_mode", "description": "Get the business token provisioning mode" }, + { "name": "pex_get_cardholder_provisioning_mode", "description": "Get token provisioning mode for a specific cardholder" }, + { "name": "pex_get_issued_tokens", "description": "Get issued tokens for a specific cardholder" }, + { "name": "pex_get_callback_types", "description": "Get available callback subscription types" }, + { "name": "pex_list_callback_subscriptions", "description": "Get all callback subscriptions for the business" }, + { "name": "pex_get_callback_subscription", "description": "Get a specific callback subscription by ID" }, + { "name": "pex_get_credit_lines", "description": "Get credit line information for the business" }, + { "name": "pex_get_invoices", "description": "Get business invoices starting from a given date" }, + { "name": "pex_get_invoice_allocations", "description": "Get allocations for a specific invoice" }, + { "name": "pex_get_invoice_payments", "description": "Get payments for a specific invoice" }, + { "name": "pex_get_payments", "description": "Get payment information for the business" }, + { "name": "pex_get_payment_transfer", "description": "Get a specific payment transfer by ID" }, + { "name": "pex_get_payment_request", "description": "Get a specific payment request by ID" }, + { "name": "pex_list_vendors", "description": "Get all vendors for the business" }, + { "name": "pex_get_vendor", "description": "Get a specific vendor by ID" }, + { "name": "pex_get_vendor_card_order", "description": "Get vendor card order details by order ID" }, + { "name": "pex_search_bills", "description": "Search bills with optional filters" }, + { "name": "pex_get_bill", "description": "Get bill payment details by bill ID" }, + { "name": "pex_get_bill_payments", "description": "Get payments for a specific bill" }, + { "name": "pex_get_bill_payment_request", "description": "Get a specific bill payment request by ID" }, + { "name": "pex_get_partner", "description": "Get partner details for the current business" } + ], + "tools_generated": false, + "user_config": { + "pex_api_url": { + "type": "string", + "title": "PEX API URL", + "description": "PEX API base URL (e.g., https://coreapi.pexcard.com/v4)", + "default": "https://coreapi.pexcard.com/v4", + "required": true + }, + "pex_api_token": { + "type": "string", + "title": "PEX API Token", + "description": "Your PEX API token. Generate one from the PEX Dashboard under Profile > Authorized Apps.", + "sensitive": true, + "required": true + } + }, + "compatibility": { + "platforms": ["darwin", "win32", "linux"], + "runtime": { + "node": ">=18.0.0" + } + }, + "license": "MIT" +} diff --git a/package.json b/package.json index 1972ce9..de72a23 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "build": "tsc", "prepublishOnly": "npm run build", "start": "node dist/index.js", - "dev": "tsx src/index.ts" + "dev": "tsx src/index.ts", + "bundle": "bash scripts/build-mcpb.sh" }, "keywords": [ "mcp", diff --git a/scripts/build-mcpb.sh b/scripts/build-mcpb.sh new file mode 100755 index 0000000..a20a5e6 --- /dev/null +++ b/scripts/build-mcpb.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Build the .mcpb bundle for the PEX MCP Server. +# Usage: ./scripts/build-mcpb.sh +# +# Produces: pex-api-mcp.mcpb in the project root. + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUNDLE_NAME="pex-api-mcp" +OUTPUT_FILE="$ROOT_DIR/$BUNDLE_NAME.mcpb" + +cd "$ROOT_DIR" + +echo "Installing all dependencies (including devDependencies for build)..." +npm ci + +echo "Building TypeScript..." +npm run build + +echo "Pruning devDependencies for bundle..." +trap 'echo "Restoring devDependencies after failure..."; npm ci' ERR +npm prune --omit=dev + +echo "Packaging $BUNDLE_NAME.mcpb..." +rm -f "$OUTPUT_FILE" + +zip -r "$OUTPUT_FILE" \ + manifest.json \ + package.json \ + dist/ \ + node_modules/ \ + README.md \ + LICENSE \ + -x "node_modules/.package-lock.json" \ + "node_modules/*/.github/*" \ + "node_modules/*/test/*" \ + "node_modules/*/tests/*" \ + "node_modules/*/README.md" \ + "node_modules/*/HISTORY.md" \ + "node_modules/*/CHANGELOG*" + +echo "Restoring devDependencies..." +npm ci + +BUNDLE_SIZE=$(du -h "$OUTPUT_FILE" | cut -f1) +echo "" +echo "Bundle created: $OUTPUT_FILE ($BUNDLE_SIZE)" +echo "To install: double-click in Claude Desktop or drag into Settings."