@atxp/client 0.2.14 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -103
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,107 +6,6 @@ ATXP Client - MCP client with OAuth authentication and payment processing capabi
|
|
|
6
6
|
|
|
7
7
|
The ATXP Client package provides a comprehensive solution for connecting to MCP (Model Context Protocol) servers that require OAuth authentication and payment processing. It handles the complete flow from initial connection through authentication, payment verification, and tool execution.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Getting Started
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- 🔐 **OAuth Authentication**: Full OAuth 2.0 flow implementation
|
|
14
|
-
- 💰 **Payment Processing**: Solana-based payment integration
|
|
15
|
-
- 🔌 **MCP Protocol**: Complete Model Context Protocol client implementation
|
|
16
|
-
- 📱 **Multi-Platform**: Supports Node.js and React Native/Expo environments
|
|
17
|
-
- 🛡️ **Type Safety**: Full TypeScript support with comprehensive type definitions
|
|
18
|
-
- 🔄 **Event System**: Real-time connection and authentication status updates
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @atxp/client
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Basic Usage
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
import { ATXPClient } from '@atxp/client';
|
|
30
|
-
|
|
31
|
-
const client = new ATXPClient({
|
|
32
|
-
serverUrl: 'http://localhost:3010',
|
|
33
|
-
clientId: 'your-oauth-client-id',
|
|
34
|
-
authServerUrl: 'https://auth.atxp.ai'
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Connect and authenticate
|
|
38
|
-
await client.connect();
|
|
39
|
-
|
|
40
|
-
// Call tools that require payment
|
|
41
|
-
const result = await client.callTool('hello_world', {
|
|
42
|
-
name: 'Alice',
|
|
43
|
-
message: 'Hello from ATXP!'
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Platform Support
|
|
48
|
-
|
|
49
|
-
- **Node.js**: Full support with in-memory OAuth database (install `@atxp/sqlite` for persistence)
|
|
50
|
-
- **React Native/Expo**: Requires `expo-crypto` peer dependency
|
|
51
|
-
|
|
52
|
-
## Authentication Flow
|
|
53
|
-
|
|
54
|
-
1. Client initiates connection to MCP server
|
|
55
|
-
2. Server responds with OAuth challenge
|
|
56
|
-
3. Client redirects user to authentication server
|
|
57
|
-
4. User completes OAuth flow and returns with authorization code
|
|
58
|
-
5. Client exchanges code for access token
|
|
59
|
-
6. Authenticated requests can now be made to the server
|
|
60
|
-
|
|
61
|
-
## Payment Processing
|
|
62
|
-
|
|
63
|
-
When a tool requires payment, the client automatically:
|
|
64
|
-
|
|
65
|
-
1. Detects payment requirement from server response
|
|
66
|
-
2. Creates Solana payment transaction
|
|
67
|
-
3. Prompts user to approve payment
|
|
68
|
-
4. Submits payment proof to server
|
|
69
|
-
5. Retries original tool call upon payment confirmation
|
|
70
|
-
|
|
71
|
-
## API Reference
|
|
72
|
-
|
|
73
|
-
### ATXPClient
|
|
74
|
-
|
|
75
|
-
Main client class for ATXP protocol communication.
|
|
76
|
-
|
|
77
|
-
#### Constructor Options
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
interface ATXPClientConfig {
|
|
81
|
-
serverUrl: string; // MCP server URL
|
|
82
|
-
clientId: string; // OAuth client ID
|
|
83
|
-
authServerUrl?: string; // Auth server URL (defaults to https://auth.atxp.ai)
|
|
84
|
-
oAuthDb?: OAuthDb; // Custom OAuth database implementation
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
#### Methods
|
|
89
|
-
|
|
90
|
-
- `connect()`: Establish connection to MCP server
|
|
91
|
-
- `disconnect()`: Close connection and cleanup resources
|
|
92
|
-
- `callTool(name, args)`: Execute server tool with automatic auth/payment handling
|
|
93
|
-
- `listTools()`: Get available tools from server
|
|
94
|
-
- `getAuthStatus()`: Check current authentication status
|
|
95
|
-
|
|
96
|
-
#### Events
|
|
97
|
-
|
|
98
|
-
- `authenticated`: Fired when OAuth flow completes successfully
|
|
99
|
-
- `paymentRequired`: Fired when tool execution requires payment
|
|
100
|
-
- `paymentCompleted`: Fired when payment is confirmed
|
|
101
|
-
- `error`: Fired on connection or protocol errors
|
|
102
|
-
|
|
103
|
-
## Examples
|
|
104
|
-
|
|
105
|
-
See the `examples/` directory for complete working examples:
|
|
106
|
-
|
|
107
|
-
- `examples/basic/`: Simple Node.js client implementation
|
|
108
|
-
- `examples/server/`: Compatible MCP server with payment requirements
|
|
109
|
-
|
|
110
|
-
## License
|
|
111
|
-
|
|
112
|
-
MIT
|
|
11
|
+
Learn more about ATXP in [the docs](https://docs.atxp.ai/atxp), and follow the [Agent Quickstart](https://docs.atxp.ai/client) to build your first ATXP-powered agent.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atxp/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "ATXP Client - MCP client with OAuth authentication and payment processing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "vitest run"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@atxp/common": "0.2.
|
|
25
|
+
"@atxp/common": "0.2.16",
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
27
27
|
"@solana/pay": "^0.2.5",
|
|
28
28
|
"@solana/web3.js": "^1.98.1",
|