Skip to content

Commit 933c9ad

Browse files
Merge pull request #43 from edgeandnode/ma/ASND-161-simplify-setup-003
ASND-161 add HTTP to docs, default to production
2 parents 8916690 + 5b3f14e commit 933c9ad

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ patterns. See [x402 specification](https://github.com/coinbase/x402).
5959

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

6364
**Key Components:**
6465

typescript/README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TypeScript SDK - Ampersend
22

3-
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.
3+
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.
44

55
## Installation
66

@@ -66,6 +66,23 @@ mcp.addTool({
6666
})
6767
```
6868

69+
### HTTP Client
70+
71+
```typescript
72+
import { createAmpersendHttpClient } from "@ampersend_ai/ampersend-sdk"
73+
import { x402Client } from "@x402/core/client"
74+
import { wrapFetchWithPayment } from "@x402/fetch"
75+
76+
const client = createAmpersendHttpClient({
77+
client: new x402Client(),
78+
smartAccountAddress: "0x...",
79+
sessionKeyPrivateKey: "0x...",
80+
})
81+
82+
const fetchWithPay = wrapFetchWithPayment(fetch, client)
83+
const response = await fetchWithPay("https://paid-api.example.com/resource")
84+
```
85+
6986
## Core Concepts
7087

7188
### X402Treasurer
@@ -100,7 +117,8 @@ BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS=0x...
100117
```typescript
101118
import { ... } from "@ampersend_ai/ampersend-sdk" // Main
102119
import { ... } from "@ampersend_ai/ampersend-sdk/x402" // Core x402
103-
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/client" // Client
120+
import { ... } from "@ampersend_ai/ampersend-sdk/x402/http" // HTTP client
121+
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/client" // MCP client
104122
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/proxy" // Proxy
105123
import { ... } from "@ampersend_ai/ampersend-sdk/smart-account" // Smart accounts
106124
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/server/fastmcp" // FastMCP
@@ -110,8 +128,9 @@ import { ... } from "@ampersend_ai/ampersend-sdk/mcp/server/fastmcp" // FastMCP
110128
111129
Detailed implementation guides:
112130
113-
- **[MCP Client](./packages/ampersend-sdk/src/mcp/client/README.md)** - Client implementation and payment retry logic
114-
- **[MCP Proxy](./packages/ampersend-sdk/src/mcp/proxy/README.md)** - HTTP proxy server architecture
131+
- **[HTTP Client](./packages/ampersend-sdk/src/x402/http/README.md)** - HTTP x402 client adapter
132+
- **[MCP Client](./packages/ampersend-sdk/src/mcp/client/README.md)** - MCP client with payment retry logic
133+
- **[MCP Proxy](./packages/ampersend-sdk/src/mcp/proxy/README.md)** - MCP proxy server architecture
115134
- **[SDK Package](./packages/ampersend-sdk/README.md)** - Package overview
116135
117136
## Development

typescript/packages/ampersend-sdk/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @ampersend_ai/ampersend-sdk
22

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

55
## Quick Start
66

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

20+
### HTTP Client
21+
22+
```typescript
23+
import { createAmpersendHttpClient } from "@ampersend_ai/ampersend-sdk"
24+
import { x402Client } from "@x402/core/client"
25+
import { wrapFetchWithPayment } from "@x402/fetch"
26+
27+
const client = createAmpersendHttpClient({
28+
client: new x402Client(),
29+
smartAccountAddress: "0x...",
30+
sessionKeyPrivateKey: "0x...",
31+
})
32+
33+
const fetchWithPay = wrapFetchWithPayment(fetch, client)
34+
const response = await fetchWithPay("https://paid-api.example.com/resource")
35+
```
36+
2037
## Package Exports
2138

2239
```typescript
2340
import { ... } from "@ampersend_ai/ampersend-sdk" // Main
2441
import { ... } from "@ampersend_ai/ampersend-sdk/x402" // Core x402
42+
import { ... } from "@ampersend_ai/ampersend-sdk/x402/http" // HTTP client
2543
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/client" // MCP client
2644
import { ... } from "@ampersend_ai/ampersend-sdk/mcp/proxy" // MCP proxy
2745
import { ... } from "@ampersend_ai/ampersend-sdk/smart-account" // Smart accounts
@@ -34,6 +52,7 @@ import { ... } from "@ampersend_ai/ampersend-sdk/mcp/server/fastmcp" // FastMCP
3452
3553
### Module-Specific Docs
3654
55+
- [HTTP Client API](./src/x402/http/README.md)
3756
- [MCP Client API](./src/mcp/client/README.md)
3857
- [MCP Proxy API](./src/mcp/proxy/README.md)
3958
- [FastMCP Example](../../examples/fastmcp-x402-server/README.md)

typescript/packages/ampersend-sdk/src/mcp/proxy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pnpm --filter ampersend-sdk proxy:dev
8989
```bash
9090
BUYER_SMART_ACCOUNT_ADDRESS=0x... # Smart account address
9191
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY=0x... # Session key
92-
AMPERSEND_API_URL=https://api.staging.ampersend.ai # For spend limits
92+
AMPERSEND_API_URL=https://api.ampersend.ai # For spend limits
9393
```
9494

9595
### Standalone Alternative: EOA

0 commit comments

Comments
 (0)