Mariposa is a comprehensive decentralized AI-powered crypto trading platform built on the SEI blockchain. The platform combines advanced AI agents, smart contract automation, and real-time market data to provide autonomous trading capabilities.
Mariposa consists of four main components working together:
- Frontend - Next.js web application with modern React UI
- Backend - Express.js API server with AI integration
- Market MCP - Model Context Protocol server for market data
- Agent SDK - TypeScript SDK for SEI blockchain trading operations
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │────│ Backend │────│ Market MCP │
│ (Next.js) │ │ (Express) │ │ (MCP Server) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ ┌─────────────────┐ │
└──────────────│ Agent SDK │──────────────┘
│ (Trading SDK) │
└─────────────────┘
- Node.js 18+
- MongoDB
- Git
git clone https://github.com/your-org/mariposa.git
cd mariposaCreate environment files for each component:
# Frontend environment
cp .env.local.example .env.local
# Backend environment
cp Backend/.env.example Backend/.env
# Edit the files with your configuration# Install frontend dependencies
npm install
# Install backend dependencies
cd Backend && npm install
# Install market-mcp dependencies
cd ../market-mcp && npm install
# Install agent-sdk dependencies
cd ../Backend/agent-sdk && npm install# Terminal 1: Start Backend
cd Backend
npm run dev
# Terminal 2: Start Frontend
npm run dev
# Terminal 3: Start Market MCP
cd market-mcp
npm run devVisit http://localhost:3002 to access the application.
Location: Root directory
Port: 3002
Framework: Next.js 14 with TypeScript
- Authentication System: OTP-based phone authentication
- Wallet Management: Crypto wallet creation and management
- Trading Dashboard: Real-time trading interface
- Agent Management: Create and manage AI trading agents
- Pipeline System: Automated trading pipeline configuration
- Portfolio Tracking: Real-time portfolio monitoring
- Framework: Next.js 14, React 18
- Styling: Tailwind CSS, Radix UI components
- State Management: Redux Toolkit with Redux Persist
- Authentication: JWT with OTP verification
- Charts: Recharts for data visualization
- Forms: React Hook Form
├── app/ # Next.js app router
│ ├── api/ # API routes
│ ├── auth/ # Authentication pages
│ ├── dashboard/ # Main dashboard
│ └── trading/ # Trading interface
├── components/ # React components
│ ├── ui/ # Base UI components (Radix)
│ ├── auth/ # Auth-related components
│ └── landing/ # Landing page components
├── lib/ # Utilities and configurations
├── hooks/ # Custom React hooks
└── public/ # Static assets
/- Landing page/auth- Authentication flow/dashboard- Main user dashboard/trading- Trading interface/agents- AI agent management/pipeline- Trading pipeline configuration
Location: ./Backend
Port: 5000
Framework: Express.js with Node.js
- User Management: Registration, authentication, profiles
- Wallet Service: Secure crypto wallet operations
- AI Agent Integration: AI-powered trading agents
- Trading Engine: Execute trades via smart contracts
- Pipeline System: Automated trading strategies
- Real-time Data: Market data and portfolio updates
- Framework: Express.js
- Database: MongoDB with Mongoose
- Authentication: JWT with bcryptjs
- AI Integration: Together AI API
- Blockchain: Ethers.js for SEI network
- Security: Helmet, CORS, rate limiting
Backend/
├── controllers/ # Route controllers
├── models/ # MongoDB models
├── routes/ # Express routes
├── services/ # Business logic services
├── middleware/ # Custom middleware
├── config/ # Configuration files
└── utils/ # Utility functions
POST /api/auth/send-otp- Send OTP for authenticationPOST /api/auth/verify-otp- Verify OTP and loginGET /api/users/profile- Get user profilePOST /api/wallets/create- Create new walletGET /api/wallets/balance- Get wallet balancePOST /api/agents/create- Create AI agentPOST /api/pipelines/create- Create trading pipeline
Location: ./market-mcp
Port: 3001
Type: MCP Server
- Real-time Market Data: Live price feeds and market information
- Trading Operations: Execute trades via MCP protocol
- Data Aggregation: Aggregate data from multiple sources
- Context Provision: Provide market context to AI agents
- Framework: Express.js with TypeScript
- Protocol: Model Context Protocol (MCP)
- Data Sources: Multiple market data providers
- Rate Limiting: Built-in rate limiting
get_market_data- Fetch current market pricesget_historical_data- Get historical price dataexecute_trade- Execute trading operationsget_portfolio- Retrieve portfolio information
Location: ./Backend/agent-sdk
Package: @mariposa-plus/agent-sdk
Version: 1.0.2
- SEI Network Integration: Native SEI blockchain support
- Smart Contract Interaction: Interact with trading contracts
- Wallet Management: Secure wallet operations
- Trading Operations: Execute swaps, transfers, and trades
- Type Safety: Full TypeScript support
- Language: TypeScript
- Blockchain: Ethers.js v5
- Network: SEI EVM
- Math: BigNumber.js for precision
import { SimpleAgent } from '@mariposa-plus/agent-sdk';
const agent = new SimpleAgent({
privateKey: 'your-private-key',
rpcUrl: 'https://evm-rpc.arctic-1.seinetwork.io'
});
// Execute a token swap
await agent.swapTokens({
tokenIn: 'WSEI',
tokenOut: 'USDC',
amountIn: '1.0',
slippage: 0.01
});# Backend API URL
NEXT_PUBLIC_API_URL=http://localhost:5000
# JWT Configuration
NEXT_PUBLIC_JWT_SECRET=your-super-secret-jwt-key-here
# App Configuration
NEXT_PUBLIC_APP_NAME=Mariposa
NEXT_PUBLIC_APP_DESCRIPTION=AI-Powered Crypto Trading Platform
# Development Settings
NODE_ENV=development
NEXT_PUBLIC_DEBUG=true# Server Configuration
PORT=5000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/mariposa
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRE=24h
# AI Configuration
TOGETHER_API_KEY=your-together-ai-api-key-here
# SEI Network Configuration
SEI_RPC_URL=https://evm-rpc.arctic-1.seinetwork.io
SEI_CHAIN_ID=arctic-1
AGENTIC_ROUTER_ADDRESS=0x1234567890123456789012345678901234567890
# Token Addresses (SEI Arctic Testnet)
WSEI_ADDRESS=0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7
USDC_ADDRESS=0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1
USDT_ADDRESS=0x9151434b16b9763660705744891fa906f660ecc5
# Security
WALLET_ENCRYPTION_KEY=change_this_to_a_secure_key_in_production
BCRYPT_SALT_ROUNDS=12npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLintnpm run dev # Start with nodemon
npm start # Start production server
npm run fix-agent-sdk # Fix agent-sdk issuesnpm run dev # Start development server
npm run build # Build TypeScript
npm start # Start production servernpm run build # Build TypeScript
npm run dev # Watch mode development
npm run example # Run example usage- Start all services in development mode
- Frontend:
http://localhost:3002 - Backend API:
http://localhost:5000 - Market MCP:
http://localhost:3001
- Backend API:
http://localhost:5000/api-docs(Swagger) - Market MCP:
http://localhost:3001/docs
cd Backend
node test-auth.js # Test authentication
node test-wallet-system.js # Test wallet functionality
node test-agents.js # Test AI agentscd Backend/agent-sdk
node test-sdk.js # Test SDK functionality
npm run example # Run example usage# Build frontend
npm run build
# Install backend production dependencies
cd Backend && npm ci --only=production
# Build market-mcp
cd ../market-mcp && npm run build
# Build agent-sdk
cd ../Backend/agent-sdk && npm run build- Set
NODE_ENV=productionin all environment files - Configure production database URLs
- Set secure JWT secrets
- Configure production RPC URLs
- Set up proper CORS origins
- Environment variables configured
- Database connections tested
- JWT secrets are secure and unique
- API keys are valid
- CORS is properly configured
- Rate limiting is enabled
- SSL certificates are installed
- All dependencies are installed
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check the individual README files in each component directory
- Issues: Report bugs and request features via GitHub Issues
- Discord: Join our community Discord server (link TBD)
- Agent SDK NPM Package: @mariposa-plus/agent-sdk
- SEI Network Documentation: https://docs.sei.io/
- Smart Contracts: See
./smart-contracts/directory
Built with ❤️ by the Mariposa Team