JSPM

  • Created
  • Published
  • Downloads 14019
  • Score
    100M100P100Q136076F
  • License Proprietary

๐Ÿš€ AI-Powered Swarm Intelligence Platform - Gamified MCP Development with 70+ Tools

Package Exports

  • flow-nexus
  • flow-nexus/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (flow-nexus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Flow Nexus MCP Server

npm version License: MIT Node.js Version

Advanced Model Context Protocol (MCP) server with E2B sandbox deployment, Claude-Flow orchestration, and real-time Supabase integration. Features 50+ tools for multi-agent swarm coordination, gamified app store, and enterprise-grade AI workflows.

Created by ruv - https://neural-trader.ruv.io

Features

  • ๐Ÿค– 50+ MCP Tools - Complete toolset for AI orchestration
  • ๐Ÿฆ  Multi-Agent Swarms - Hierarchical, mesh, ring, and star topologies
  • ๐Ÿ“ฆ Enhanced E2B Sandboxes - Deploy with environment variables and API keys
  • ๐Ÿง  Claude Code Integration - Native support for Anthropic's Claude Code
  • โšก Real-time Supabase - Live data streaming and persistence
  • ๐ŸŽฎ Gamified App Store - rUv credits, challenges, and achievements
  • ๐Ÿš€ Neural Pattern Training - WASM-accelerated AI optimization
  • ๐Ÿค– DAA Autonomous Agents - Decentralized autonomous agent coordination
  • โœ… 100% Success Rate - Bulletproof error handling

๐Ÿ†• Enhanced Sandbox Features

  • Environment Variables - Pass API keys and configuration to sandboxes
  • Claude Code Template - Pre-configured Claude Code environments
  • Multi-Language Support - JavaScript, Python, Bash, Claude Code commands
  • Package Installation - Automatic npm/pip package installation on creation
  • Startup Scripts - Run initialization commands after sandbox creation
  • Runtime Configuration - Update sandbox settings and environment variables
  • Custom E2B Keys - Use your own E2B API keys for sandboxes

Quick Start

Installation

npm install -g @flow-nexus/daa-wasm-mcp

Initialize Configuration

daa-wasm-mcp init

Start Server

daa-wasm-mcp start

Configuration

Environment Variables

Create a .env file with the following variables:

# MCP Server Configuration
MCP_HOST=localhost
MCP_PORT=3001
NODE_ENV=development

# Supabase Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=your-service-key
SUPABASE_ANON_KEY=your-anon-key

# Authentication
JWT_SECRET=your-jwt-secret-key

# Redis Configuration (optional)
REDIS_URL=redis://localhost:6379

# WASM Configuration
WASM_PATH=./dist/daa-agents.wasm
WASM_MEMORY_LIMIT=256MB
WASM_THREAD_POOL_SIZE=4
WASM_SIMD_ENABLED=true

# Agent Configuration
MAX_CURATOR_AGENTS=3
MAX_PRICING_AGENTS=2
MAX_SECURITY_AGENTS=4
MAX_RECOMMENDATION_AGENTS=2

Configuration File

Alternatively, use a JSON configuration file:

{
  "host": "localhost",
  "port": 3001,
  "supabase": {
    "url": "https://your-project.supabase.co",
    "serviceKey": "your-service-key"
  },
  "wasm": {
    "wasmPath": "./dist/daa-agents.wasm",
    "memoryLimit": "256MB",
    "simdEnabled": true,
    "threadPoolSize": 4
  },
  "auth": {
    "jwtSecret": "your-jwt-secret"
  },
  "cors": {
    "origins": ["http://localhost:5173"]
  }
}

DAA Agent Types

Curator Agent

  • Purpose: Automated application quality assessment
  • Functions: assess_quality, batch_review, train_model
  • Configuration: Quality thresholds, auto-approval settings

Pricing Agent

  • Purpose: Dynamic pricing analysis and optimization
  • Functions: analyze_pricing, update_market_data, optimize_price
  • Configuration: Price elasticity, market cap, volatility thresholds

Security Agent

  • Purpose: Security vulnerability scanning and compliance
  • Functions: scan_repository, analyze_vulnerabilities, generate_report
  • Configuration: Scan depth, CVE database, parallel scan limits

Recommendation Agent

  • Purpose: Personalized application recommendations
  • Functions: generate_recommendations, update_user_profile, train_embedding
  • Configuration: Model type, embedding dimensions, update frequency

MCP Tools

Agent Management

  • daa_agent_spawn - Spawn new DAA agents
  • daa_agent_list - List active agents
  • daa_agent_metrics - Get agent performance metrics
  • daa_agent_terminate - Terminate specific agents

Agent Operations

  • daa_agent_execute - Execute functions on agents
  • daa_agent_train - Train ML models within agents

Application Operations

  • daa_assess_quality - Assess application quality
  • daa_analyze_pricing - Analyze optimal pricing
  • daa_security_scan - Perform security scans
  • daa_generate_recommendations - Generate recommendations

Real-time Coordination

The server automatically responds to real-time events from Supabase:

  • New Applications: Triggers quality assessment and security scanning
  • rUv Transactions: Updates market data for pricing optimization
  • App Installations: Updates recommendation models
  • Challenge Submissions: Analyzes code quality and provides feedback

API Endpoints

Health Check

GET /health

Metrics (Prometheus format)

GET /metrics

MCP Resources

  • daa://agents - List of active agents
  • daa://metrics - Performance metrics
  • daa://health - System health status

CLI Commands

Start Server

daa-wasm-mcp start [options]

Options:

  • -p, --port <port> - Port to listen on (default: 3001)
  • -h, --host <host> - Host to bind to (default: localhost)
  • --config <file> - Configuration file path
  • --env <file> - Environment file path

Initialize Configuration

daa-wasm-mcp init [--force]

Health Check

daa-wasm-mcp health [--url <url>]

Get Metrics

daa-wasm-mcp metrics [--url <url>] [--format json|prometheus]

Generate Test Token

daa-wasm-mcp generate-token --user-id <id> [options]

Authentication

The server uses JWT authentication with the following permissions structure:

User Levels

  • Level 1-2: Basic operations (read-only, quality assessment)
  • Level 3-4: Agent management (spawn, execute, train)
  • Level 5+: Administrative operations (terminate agents, system metrics)

JWT Token Structure

{
  "sub": "user-id",
  "username": "username",
  "developer_level": 3,
  "aud": "claude-agents",
  "iss": "flow-cloud-app-store"
}

Rate Limiting

Default rate limits (per hour):

  • daa_agent_list: 1000 requests
  • daa_assess_quality: 100 requests
  • daa_agent_spawn: 20 requests
  • daa_agent_train: 10 requests

Configure custom limits via Redis or in-memory store.

Monitoring

Built-in Metrics

  • Agent performance (tasks completed, execution time, error rate)
  • System metrics (CPU, memory, uptime)
  • Real-time throughput and success rates
  • Anomaly detection for high error rates and low throughput

Prometheus Integration

curl http://localhost:3001/metrics

Health Monitoring

curl http://localhost:3001/health

๐Ÿงช Enhanced Sandbox Examples

Create Claude Code Sandbox

// Create sandbox with Claude Code pre-installed
const sandbox = await server.executeTool('sandbox_create', {
  template: 'claude-code',
  name: 'my-claude-workspace',
  anthropic_key: process.env.ANTHROPIC_API_KEY,
  startup_script: 'claude --version && echo "Claude Code ready!"'
});

// Execute Claude Code commands
await server.executeTool('sandbox_execute', {
  sandbox_id: sandbox.sandbox_id,
  code: 'claude "Help me debug this code"',
  language: 'claude-code',
  env_vars: {
    ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY
  }
});

Multi-API Development Sandbox

// Create sandbox with multiple API integrations
const sandbox = await server.executeTool('sandbox_create', {
  template: 'node',
  name: 'multi-api-workspace',
  env_vars: {
    ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
    OPENAI_API_KEY: process.env.OPENAI_API_KEY,
    GITHUB_TOKEN: process.env.GITHUB_TOKEN,
    SUPABASE_URL: process.env.SUPABASE_URL,
    SUPABASE_ANON_KEY: process.env.SUPABASE_ANON_KEY
  },
  install_packages: ['@anthropic/sdk', 'openai', '@supabase/supabase-js'],
  timeout: 7200
});

Configure Existing Sandbox

// Add environment variables to existing sandbox
await server.executeTool('sandbox_configure', {
  sandbox_id: 'existing-sandbox-id',
  env_vars: {
    NEW_API_KEY: 'your-new-key',
    DEBUG: 'true'
  },
  anthropic_key: process.env.ANTHROPIC_API_KEY,
  install_packages: ['@anthropic/claude-code'],
  run_commands: [
    'claude --version',
    'npm list -g --depth=0'
  ]
});

Python AI Development

// Python sandbox for AI/ML development
const aiSandbox = await server.executeTool('sandbox_create', {
  template: 'python',
  name: 'ai-research-env',
  env_vars: {
    ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
    HUGGINGFACE_TOKEN: process.env.HUGGINGFACE_TOKEN
  },
  install_packages: ['anthropic', 'transformers', 'torch', 'numpy'],
  startup_script: 'python --version && pip list'
});

// Execute Python AI code
await server.executeTool('sandbox_execute', {
  sandbox_id: aiSandbox.sandbox_id,
  code: `
import anthropic
import os

# Verify API key is available
api_key = os.getenv('ANTHROPIC_API_KEY')
print(f"Anthropic API configured: {'Yes' if api_key else 'No'}")

# Initialize client
client = anthropic.Anthropic(api_key=api_key)
print("Anthropic client initialized successfully!")
  `,
  language: 'python'
});

Development

Prerequisites

  • Node.js 18+
  • TypeScript 5+
  • Supabase project
  • Redis (optional, for rate limiting)

Setup

git clone <repository>
cd daa-wasm-mcp
npm install
npm run build

Testing

npm test
npm run test:watch

Development Mode

npm run dev

Docker Deployment

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3001
CMD ["npm", "start"]

NPX Usage

Deploy the server instantly:

npx @flow-cloud/daa-wasm-mcp init
npx @flow-cloud/daa-wasm-mcp start

Performance

  • WASM SIMD: Up to 4x performance improvement for ML operations
  • Multi-threading: Parallel agent execution
  • Memory Efficiency: Configurable memory limits
  • Auto-scaling: Dynamic agent spawning based on workload
  • Connection Pooling: Efficient database connections

Security

  • JWT-based authentication
  • Role-based permissions
  • Rate limiting protection
  • Input validation with Zod schemas
  • CORS configuration
  • Environment-based secrets

Troubleshooting

Common Issues

  1. WASM Module Not Found

    • Ensure WASM_PATH points to a valid WASM file
    • Check file permissions
  2. Supabase Connection Failed

    • Verify SUPABASE_URL and SUPABASE_SERVICE_KEY
    • Check network connectivity
  3. JWT Authentication Failed

    • Ensure JWT_SECRET is set
    • Verify token format and expiration
  4. Rate Limit Exceeded

    • Check Redis connection
    • Adjust rate limits in configuration

Debug Mode

LOG_LEVEL=debug daa-wasm-mcp start

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes and add tests
  4. Submit a pull request

License

MIT License - see LICENSE file for details

Support