open-index/open-npm huggingface dataset:
npm package: @stripe/agent-toolkit
Description: The Stripe Agent Toolkit enables popular agent frameworks including LangChain and Vercel's AI SDK to integrate with Stripe APIs through function calling.
Author: Stripe
Latest version: 0.9.0

# Stripe Agent Toolkit - TypeScript

The Stripe Agent Toolkit enables popular agent frameworks including LangChain and Vercel's AI SDK to integrate with Stripe APIs through function calling.

## Installation

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

```
npm install @stripe/agent-toolkit
```

### Requirements

- Node 18+

## Usage

The library needs to be configured with your account's secret key which is available in your [Stripe Dashboard][api-keys]. We strongly recommend using a [Restricted API Key][restricted-keys] (`rk_*`) for better security and granular permissions. Tool availability is determined by the permissions you configure on the restricted key.

```typescript
import {StripeAgentToolkit} from '@stripe/agent-toolkit/langchain';

const stripeAgentToolkit = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {},
});
```

### Tools

The toolkit works with LangChain and Vercel's AI SDK and can be passed as a list of tools. For example:

```typescript
import {AgentExecutor, createStructuredChatAgent} from 'langchain/agents';

const tools = stripeAgentToolkit.getTools();

const agent = await createStructuredChatAgent({
  llm,
  tools,
  prompt,
});

const agentExecutor = new AgentExecutor({
  agent,
  tools,
});
```

#### Context

