w

whatap-mxql-cli

@devload/whatap-mxql-cli
0 Stars 168 次浏览 devload 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "whatap-mxql": {
      "args": [
        "///whatap-mxql-cli/dist/mcp/index.js"
      ],
      "command": "node",
      "description": "WhaTap MXQL Query Executor"
    }
  }
}

服务介绍

WhaTap MXQL CLI

WhaTap MXQL(Metrics Query Language) .

  • ** **: AES-256-GCM
  • ** **:
  • **MXQL **: MXQL ( )
  • ** **: Table, JSON, CSV
  • ** REPL**:
  • ** **:
  • **MCP **: Claude Code ! (Tools )
  • **Skill **: mxql-for-claude-code Skill ( MXQL)

#  
git clone <repository-url>
cd whatap-mxql-cli

#  
npm install

# 
npm run build

# bin   
chmod +x bin/whatap-mxql

#  1:    (  )
./bin/whatap-mxql projects
#         

#  2:    
./bin/whatap-mxql login
./bin/whatap-mxql projects

# 3. MXQL  
./bin/whatap-mxql query 27506 "CATEGORY app_counter" -r 24h

# 4.  
./bin/whatap-mxql interactive

** TIP**: !

login [options] WhaTap
logout
projects [options]
query <pcode> [mxql] [options] MXQL
interactive [options] REPL

CLI_GUIDE.md .

Claude Code (MCP)

MCP

#  (   skip)
npm run build

# MCP   
mkdir -p ~/.claude/mcp
cat > ~/.claude/mcp/whatap-mxql.json << 'EOF'
{
  "mcpServers": {
    "whatap-mxql": {
      "command": "node",
      "args": ["///whatap-mxql-cli/dist/mcp/index.js"],
      "description": "WhaTap MXQL Query Executor"
    }
  }
}
EOF

****: /// !

Skill (mxql-for-claude-code)

#  
git clone https://github.com/kyupid/mxql-for-claude-code.git
cd mxql-for-claude-code

# 
./install.sh

: "PostgreSQL CPU 80%   "

Claude Code:
  1. (Skill) PostgreSQL   MXQL  
  2. (Skill) MXQL : "CATEGORY db_postgresql_counter FILTER..."
  3. (MCP Tool) whatap.getProjects() -   
  4. (MCP Tool) whatap.executeMxql(pcode, mxql) -  
  5.    

: MCP_INSTALLATION.md

 Found 12 project(s)


 Project Code  Project Name             Type     Status     

 27506         Browser Monitoring Demo  BROWSER  subscribe  
 44482         mobile test project      MOBILE   subscribe  

MXQL

[
  {
    "_id_": "27506_",
    "pname": "Browser Monitoring Demo",
    "pcode": 27506,
    "sessionCount": 108.04790419161677,
    "_rows_": 167
  }
]

Development

Setup

npm install

Build

npm run build

Test

# Run all tests
npm test

# Run unit tests only
npm run test:unit

# Run integration tests (requires WhaTap account)
npm run test:integration

# Watch mode
npm run test:watch

# Coverage
npm run test:coverage

Lint & Format

npm run lint
npm run lint:fix
npm run format

Testing

Unit Tests

Mock-based tests for all modules without external dependencies.

Integration Tests

Real API calls to WhaTap service (requires test account).

Configure test credentials in .env.test:

WHATAP_TEST_EMAIL=your-email@whatap.io
WHATAP_TEST_PASSWORD=your-password
WHATAP_SERVICE_URL=https://service.whatap.io
RUN_INTEGRATION_TESTS=true

whatap-mxql-cli/
 src/
    core/                 #   (CLI & MCP )
       types/           # TypeScript  
       auth/            #  
          SessionStore.ts      #   (AES-256-GCM)
          AuthManager.ts       #   (Cookie Jar)
       client/          # API 
          WhatapClient.ts      # WhaTap API (Dual Auth)
       executor/        # MXQL 
           MxqlExecutor.ts      #     
    cli/                  # CLI 
        commands/        #  
           login.ts
           logout.ts
           projects.ts
           query.ts
           interactive.ts
        utils/           # 
           formatters.ts        #  
           session.ts           #  
        index.ts         # CLI 
 test/                     # 
 bin/                      #  
    whatap-mxql
 dist/                     #  

Core (52 )

  • SessionStore: 16/16
  • AuthManager: 16/16
  • WhatapClient: 13/13
  • MxqlExecutor: 7/7

CLI

  • login:
  • logout:
  • projects: (12 )
  • query: ( )
  • interactive:
  • : Table, JSON, CSV

  • MXQL
  • 27506 sessionCount
  • 167

VERIFICATION_REPORT.md .

License

MIT

Security

Session data is encrypted using AES-256-GCM. Encryption keys are stored locally with restricted permissions (0600).

Never commit .env.test or any files containing credentials to version control.

相关 MCP 服务