npm package: @openmobile/mcp-server
Description: OpenMobile MCP Server - AI-powered SDK integration and analytics
Author: OpenMobile Team
Latest version: 0.1.2

# @openmobile/mcp-server

OpenMobile MCP (Model Context Protocol) Server - Connect AI assistants to your mobile analytics and SDUI platform.

## Quick Start

```bash
# Initialize OpenMobile in your project
npx @openmobile/mcp-server init

# This will:
# 1. Detect your framework (React Native, Flutter, iOS, Android, Web)
# 2. Authenticate with your API key
# 3. Analyze your codebase for screens and events
# 4. Install the appropriate SDK
# 5. Configure MCP for your AI tools (Claude, Cursor, VS Code)
# 6. Verify the integration works
```

## CLI Commands

### `init`
Complete interactive setup wizard. Handles everything from authentication to SDK installation and MCP configuration.

```bash
npx @openmobile/mcp-server init
```

### `integrate`
SDK integration only (skip MCP configuration).

```bash
npx @openmobile/mcp-server integrate
```

### `configure`
Configure MCP for AI tools.

```bash
npx @openmobile/mcp-server configure
```

### `doctor`
Verify your installation and check for issues.

```bash
npx @openmobile/mcp-server doctor
```

### `status`
Display current configuration status.

```bash
npx @openmobile/mcp-server status
```

### `serve`
Start the MCP server (used by AI tools).

```bash
npx @openmobile/mcp-server serve
```

## MCP Tools

Once configured, AI assistants can use these tools:

### Analysis
- **analyze_project** - Detect framework, screens, and suggest events
- **generate_integration** - Generate SDK integration code
- **validate_integration** - Verify SDK is working

### Analytics
- **get_insights** - Retrieve behavioral insights
- **get_analytics** - Get analytics data (events, screens, users, sessions)
- **get_funnel** - Analyze conversion funnels

### SDUI
- **list_screens** - List all SDUI screens
- **create_screen** - Create a new SDUI screen (survey, onboarding, tooltip, modal, banner)
- **deploy_screen** - Deploy a screen to production with optional rollout percentage

## Supported Frameworks

| Framework | SDK Package |
|-----------|-------------|
| Expo | `@openmobile/react-native` |
| React Native | `@openmobile/react-native` |
| Flutter | `openmobile_sdk` |
| iOS (Swift) | `OpenMobileSDK` |
| Android (Kotlin) | `com.openmobile:sdk` |
| Web (React) | `@openmobile/web` |

## AI Tool Configuration

### Claude Desktop

Config location: `~/.claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "openmobile": {
      "command": "npx",
      "args": ["-y", "@openmobile/mcp-server", "serve"],
      "env": {
        "OPENMOBILE_API_KEY": "pk_your_key_here"
      }
    }
  }
}
```

### Cursor

Config location: `~/.cursor/mcp.json`

```json
{
  "servers": {
    "openmobile": {
      "command": "npx",
      "args": ["-y", "@openmobile/mcp-server", "serve"],
      "env": {
        "OPENMOBILE_API_KEY": "pk_your_key_here"
      }
    }
  }
}
```

### VS Code (Continue Extension)

Config location: `~/.continue/config.json`

```json
{
  "mcpServers": [
    {
      "name": "openmobile",
      "command": "npx",
      "args": ["-y", "@openmobile/mcp-server", "serve"],
      "env": {
        "OPENMOBILE_API_KEY": "pk_your_key_here"
      }
    }
  ]
}
```

## Project Configuration

After running `init`, a `.openmobilerc` file is created in your project:

```json
{
  "version": "1.0",
  "apiKey": "pk_****...",
  "framework": "expo",
  "screens": ["home", "profile", "settings"],
  "events": ["purchase_complete", "signup_complete"],
  "createdAt": "2024-01-15T10:00:00Z",
  "updatedAt": "2024-01-15T10:00:00Z"
}
```

## Environment Variables

- `OPENMOBILE_API_KEY` - Your OpenMobile API key (pk_* for publishable, sk_* for secret)

## Development

```bash
# Clone the repository
git clone https://github.com/openmobile-dev/openmobile.git
cd openmobile/mcp-server

# Install dependencies
npm install

# Build
npm run build

# Test locally
npm run dev
```

## License

MIT