In some cases you will want to provide values that serve as defaults when making requests. Currently, the `account` context value enables you to make API calls for your [connected accounts](https://docs.stripe.com/connect/authentication).

```typescript
const stripeAgentToolkit = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {
    context: {
      account: 'acct_123',
    },
  },
});
```

## Model Context Protocol

The Stripe Agent Toolkit also supports the [Model Context Protocol (MCP)](https://modelcontextprotocol.com/). See `/examples/modelcontextprotocol` for an example. The same configuration options are available, and the server can be run with all supported transports.

```typescript
import {StripeAgentToolkit} from '@stripe/agent-toolkit/modelcontextprotocol';
import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {},
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error('Stripe MCP Server running on stdio');
}

main().catch((error) => {
  console.error('Fatal error in main():', error);
  process.exit(1);
});
```

[node-sdk]: https://github.com/stripe/stripe-node
[api-keys]: https://dashboard.stripe.com/account/apikeys
[restricted-keys]: https://docs.stripe.com/keys#create-restricted-api-keys
npm package: @stripe/mcp
Description: A command line tool for setting up Stripe MCP server
Author: Stripe
Latest version: 0.3.3

# Stripe Model Context Protocol

The Stripe [Model Context Protocol](https://modelcontextprotocol.com/) server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.

## Setup

Stripe hosts a remote MCP server at https://mcp.stripe.com. View the docs [here](https://docs.stripe.com/mcp).

## Local

To run the Stripe MCP server locally using npx, use the following command:

```bash
# Basic usage
npx -y @stripe/mcp --api-key=YOUR_STRIPE_SECRET_KEY

# To configure a Stripe connected account
npx -y @stripe/mcp --api-key=YOUR_STRIPE_SECRET_KEY --stripe-account=CONNECTED_ACCOUNT_ID
```

Make sure to replace `YOUR_STRIPE_SECRET_KEY` with your actual Stripe secret key. Alternatively, you could set the STRIPE_SECRET_KEY in your environment variables.

**Note:** Tool permissions are controlled by your Restricted API Key (RAK). Create a RAK with the desired permissions at https://dashboard.stripe.com/apikeys

### Usage with Claude Desktop

Add the following to your `claude_desktop_config.json`. See [here](https://modelcontextprotocol.io/quickstart/user) for more details.

```json
{
  "mcpServers": {
    "stripe": {
      "command": "npx",
      "args": ["-y", "@stripe/mcp", "--api-key=STRIPE_SECRET_KEY"]
    }
  }
}
```

or if you're using Docker

```json
{
  "mcpServers": {
    "stripe": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "mcp/stripe", "--api-key=STRIPE_SECRET_KEY"]
    }
  }
}
```

### Usage with Gemini CLI

1. Install [Gemini CLI](https://google-gemini.github.io/gemini-cli/#-installation) through your preferred method.
2. Install the Stripe MCP extension: `gemini extensions install https://github.com/stripe/ai`.
3. Start Gemini CLI: `gemini`.
4. Go through the OAUTH flow: `/mcp auth stripe`.

## Available tools

See the [Stripe MCP documentation](https://docs.stripe.com/mcp#tools) for a list of tools.

## Debugging the Server

To debug your server, you can use the [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector).

First build the server

```
npm run build
```

Run the following command in your terminal:

```bash
# Start MCP Inspector and server
npx @modelcontextprotocol/inspector node dist/index.js --api-key=YOUR_STRIPE_SECRET_KEY
```

### Build using Docker

First build the server

```
docker build -t mcp/stripe .
```

Run the following command in your terminal:

```bash
docker run -p 3000:3000 -p 5173:5173 -v /var/run/docker.sock:/var/run/docker.sock mcp/inspector docker run --rm -i mcp/stripe --api-key=YOUR_STRIPE_SECRET_KEY
```

### Instructions

1. Replace `YOUR_STRIPE_SECRET_KEY` with your actual Stripe API secret key.
2. Run the command to start the MCP Inspector.
3. Open the MCP Inspector UI in your browser and click Connect to start the MCP server.
4. You can see the list of tools you selected and test each tool individually.
npm package: @stripe/react-stripe
Description: React components for Stripe.js and Stripe Elements
Author: Stripe
Latest version: 7.0.0-beta.0
Deprecated: This package has moved to @stripe/react-stripe-js

# React Stripe

React Stripe is a thin React wrapper around
[Stripe Elements](https://stripe.com/docs/elements). It allows you to add
Elements to any React app.

[![build status](https://img.shields.io/travis/stripe/react-stripe/master.svg?style=flat-square)](https://travis-ci.org/stripe/react-stripe)
[![npm version](https://img.shields.io/npm/v/@stripe/react-stripe.svg?style=flat-square)](https://www.npmjs.com/package/@stripe/react-stripe)

## Getting Started

- [Add React Stripe to your React app](https://stripe.com/docs/stripe-js/react-stripe#setup)
- [Try it out using CodeSandbox](https://codesandbox.io/s/react-stripe-official-q1loc?fontsize=14&hidenavigation=1&theme=dark)

## Documentation

- [React Stripe Docs](https://stripe.com/docs/stripe-js/react-stripe)
- [Migrate from `react-stripe-elements`](docs/migrating.md)
- [Legacy `react-stripe-elements` docs](https://github.com/stripe/react-stripe-elements/#react-stripe-elements)
- [Examples](examples)

### Minimum Requirements

React Stripe depends on the
[React Hooks API](https://reactjs.org/docs/hooks-intro.html). The minimum
supported version of React is v16.8. If you use an older version, upgrade React
to use this library. If you prefer not to upgrade your React version, we
recommend using legacy
[`react-stripe-elements`](https://github.com/stripe/react-stripe-elements).

### Contributing

If you would like to contribute to React Stripe, please make sure to read our
[contributor guidelines](CONTRIBUTING.md).
npm package: @stripe/scripts
Description: Stripe Scripts SDK
Author: Stripe, Inc.
Latest version: 2.1.1

# Stripe Scripts SDK

## Development setup

### Prerequisites

- Node.js (v18.14.0 or higher)
- npm (v9.3.1 or higher)

### Getting Started

In your project directory, run the following command to install the SDK:

```bash
npm install @stripe/scripts
```

Import the proper script function signature types into your file and write your custom logic inside of your script function.

See the [Stripe Scripts documentation](https://docs.stripe.com/billing/subscriptions/script-coupons#authoring-script-coupon) for more information on how to get started with using the SDK.

## Authoring scripts

Here is an example script authored by Stripe:
```ts
import type {
  ComputeDiscountsFunction,
  DiscountableItem,
  DiscountCalculation,
  DiscountResult,
} from '@stripe/scripts/discount_calculation';

import type {
  PositiveMonetaryAmount,
  Percent,
  RunContext,
} from '@stripe/scripts';

/**
 * Configuration for the discount calculator function
 */
export type DiscountCalculatorConfiguration = {
  max_discount_amount: PositiveMonetaryAmount;
  discount_percent: Percent;
};

/**
 * Gives a percentage off discount upto a maximum discount amount
 *
 * @param {DiscountCalculatorConfiguration} config - The configuration containing max discount amount and discount percent
 * @param {DiscountableItem} item - The items to apply discounts to
 * @returns {DiscountResult} - The discounts applied to the items
 */
const percentOffUptoMaxDiscount: ComputeDiscountsFunction<
  DiscountCalculatorConfiguration
> = (
  context: RunContext,
  config: DiscountCalculatorConfiguration,
  discountable_item: DiscountableItem,
): DiscountResult => {
  const {max_discount_amount, discount_percent} = config;
  let discountAmount = 0;

  if (
    discountable_item.gross_amount.currency.toLowerCase().trim() ===
    max_discount_amount.currency.toLowerCase().trim()
  ) {
    const discountAmountValue =
      (discountable_item.gross_amount.amount * discount_percent) / 100;
    discountAmount = Math.min(discountAmountValue, max_discount_amount.amount);
  }

  return {
    discount: {
      amount: {
        amount: discountAmount,
        currency: discountable_item.gross_amount.currency,
      },
    },
  };
};

const computePercentOffUptoMaxDiscount: DiscountCalculation<DiscountCalculatorConfiguration> =
  {
    computeDiscounts: percentOffUptoMaxDiscount,
  };

export default computePercentOffUptoMaxDiscount;

```

You can explore [more examples](https://github.com/stripe/scripts/tree/master/examples) and explore how to write your custom scripts package.

## Packaging

Instructions for how to package and upload your scripts are coming soon!
npm package: @stripe/ui-extension-tools
Description: Developer tools for Stripe UI Extensions
Latest version: 0.0.1

Stripe UI Extension Tools
-------------------------

This package contains packages and configurations to support development with the [Stripe UI Extension SDK](https://www.npmjs.com/package/@stripe/ui-extension-sdk). For details on creating a Stripe App, please refer to the [Stripe Apps documentation](https://stripe.com/docs/stripe-apps).

# Changelog

### 0.0.1
- Initial release