# @umengfe/mcp-server-umeng-openapi

Node.js client library for the Youmeng MCP (Model Context Protocol) API, providing a series of encapsulations for Youmeng statistical data APIs.

## Installation

```bash
npm install @umengfe/mcp-server-umeng-openapi
```

## Configuration in Cursor
> Add the following content to the mcp.json file in Cursor:
```json
{
	"mcpServers": {
		"umeng-openapi": {
			"command": "npx",
			"args": [
        "-y",
        "@umengfe/mcp-server-umeng-openapi"
			],
			"env": {
				"UMENG_API_KEY": "xxx",
				"UMENG_API_SECRET": "xxx"
			}
		}
	}
}
```
> On Windows, you need to add separate configuration
```json
{
  "mcpServers": {
    "umeng-openapi": {
          "command": "cmd",
          "args": [
            "/c",
            "npx",
            "-y",
            "@umengfe/mcp-server-umeng-openapi"
          ],
          "env": {
            "UMENG_API_KEY": "xxx",
            "UMENG_API_SECRET": "xxx"
          }
        }
  }
}
```

## Youmeng OpenAPI Signature Helper Tool
> This library provides a signature helper tool. Input the API key and API security key, fill in the function and parameters to generate a signed request URL.

```typescript
import UmengOpenAPI from '@umengfe/mcp-server-umeng-openapi/dist/src/umopenapi.js';
const client = new UmengOpenAPI('your_api_key','your_api_security');
const signedUrl = client.generateSignedUrl('param2/1/com.umeng.uapp/umeng.uapp.getAllAppData', {a:1,b:2});
fetch(signedUrl).then(res => res.json()).then(data => console.log(data));
```

## API Documentation

### Youmeng Statistics Data

Get statistics data for all applications.

```typescript

// Example return data (numbers are for reference only)
{
  "allAppData": [
    {
      "yesterdayNewUsers": 1234,        // Yesterday's new users
      "yesterdayUniqNewUsers": 1234,    // Yesterday's unique new users
      "todayLaunches": 5000,            // Today's launches
      "totalUsers": 100000,             // Total users
      "todayNewUsers": 500,             // Today's new users
      "yesterdayUniqActiveUsers": 2000,  // Yesterday's unique active users
      "todayActivityUsers": 1500,        // Today's active users
      "yesterdayLaunches": 4800,         // Yesterday's launches
      "yesterdayActivityUsers": 2100     // Yesterday's active users
    }
  ]
}
```

## License

MIT

## Changelog

### [1.0.6] - 2025-05-20
#### Fixed
- Fixed parameter extraction serialization error

### [1.0.5] - 2025-05-19
#### Added
- Get event parameter value duration list.
- Get App statistics data for today and yesterday.
- Get App statistics data for yesterday.
- Get App statistics data for today.
- Get unique users for custom events.
- Get channel dimension statistics.
- Get version dimension statistics.
- Get event parameter value statistics.
- Get event parameter value list.
- Get statistics for custom events.
- Get event parameter list.
- Get event list.
- Get new user retention rate for App.
- Get App usage duration.
- Get App launch times.
- Get App active users.
- Get App new users.
- Get App statistics.
- Create custom events.

### [1.0.4] - 2025-05-12
#### Added
- Get new accounts for a single application.
- Get active accounts for a single application.
- Get App launch times based on channel or version conditions.
- Get App active users based on channel or version conditions.
- Get App new users based on channel or version conditions.

### [1.0.3] - 2025-10-06
#### Added
- Added capability to get total number of all applications.
- Added capability to get application list.

## Frequently Asked Questions (FAQ)

- **How to obtain `UMENG_API_KEY` and `UMENG_API_SECRET`?**
  Please visit the [Open API Status Page](https://developer.umeng.com/open-api/state) on the Youmeng developer platform to obtain this information.