> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atxp.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# @atxp/express

> Documentation for the @atxp/express package

## Overview

The [@atxp/express](https://www.npmjs.com/package/@atxp/express) package is used to create MCP servers in Express with per-tool call payment processing via ATXP. You can see a complete example of how to use this package to build a monetized MCP server in the [MCP server quickstart](/developers/monetize).

<Info>
  This package depends on types and utilities from [@atxp/server](/developers/api-reference/server). All shared types and payment utilities are documented in the server package. Commonly used functions and types like `ATXPArgs` and `requirePayment` are re-exported from @atxp/express for convenience.
</Info>

## Installation

```bash theme={null}
npm install @atxp/express
```

## Functions

### atxpExpress

```typescript theme={null}
atxpExpress({
  destination: Account,
  payeeName?: string,
  oauthDatabase?: SQLiteOAuthDatabase | RedisOAuthDatabase,
  minimumPayment?: BigNumber 
}): Router
```

Express middleware that handles payment processing for MCP tools.

**Arguments**

<Expandable title="atxpExpress arguments">
  <ParamField body="destination" type="Account" required>
    The address and payment rails that the payments will be made into. Use ATXPAccount to pay into ATXP Accounts. You must [create an ATXP account](/developers/monetize/create-account) in order to receive payments.
  </ParamField>

  <ParamField body="payeeName" type="string" optional>
    A human-readable identifier for the payee. This name will be displayed to users during the payment process and can help identify the service or tool they are paying for.
  </ParamField>

  <ParamField body="oauthDatabase" type="SQLiteOAuthDatabase | RedisOAuthDatabase" optional>
    The OAuth database to use for storing tokens; either a [SQLiteOAuthDatabase](/developers/api-reference/sqlite) or [RedisOAuthDatabase](/developers/api-reference/redis). If not provided, the tokens will be stored in memory.
  </ParamField>

  <ParamField body="minimumPayment" type="BigNumber" optional>
    The smallest payment that will be asked of callers. If not provided, the caller will always be asked to pay exactly the amount of `requirePayment`. If `minimumPayment` is larger, the user will be asked to pay that instead. This allows for batch payments, where the user pre-pays for multiple tool calls.
  </ParamField>
</Expandable>

**Returns**

<ResponseField name="router" type="Express Router">
  Express middleware router function that can be used with `app.use()`.
</ResponseField>

**Example usage**

```typescript theme={null}
import { atxpExpress, ATXPArgs } from '@atxp/express'

const app = express()

// Read the ATXP connection string from the environment variables
// Your connection string should look like https://accounts.atxp.ai?<random_string>
// and you can find it in your ATXP account dashboard at https://accounts.atxp.ai/
const atxpConnectionString = process.env.ATXP_CONNECTION

app.use(atxpExpress({
  destination: new ATXPAccount(atxpConnectionString),
  payeeName: "Your MCP server's tool's name"
}))
```
