Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ patterns. See [x402 specification](https://github.com/coinbase/x402).

- **A2A** (Agent-to-Agent) - Transport protocol for agent communication with payment capabilities
- **MCP** (Model Context Protocol) - Transport protocol for LLM-tool integration with payment capabilities
- **HTTP** - Standard HTTP client with x402 payment capabilities (TypeScript)

**Key Components:**

Expand Down
27 changes: 23 additions & 4 deletions typescript/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TypeScript SDK - Ampersend

TypeScript SDK for integrating [x402](https://github.com/coinbase/x402) payment capabilities into MCP (Model Context Protocol) applications. Supports client, proxy, and server implementations with EOA and Smart Account wallets.
TypeScript SDK for integrating [x402](https://github.com/coinbase/x402) payment capabilities into MCP (Model Context Protocol) and HTTP applications. Supports client, proxy, and server implementations with EOA and Smart Account wallets.

## Installation

Expand Down Expand Up @@ -66,6 +66,23 @@ mcp.addTool({
})
```

### HTTP Client

```typescript
import { createAmpersendHttpClient } from "@ampersend_ai/ampersend-sdk"
import { x402Client } from "@x402/core/client"
import { wrapFetchWithPayment } from "@x402/fetch"

const client = createAmpersendHttpClient({
client: new x402Client(),
smartAccountAddress: "0x...",
sessionKeyPrivateKey: "0x...",
})

const fetchWithPay = wrapFetchWithPayment(fetch, client)
const response = await fetchWithPay("https://paid-api.example.com/resource")
```

## Core Concepts

### X402Treasurer
Expand Down Expand Up @@ -100,7 +117,8 @@ BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS=0x...
```typescript
import { ... } from "@ampersend_ai/ampersend-sdk" // Main
import { ... } from "@ampersend_ai/ampersend-sdk/x402" // Core x402
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/client" // Client
import { ... } from "@ampersend_ai/ampersend-sdk/x402/http" // HTTP client
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/client" // MCP client
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/proxy" // Proxy
import { ... } from "@ampersend_ai/ampersend-sdk/smart-account" // Smart accounts
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/server/fastmcp" // FastMCP
Expand All @@ -110,8 +128,9 @@ import { ... } from "@ampersend_ai/ampersend-sdk/mcp/server/fastmcp" // FastMCP

Detailed implementation guides:

- **[MCP Client](./packages/ampersend-sdk/src/mcp/client/README.md)** - Client implementation and payment retry logic
- **[MCP Proxy](./packages/ampersend-sdk/src/mcp/proxy/README.md)** - HTTP proxy server architecture
- **[HTTP Client](./packages/ampersend-sdk/src/x402/http/README.md)** - HTTP x402 client adapter
- **[MCP Client](./packages/ampersend-sdk/src/mcp/client/README.md)** - MCP client with payment retry logic
- **[MCP Proxy](./packages/ampersend-sdk/src/mcp/proxy/README.md)** - MCP proxy server architecture
- **[SDK Package](./packages/ampersend-sdk/README.md)** - Package overview

## Development
Expand Down
21 changes: 20 additions & 1 deletion typescript/packages/ampersend-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @ampersend_ai/ampersend-sdk

TypeScript SDK for integrating [x402](https://github.com/coinbase/x402) payment capabilities into MCP (Model Context Protocol) applications.
TypeScript SDK for integrating [x402](https://github.com/coinbase/x402) payment capabilities into MCP (Model Context Protocol) and HTTP applications.

## Quick Start

Expand All @@ -17,11 +17,29 @@ const client = await createAmpersendMcpClient({
const result = await client.callTool("my_tool", { arg: "value" })
```

### HTTP Client

```typescript
import { createAmpersendHttpClient } from "@ampersend_ai/ampersend-sdk"
import { x402Client } from "@x402/core/client"
import { wrapFetchWithPayment } from "@x402/fetch"

const client = createAmpersendHttpClient({
client: new x402Client(),
smartAccountAddress: "0x...",
sessionKeyPrivateKey: "0x...",
})

const fetchWithPay = wrapFetchWithPayment(fetch, client)
const response = await fetchWithPay("https://paid-api.example.com/resource")
```

## Package Exports

```typescript
import { ... } from "@ampersend_ai/ampersend-sdk" // Main
import { ... } from "@ampersend_ai/ampersend-sdk/x402" // Core x402
import { ... } from "@ampersend_ai/ampersend-sdk/x402/http" // HTTP client
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/client" // MCP client
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/proxy" // MCP proxy
import { ... } from "@ampersend_ai/ampersend-sdk/smart-account" // Smart accounts
Expand All @@ -34,6 +52,7 @@ import { ... } from "@ampersend_ai/ampersend-sdk/mcp/server/fastmcp" // FastMCP

### Module-Specific Docs

- [HTTP Client API](./src/x402/http/README.md)
- [MCP Client API](./src/mcp/client/README.md)
- [MCP Proxy API](./src/mcp/proxy/README.md)
- [FastMCP Example](../../examples/fastmcp-x402-server/README.md)
Expand Down
2 changes: 1 addition & 1 deletion typescript/packages/ampersend-sdk/src/mcp/proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pnpm --filter ampersend-sdk proxy:dev
```bash
BUYER_SMART_ACCOUNT_ADDRESS=0x... # Smart account address
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY=0x... # Session key
AMPERSEND_API_URL=https://api.staging.ampersend.ai # For spend limits
AMPERSEND_API_URL=https://api.ampersend.ai # For spend limits
```

### Standalone Alternative: EOA
Expand Down