Token导航 LogoToken导航TokenDH.com
Stripe MCP Client logo
开发工具未说明官方级别未说明来源级核验

Stripe MCP Client

MCP Server

A lightweight JavaScript client for interacting with Stripe's Model Context Protocol (MCP) server to create payment links.

工具数

1

提示词数

0

GitHub Stars

1

资源数

0
JavaScriptClaude开发工具Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

MattMorgis

提供方

MattMorgis

最后核验

2026/5/18 04:04

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

条纹MCP客户端

一个轻量级的JavaScript客户端,用于与Stripe的模型上下文协议(MCP)服务器交互以创建支付链接。此客户端旨在在您自己的MCP服务器内使用,以实现与Stripe支付服务的集成。

注: 此代码由Claude 3.7 Sonnet生成。 视频

特性

  • 用于创建Stripe支付链接的简单API
  • 围绕MCP客户端的轻量级包装
  • 支持自定义选项和连接帐户
  • MCP连接的自动管理

安装

npm install stripe-mcp-client

请确保您已安装Node.js 16+。

依赖项

此包取决于:

  • @modelcontextprotocol/sdk:用于MCP客户端实现
  • @stripe/mcp:用于Stripe MCP服务器(对等依赖)

用法

基本用法

import StripeMcpClient from 'stripe-mcp-client';

async function createPaymentLink() {
  // Initialize the client
  const client = new StripeMcpClient({
    apiKey: 'your_stripe_api_key', // Or set STRIPE_API_KEY env var
    debug: true, // Optional: Enable debug logging
  });

  try {
    // Connect to the Stripe MCP server
    await client.connect();

    // Create a payment link
    const paymentLink = await client.createPaymentLink({
      line_items: [
        {
          price: 'price_123', // Your Stripe price ID
          quantity: 1,
        },
      ],
      after_completion: {
        type: 'redirect',
        redirect: {
          url: 'https://example.com/thank-you',
        },
      },
    });

    console.log(`Payment link created: ${paymentLink.url}`);
    return paymentLink;
  } finally {
    // Always close the connection when done
    await client.close();
  }
}

createPaymentLink().catch(console.error);

与环境变量一起使用

// Set in your environment: STRIPE_API_KEY, STRIPE_ACCOUNT (optional)
import StripeMcpClient from 'stripe-mcp-client';

async function createPaymentLink() {
  const client = new StripeMcpClient();
  try {
    await client.connect();
    const paymentLink = await client.createPaymentLink({
      line_items: [{price: 'price_123', quantity: 1}],
    });
    return paymentLink;
  } finally {
    await client.close();
  }
}

在您自己的MCP服务器中使用

import {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js';
import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';
import StripeMcpClient from 'stripe-mcp-client';
import {z} from 'zod';

// Create your MCP server
const server = new McpServer({
  name: 'My Payment Server',
  version: '1.0.0',
});

// Add a tool that creates Stripe payment links
server.tool(
  'create_payment_link',
  'Create a Stripe payment link for checkout',
  {
    product_name: z.string().describe('Name of the product'),
    price_amount: z.number().describe('Price amount in cents'),
    currency: z
      .string()
      .default('usd')
      .describe('Currency code (default: usd)'),
  },
  async ({product_name, price_amount, currency}) => {
    // Initialize the Stripe MCP client
    const stripeClient = new StripeMcpClient();

    try {
      await stripeClient.connect();

      // Create a payment link using the Stripe MCP server
      const paymentLink = await stripeClient.createPaymentLink({
        line_items: [
          {
            price_data: {
              currency: currency,
              product_data: {
                name: product_name,
              },
              unit_amount: price_amount,
            },
            quantity: 1,
          },
        ],
      });

      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              payment_link_url: paymentLink.url,
              payment_link_id: paymentLink.id,
            }),
          },
        ],
      };
    } catch (error) {
      return {
        content: [
          {
            type: 'text',
            text: `Error creating payment link: ${error.message}`,
          },
        ],
        isError: true,
      };
    } finally {
      await stripeClient.close();
    }
  }
);

// Start the server
const transport = new StdioServerTransport();
await server.connect(transport);

配置选项

StripeMcpClient 构造函数接受以下选项:

选项类型默认值描述
apiKeystringprocess.env。STRIPE_API_KEY您的STRIPE API密钥
toolsstring'paymentLinks.create'要启用的条纹工具的逗号分隔列表
stripeAccountstringprocess.env。STRIE_ACCOUNT可选的STRIPE Connect帐户ID
debugbooleanfalse启用调试日志记录

api参考

new StripeMcpClient(options)

创建新的客户端实例。

client.connect()

连接到Stripe MCP服务器。如果需要,由其他方法自动调用。

client.createPaymentLink(options)

使用指定选项创建新的付款链接。

参数:

退货:

  • 解析为创建的支付链接对象的Promise

client.close()

关闭与Stripe MCP服务器的连接。

测试

npm test

许可证

麻省理工学院

目录标签

目录标签

JavaScriptClaude开发工具developer-toolsstripepayment-linksjavascript-client支付服务本地部署JavaScript客户端Stripe集成轻量级工具

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP