rickydata SDK
The rickydata SDK is the official TypeScript SDK for interacting with KnowledgeFlowDB. It handles authentication, payment signing, and provides typed APIs for all endpoints.
Installation
npm install @nickydata/sdk
Core Modules
| Module | Purpose |
|---|---|
| AuthManager | Wallet authentication (challenge/verify, wallet tokens, GitHub OIDC) |
| SpendingWallet | x402 payment signing with spending limits and circuit breakers |
| ToolsManager | MCP tool execution with automatic 402 payment handling |
Quick Example
import { AuthManager } from '@nickydata/sdk';
// 1. Create auth manager
const auth = new AuthManager('https://api.knowledgedataflow.org');
// 2. Authenticate with wallet
await auth.authenticateAuto({
signFn: wallet.signMessage,
walletAddress: wallet.address,
});
// 3. Make authenticated requests
const response = await auth.fetchWithAuth(
'https://api.knowledgedataflow.org/api/v1/query',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query: 'MATCH (n:File) RETURN n.path, n.size LIMIT 10'
}),
}
);
const data = await response.json();
console.log(data);
Authentication Strategies
The SDK supports multiple auth strategies for different environments:
| Strategy | Use Case | Token Type |
|---|---|---|
authenticateAuto() | Production (auto-selects best method) | mcpwt_ or JWT |
authenticateWithWalletToken() | Persistent connections | mcpwt_ (survives restarts) |
authenticateWithSignature() | Standard web apps | JWT (24h) |
authenticateWithGitHubOIDC() | CI/CD pipelines | JWT |
See SDK Authentication for detailed usage of each strategy.
Payment Integration
For MCP tool calls that require x402 payment:
import { SpendingWallet } from '@nickydata/sdk';
const spendingWallet = await SpendingWallet.fromSeedPhrase(
process.env.SEED_PHRASE,
0,
{ maxPerDay: 5.0 } // Spending limits
);
// SpendingWallet handles payment signing automatically
// when integrated with ToolsManager
See x402 Payments for the full payment guide.
Next Steps
- Getting Started — Install, authenticate, make your first query
- SDK Authentication — Detailed auth strategy guide
- x402 Payments — Payment protocol and SpendingWallet