---
title: API Reference
description: Complete API documentation for Universal Crypto MCP packages
category: reference
keywords: [api, documentation, reference, typescript]
order: 1
published: true
---
# API Reference
**Comprehensive TypeScript API documentation** for all Universal Crypto MCP packages.
## π¦ Package Categories
### Core & Infrastructure
- **[@nirholas/universal-crypto-mcp](./core)** - Core MCP server with 380+ tools
- **[@nirholas/shared](./shared)** - Shared utilities, types, and helpers
- **[@nirholas/infrastructure](./infrastructure)** - Service discovery and load balancing
### DeFi Protocols
- **[@nirholas/defi](./defi)** - DeFi protocol integrations
- Uniswap V2/V3, Aave, Compound V3, Curve Finance
- GMX V2, Lido, Yearn, PancakeSwap, Venus Protocol
- Layer 2 protocols (Arbitrum, Optimism, Base, zkEVM)
- BNB Chain DeFi ecosystem
### Wallets & Identity
- **[@nirholas/wallets](./wallets)** - Multi-chain wallet management
- EVM wallets (HD wallets, signing, transactions)
- Solana wallets (SPL tokens, programs)
- Gnosis Safe (multi-sig)
- ENS (domain resolution)
- WalletConnect (mobile connection)
###Trading & CEX
- **[@nirholas/trading](./trading)** - Centralized exchange integrations
- Binance (spot, futures, portfolio)
- Binance US
- Trading bots (memecoin, BSC)
### Market Data & Analytics
- **[@nirholas/market-data](./market-data)** - 17+ data sources
- Price feeds (CoinGecko, CoinStats)
- Analytics (Dune, DefiLlama, Hive)
- Sentiment analysis
- News aggregation
- Technical indicators
### NFT & Gaming
- **[@nirholas/nft](./nft)** - NFT marketplace integrations
- OpenSea
- Blur
- Axie Infinity
### AI Agents
- **[@nirholas/agents](./agents)** - AI agent frameworks
- **Agenti** - General AI agent framework
- **UCAI** - Universal Crypto AI agent
- **DeFi Agents** - Specialized DeFi automation
- **Agent Library** - 505+ pre-built agent definitions (18 languages)
### Automation & Bots
- **[@nirholas/automation](./automation)** - Background automation
- Social media automation (Twitter/X)
- Volume bot system (14 sub-packages)
- Dust sweeper
- Monitoring tools
### Code Generators
- **[@nirholas/generators](./generators)** - Meta-tools for MCP creation
- **ABI to MCP** - Convert smart contract ABIs to MCP tools
- **Repo to MCP** - Generate MCP server from GitHub repository
- **Doc Extractor** - Extract documentation to llms.txt
- **Tool Registry** - Lyra Registry integration
- **Tool Discovery** - Automatic tool discovery
### Integrations
- **[@nirholas/integrations](./integrations)** - 30+ external MCP servers
- Blockchain explorers (Etherscan, BSCScan, etc.)
- Non-EVM chains (Solana, Aptos, Near, Cardano, etc.)
- Analytics platforms (Arkham, Nansen, Dune)
- Specialized tools (Rugcheck, Whale Watcher, DEX Aggregator)
### Security
- **[@nirholas/security](./security)** - Security tools
- Chain awareness
- MEV protection
- Rugpull detection
### Novel Primitives
- **[@nirholas/novel](./novel)** - Innovative crypto primitives
- Temporal Oracles
- Reputation Graphs
- Intent Solver
- Privacy Pools
- Quantum-Resistant signatures
### Payments & Marketplace
- **[@nirholas/marketplace](./marketplace)** - AI Service Marketplace
- Service registration and discovery
- Subscriptions and pricing
- On-chain reputation
- Analytics and revenue tracking
- **[@nirholas/credits](./credits)** - Credit purchase system
- Stripe integration
- Credit wallet management
- x402 conversion engine
- Auto top-up
- **[@nirholas/agent-wallet](./agent-wallet)** - Agent wallet SDK
- Wallet creation and management
- Spending policies
- Service allowlists
- MCP integration
### Dashboard
- **[@nirholas/dashboard](./dashboard)** - Analytics dashboard
- React components
- Real-time WebSocket updates
- Revenue charts
- Network health monitoring
## π Quick Reference
### Most Used Classes
```typescript
// Core MCP Server
import { MCPServer, Tool, Resource } from '@nirholas/universal-crypto-mcp'
// DeFi Operations
import { UniswapV3Client, AaveClient } from '@nirholas/defi'
// Wallet Management
import { EVMWallet, SolanaWallet } from '@nirholas/wallets'
// Market Data
import { CoinGeckoClient, DuneAnalytics } from '@nirholas/market-data'
// x402 Payments
import { x402Client, x402Middleware } from '@nirholas/x402'
// Marketplace
import { MarketplaceClient, ServiceRegistry } from '@nirholas/marketplace'
// Credits
import { CreditService, StripeIntegration } from '@nirholas/credits'
// Agent Wallet
import { WalletManager, SpendingPolicy } from '@nirholas/agent-wallet'
```
### Common Patterns
#### Initialize MCP Server
```typescript
import { MCPServer } from '@nirholas/universal-crypto-mcp'
const server = new MCPServer({
name: 'my-crypto-mcp',
version: '1.0.0',
chains: ['ethereum', 'arbitrum', 'polygon']
})
await server.start()
```
#### DeFi Swap
```typescript
import { UniswapV3Client } from '@nirholas/defi'
const uniswap = new UniswapV3Client({
chain: 'arbitrum',
rpcUrl: process.env.ARBITRUM_RPC
})
const quote = await uniswap.quoteExactInput({
tokenIn: 'USDC',
tokenOut: 'WETH',
amountIn: '1000000000', // 1000 USDC
slippage: 0.5
})
```
#### x402 Payment
```typescript
import { x402Client } from '@nirholas/x402'
const client = x402Client({
wallet: process.env.AGENT_WALLET_KEY,
autoPayment: true,
maxPrice: '1.00'
})
// Automatically pays if API requires payment
const data = await client.get('https://premium-api.com/data')
```
#### Marketplace Registration
```typescript
import { MarketplaceClient } from '@nirholas/marketplace'
const marketplace = new MarketplaceClient()
await marketplace.registerService({
name: 'Premium Weather API',
description: 'Accurate weather forecasts',
pricing: {
type: 'pay-per-use',
price: '0.01',
currency: 'USDC'
},
endpoint: 'https://api.weather.com/v1'
})
```
## π Documentation Structure
### Package Documentation Includes:
- **Classes** - All exported classes with constructors, methods, properties
- **Interfaces** - Type definitions and contracts
- **Functions** - Standalone functions and utilities
- **Types** - Type aliases and enums
- **Examples** - Working code samples
- **Source Links** - Direct links to GitHub source code
### JSDoc Standards
All APIs follow consistent JSDoc patterns:
```typescript
/**
* Brief description of the class/function
*
* @remarks
* Detailed explanation of functionality, use cases, and considerations
*
* @example
* ```typescript
* const instance = new MyClass({ option: 'value' })
* await instance.doSomething()
* ```
*
* @see {@link RelatedClass} for related functionality
* @category CategoryName
*/
```
## π Navigation
Use the sidebar to browse:
- **By Category** - Explore packages by functional area
- **By Package** - Dive into specific package documentation
- **By Symbol** - Search for classes, functions, types
## π οΈ Using the API Reference
### Finding What You Need
1. **Browse by Category** - Start with the category that matches your use case
2. **Search** - Use the search bar to find specific APIs
3. **Follow Links** - Click on types and classes to see full documentation
4. **View Source** - Click source links to see implementation
### Understanding Signatures
```typescript
// Function signature
function swap(params: SwapParams): Promise<SwapResult>
// Breaking it down:
// - swap: function name
// - params: SwapParams: takes a SwapParams object
// - Promise<SwapResult>: returns a Promise resolving to SwapResult
// Click on SwapParams to see required fields
// Click on SwapResult to see what you get back
```
### Code Examples
Most API entries include runnable examples. You can:
- Copy examples directly
- Modify for your use case
- Find links to full example projects
## π API Versioning
Packages follow semantic versioning:
- **Major** (1.0.0 β 2.0.0): Breaking changes
- **Minor** (1.0.0 β 1.1.0): New features, backward compatible
- **Patch** (1.0.0 β 1.0.1): Bug fixes
Check package.json for current versions.
## π€ Contributing
When adding new APIs:
1. **JSDoc Comments** - Add comprehensive JSDoc to all exports
2. **Examples** - Include `@example` tags with working code
3. **Type Safety** - Use TypeScript strictly
4. **Tests** - Write tests for all public APIs
5. **Regenerate Docs** - Run `pnpm generate:api-docs`
## π Additional Resources
- [Getting Started Guide](/docs/getting-started)
- [Tutorials](/docs/tutorials)
- [Use Cases](/docs/use-cases)
- [GitHub Repository](https://github.com/nirholas/universal-crypto-mcp)
## π Reporting Issues
Found missing or incorrect documentation?
- [Open an Issue](https://github.com/nirholas/universal-crypto-mcp/issues/new?labels=documentation)
- [Join Discord](https://discord.gg/universal-crypto-mcp)
- [Edit on GitHub](https://github.com/nirholas/universal-crypto-mcp/tree/main/packages)
---
*API documentation is extracted from TypeScript source code.*
*Last updated: {{ new Date().toISOString().split('T')[0] }}*