npm package: @getaide/sdk
Description: AIDE SDK, CLI & MCP Server - Extract structured data from documents using AI
Author: AIDE
Latest version: 0.1.1

# @getaide/sdk

SDK, CLI, and MCP Server for [AIDE](https://datatera.ai) - Extract structured data from documents using AI.

## Installation

```bash
# As SDK dependency
npm install @getaide/sdk

# As global CLI
npm install -g @getaide/sdk

# Run without installing
npx @getaide/sdk --help
```

## SDK Usage

```typescript
import { AideClient, JwtAuth, ApiKeyAuth } from '@getaide/sdk';

// Set AIDE_BASE_URL env var or pass baseUrl explicitly
// e.g. AIDE_BASE_URL=https://aide.datatera.ai

// API key auth (limited to published endpoints)
const client = new AideClient({
  baseUrl: 'https://aide.datatera.ai',
  auth: new ApiKeyAuth('your-api-key'),
});

// JWT auth (full access)
const jwt = await JwtAuth.login('https://aide.datatera.ai', 'email@example.com', 'password');
const client = new AideClient({
  baseUrl: 'https://aide.datatera.ai',
  auth: jwt,
});

// Upload and process a file
const result = await client.published.processAndWait(
  'transformation-id',
  fileBlob,
  'invoice.pdf',
);

// List projects
const projects = await client.projects.list(userId);

// Get transformation data
const data = await client.transformations.getData('transformation-id');
```

## CLI Usage

```bash
# Login
aide auth login --email user@example.com --password secret
aide auth login --api-key your-api-key

# Projects
aide projects list
aide projects create "My Project"

# Transformations
aide transformations list
aide tdata <transformation-id>

# Process files
aide process upload invoice.pdf -t <transformation-id>
aide pstatus <job-id>
aide presults <job-id>

# History
aide history list -t <transformation-id>
aide history download <history-id> -f excel

# JSON output
aide projects list --json
```

## MCP Server

Use with Claude Desktop, Cursor, VS Code, or any MCP-compatible AI assistant.

### Claude Desktop / Cursor

Add to your MCP settings:

```json
{
  "mcpServers": {
    "datatera": {
      "command": "npx",
      "args": ["-y", "@getaide/sdk", "--mcp"],
      "env": {
        "AIDE_API_KEY": "your-api-key",
        "AIDE_BASE_URL": "https://aide.datatera.ai"
      }
    }
  }
}
```

Or with the dedicated binary:

```json
{
  "mcpServers": {
    "datatera": {
      "command": "aide-mcp",
      "env": {
        "AIDE_JWT_TOKEN": "your-jwt-token",
        "AIDE_USER_ID": "your-user-id",
        "AIDE_BASE_URL": "https://aide.datatera.ai"
      }
    }
  }
}
```

### Environment Variables

| Variable | Description |
|----------|-------------|
| `AIDE_API_KEY` | API key authentication |
| `AIDE_JWT_TOKEN` | JWT token authentication |
| `AIDE_USER_ID` | User ID (required with JWT for some tools) |
| `AIDE_BASE_URL` | API base URL (default: `https://aide.datatera.ai`) |
| `AIDE_PRODUCT_NAME` | Custom product name for white-label (default: `AIDE`) |

### Available MCP Tools

| Tool | Description |
|------|-------------|
| `list_projects` | List all projects |
| `get_project` | Get project details with transformations |
| `create_project` | Create a new project |
| `list_transformations` | List transformations |
| `create_transformation` | Create a transformation |
| `get_transformation_data` | Get extracted data |
| `upload_and_process` | Upload and process a file |
| `get_job_status` | Check processing status |
| `list_history` | List processing history |
| `download_result` | Get result details |
| `list_datamarts` | List datamarts |
| `run_datamart` | Execute datamart query |
| `get_datamart_data` | Get datamart results |
| `run_agent` | Trigger DQ agent or Decision Board |
| `get_agent_status` | Check agent status |
| `list_agent_templates` | List agent templates |
| `smart_project_upload` | Upload files for Smart Project |
| `smart_project_status` | Check Smart Project status |

## White-Label Support

The SDK supports custom branding via environment variables:

```bash
AIDE_BASE_URL=https://app.aidataextractor.pro
AIDE_PRODUCT_NAME="AI Data Extractor"
```

Works with any AIDE-powered instance including:
- `aide.datatera.ai` (default)
- `app.aidataextractor.pro` (Russian market)
- Custom white-label deployments

## License

MIT