Cover image
Try Now
2025-04-07

实验授权.net node.js打字稿MCP服务器

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

authorize-net-mcp

This project is a Model Context Protocol (MCP) server that integrates with the Authorize.net Node SDK to provide two primary payment operations:

  1. takePayment – Immediately charge a credit card (AUTH_CAPTURE).
  2. createInvoice – Generate a hosted payment page (invoice) for customers to pay online.

By exposing these operations as MCP tools, AI agents and other platforms using the MCP Node SDK can seamlessly call Authorize.net functionality without directly handling credit card or transaction logic themselves.

What Is the Model Context Protocol (MCP)?

Model Context Protocol (MCP) is a specification and software development kit (SDK) that standardizes how AI models (e.g., large language models) communicate with external tools and services. MCP servers provide “tools” (methods) that an AI assistant or automation platform can discover and invoke programmatically. The goals of MCP include:

  • Discoverability: Tools advertise their functionality and input/output schemas.
  • Standardized I/O: An AI model or any client can call a tool with a JSON-based schema and receive structured output, making automation workflows more reliable.
  • Security & Compatibility: Tools run in isolated processes and communicate via well-defined channels (e.g., stdio), which helps sandbox them from the AI model environment.

In this project, the takePayment and createInvoice methods are defined as MCP tools with input schemas (amount, card details, invoice info) and structured JSON output. This means any AI model or system that implements the MCP protocol can query this server to learn about available tools, then call them with the correct parameters to process payments via Authorize.net.


How It Works

  1. MCP Node SDK – Provides the framework for creating and running MCP servers in Node.js. We use classes like Server, StdioServerTransport, and schema definitions (ListToolsRequestSchema, CallToolRequestSchema) to register tools and respond to requests over stdio.

  2. Authorize.net Node SDK – Manages the low-level payment transaction calls. Inside our MCP tool handlers, we import the authorizenet package and build requests (e.g., CreateTransactionRequest) with your Authorize.net credentials.

  3. MCP Tools

    • takePayment: Takes a credit card number, expiration date, CVV, and amount, then charges the card immediately.
    • createInvoice: Prepares a transaction with no card data (the card data is collected via a hosted Authorize.net form) and returns a URL to which the customer can be directed to pay the invoice securely.

When the server starts, it advertises these two tools (and their input schemas) to any connected MCP client. The client can then call them as needed.


Project Structure

authorize-net-mcp/
├── package.json
├── tsconfig.json
├── src
│   ├── index.ts               # MCP server initialization
│   ├── models
│   │   └── authorizeNetModel.ts   # JSON schemas & tool specifications
│   └── handlers
│       └── authorizeNetHandlers.ts # Implementations of takePayment & createInvoice
└── README.md
  • src/index.ts: Creates an MCP Server, registers tool handlers, and listens for requests via stdio.
  • src/models/authorizeNetModel.ts: Defines the input/output schemas for the two tools in JSON schema format (advertised to MCP clients when they call ListTools).
  • src/handlers/authorizeNetHandlers.ts: Contains the core logic that integrates with Authorize.net (charging cards, creating hosted invoices).

Getting Started

1. Installation

  1. Clone or download this repository.

  2. Install dependencies:

    npm install
    

2. Set Environment Variables

You must provide your Authorize.net API credentials. For testing, you can use Authorize.net Sandbox credentials. The server will look for:

  • AUTHORIZE_NET_API_LOGIN_ID
  • AUTHORIZE_NET_TRANSACTION_KEY

Set them before you build or start the server:

For Linux/Mac:

export AUTHORIZE_NET_API_LOGIN_ID="YOUR_SANDBOX_LOGIN_ID"
export AUTHORIZE_NET_TRANSACTION_KEY="YOUR_SANDBOX_TRANSACTION_KEY"

For Windows (Command Prompt):

set AUTHORIZE_NET_API_LOGIN_ID=YOUR_SANDBOX_LOGIN_ID
set AUTHORIZE_NET_TRANSACTION_KEY=YOUR_SANDBOX_TRANSACTION_KEY

For Windows (PowerShell):

$env:AUTHORIZE_NET_API_LOGIN_ID="YOUR_SANDBOX_LOGIN_ID"
$env:AUTHORIZE_NET_TRANSACTION_KEY="YOUR_SANDBOX_TRANSACTION_KEY"

3. Build and Run

# Build the TypeScript
npm run build

# Start the MCP server (listening on stdio)
npm start

The server will run and wait for MCP requests. Typically, an AI assistant or automation tool that understands MCP will spawn or connect to this process and invoke the takePayment or createInvoice tools by name.


Using the MCP Tools

Within an MCP-compatible environment (e.g., an AI chat that supports MCP), the workflow might be:

  1. List available tools (the server returns [takePayment, createInvoice] plus their schemas).

  2. Call the takePayment tool with arguments:

    {
      "amount": 19.99,
      "cardNumber": "4242424242424242",
      "expirationDate": "0825",
      "cardCode": "123"
    }
    
    • The server returns whether the payment was successful and includes transaction details in the response message.
  3. Call the createInvoice tool with arguments:

    {
      "amount": 50.0,
      "invoiceNumber": "INV-1001",
      "description": "T-shirt order"
    }
    
    • The server responds with a URL for the hosted payment page. Direct the customer to that link to enter card details securely.

Notes on Production Usage

  • Security: Never commit real API keys to source control. Use environment variables or secret management solutions in production.
  • HTTPS: In a real deployment, ensure you’re using HTTPS endpoints or secure tunnels for any inbound requests, if you plan to call it outside of an MCP host.
  • Sandbox vs. Production: Switch the base URL in the authorizeNetHandlers.ts file to production endpoints once you’re ready to go live.

Further Reading


License

This project is released under the MIT License (or your preferred license). Please see the repository’s LICENSE file for details.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

    Reviews

    4 (1)
    Avatar
    user_fE20Dh3F
    2025-04-17

    Authorize-net-mcp by zmarty is a fantastic tool for anyone looking to integrate Authorize.Net payment gateway functionalities seamlessly. The clear documentation and easy implementation make it a go-to choice for developers. The GitHub repository is well-maintained, and the community support is a huge plus. Highly recommended for anyone in need of robust payment processing solutions!