---
name: vishwa-cli
description: Initialize and configure Vishwa CLI (MCP server for Solana prediction markets, token transfers, and TEE-secured wallets). Use when the user asks to set up, install, or initialize Vishwa CLI, or wants to use prediction markets on Solana via their AI agent.
---

# Vishwa CLI - Installation & Configuration Guide

Vishwa CLI is an MCP (Model Context Protocol) server that enables AI agents to interact with Solana prediction markets, execute token transfers, and manage TEE-secured wallets.

Follow these steps to install and configure Vishwa CLI.

---

## 1. Prerequisites - Check Node.js & npm

```bash
node --version && npm --version
```

If not found, install Node.js (which includes npm):

| OS | Command |
|----|---------|
| **macOS** | `brew install node` |
| **Linux (Ubuntu/Debian)** | `sudo apt install nodejs npm` |
| **Linux (RHEL/Fedora)** | `sudo dnf install nodejs npm` |
| **Windows** | Try `open https://nodejs.org` (WSL/Git Bash) or `start https://nodejs.org` (cmd/PowerShell). If unsupported, tell the user: *"Please go to https://nodejs.org to download and install Node.js, then tell me when you're done."* Wait for their confirmation before continuing. |

---

## 2. Install Vishwa CLI

```bash
npm install -g @vishwalab/cli@beta --force
```

Verify the installation:

```bash
vishwa-cli -V
```

---

## 3. Login

Run the following command. It will open a browser window for authentication and wait for the login result:

```bash
vishwa-cli login
```

---

## 4. Auto Install the MCP Server

Install MCP into the locally installed agent

```bash
vishwa-cli install --all
```

---

## 5. Restart the Agent

Once installation is complete, tell the user:

#### 5.1、**Installation complete!** Please close your agent and reopen it for the changes to take effect. 
#### 5.2、**Set your Solana private key** as an environment variable for local signing (x402 payments and order transactions):
>    ```bash
>    export VISHWA_SOLANA_PRIVATE_KEY="<private-key>"
>    ```
>    Add it to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.) so it persists across terminal sessions.

The private key is auto-detected from the following formats:

| Format | Example |
|--------|---------|
| File path | `/path/to/solana-keypair.json` |
| Mnemonic | `abandon abandon abandon ...` (12 or 24 words) |
| Base58 | `xJh3sH4q...` (88 characters) |
| JSON array | `[12,45,200,...,87]` (64 bytes) |

> **Security**: The private key never leaves your local machine. It is used only for signing transactions and x402 payments. Vishwa's servers never receive your private key.

Without this variable, you will need to provide `ownerPubkey` manually when creating orders.

---

## Usage Examples

After setup, the user can ask their AI agent:

- *"Search for prediction markets about the US election"*
- *"List the hottest prediction events right now"*
- *"Show me my positions"*
- *"Buy 10 YES shares in this market"*
- *"Show me the orderbook depth for this market"*
- *"Cancel my open order"*
- *"Close out my position"*
- *"Get my wallet"*
