Skip to main content
Glama
parallel-variable-mcp

parallel-variable-mcp

平行变量 Parallel Variable — Official MCP Server

平行变量(Parallel Variable)— 让世界,回应你的构想。
Let the real world respond to your ideas before you launch.

parallel-variable-mcp 是「平行变量」开放平台官方开源的 Model Context Protocol (MCP) 标准服务端(JSON-RPC 2.0 over stdio,零第三方依赖,仅需 Python 3.10+)。

通过它,你可以在 Cursor、Claude Desktop、Antigravity、魔搭(ModelScope)、扣子(Coze) 等任意支持 MCP 的 AI 客户端中,直接调用真实脱敏城市数字居民样本,在正式发布前对商业定价、门店选址、产品改版、品牌公关或社会公共政策进行低成本高保真前测。


核心特性 / Key Features

  • 零重依赖、开箱即用:100% Python 标准库实现,无笨重 SDK 依赖,启动即用。

  • 黑盒安全边界:仅调用公网 https://api.parallelvariable.com/api/open-platform/v1/* 公开接口;API Key 仅通过环境变量读取,绝不写入磁盘或打印到日志。

  • 防误扣费护栏:pv_run_simulation 在工具描述中强制约束 AI 助手在扣费启动前,先向用户展示样本量、步进周期与预估点数消耗并获得明确确认。

  • 异步不阻塞:启动推演后立即返回 pipeline_id 与排队位置,随时通过 pv_get_simulation_results 拉取进度、去重统计、舆情热搜潜质、分龄切片与脱敏居民真实原话。


Related MCP server: zhizhuip-mcp

典型场景示例 / Use Cases

  1. 商业定价与新店前测:「在朝阳区开一家精品咖啡店,首杯拿铁 19.9 元,抽 100 位 22–40 岁在职女性测 7 天自然到店与真实评价。」

  2. 产品改版与会员提价:「将内容 App 连续包月从 15 元调整至 22 元,对比不同收入与学历人群的续费与吐槽倾向。」

  3. 品牌公关与社会事件推演:「某新能源车企因电池续航缩水引发舆论争议,发布不同回应方案后 14 天内的公众态度与热搜潜质变化。」

  4. 公共政策前测(需政企/科研白名单):「博物馆取消预约制 / 地铁高峰票价微调,分青/中/银发三代人群观察支持率与行动意愿。」


快速安装 / Quick Start

方式一:本地可编辑安装(推荐)

cd integrations/parallel-variable-mcp
pip install -e .

安装后可直接运行命令 parallel-variable-mcp。

方式二:零安装直接以模块运行

PYTHONPATH=integrations/parallel-variable-mcp/src \
PARALLEL_VARIABLE_API_KEY="pv_sk_your_api_key" \
python3 -m parallel_variable_mcp

环境变量 / Environment Variables

变量名

必填

默认值

说明

PARALLEL_VARIABLE_API_KEY

是

无

在 控制台 生成的个人/企业 API Key

PARALLEL_VARIABLE_BASE_URL

否

https://api.parallelvariable.com

开放平台公开 API 基地址


客户端一键配置 / Client Configuration

1. Cursor (~/.cursor/mcp.json 或项目 .cursor/mcp.json)

{
  "mcpServers": {
    "parallel-variable": {
      "command": "parallel-variable-mcp",
      "env": {
        "PARALLEL_VARIABLE_API_KEY": "pv_sk_your_api_key"
      }
    }
  }
}

2. Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "parallel-variable": {
      "command": "python3",
      "args": ["-m", "parallel_variable_mcp"],
      "env": {
        "PARALLEL_VARIABLE_API_KEY": "pv_sk_your_api_key"
      }
    }
  }
}

3. Antigravity / 魔搭(ModelScope)MCP 配置

{
  "mcpServers": {
    "parallel-variable": {
      "command": "parallel-variable-mcp",
      "args": [],
      "env": {
        "PARALLEL_VARIABLE_API_KEY": "pv_sk_your_api_key",
        "PARALLEL_VARIABLE_BASE_URL": "https://api.parallelvariable.com"
      }
    }
  }
}

7 个标准工具清单 / Available MCP Tools

Tool 名称

是否免费

说明

pv_list_regions

免费

查询已开放的数字居民区域列表(如 110105 北京朝阳)

pv_get_targeting_options

免费

查询标准人群定向筛选字典(性别、人群标签、学历、婚姻、收入档位)

pv_get_account_status

免费

查询当前推演点数余额、年度点数包、套餐版本、样本/并发上限与政策白名单状态

pv_clarify_scenario

免费

拆解商业或社会构想,返回推荐步进单位/步数、观测目标、推荐最小年龄与能力边界

pv_estimate_population

免费

实时预估指定地区与筛选条件下覆盖的居民人数及防窄化提示

pv_run_simulation

扣费(需确认)

创建并启动推演流水线,立即返回 pipeline_id 与排队位置(不阻塞超时)

pv_get_simulation_results

免费

随时查询推演进度、去重统计、社会舆情/分龄切片汇总及精选脱敏居民真实原话


安全与开源协议 / Security & License

  • 开源协议:MIT License(见 LICENSE)。

  • 隐私与安全:本仓库仅作为公网 API 的开源黑盒客户端,不包含任何服务端内部逻辑、模型 Prompt 或私有密钥;所有居民反馈均已在平台侧完成三层脱敏,不包含任何真实个人身份信息(PII)。

Available Tools

7 tools
pv_clarify_scenarioA

使用平行变量开放平台拆解用户的商业构想、产品定价或社会公共事件推演需求,返回结构化场景分类(scenario_category)、推荐步进单位与步数(recommended_step_unit/count)、推荐观测目标(recommended_observation_goals)、推荐最小年龄及是否受 1.0 能力支持。免费调用,建议在发起推演前优先调用。

Inputs: description (required), answers, region_code.

pv_estimate_populationA

免费实时预估在指定地区与人群筛选条件下覆盖的真实数字居民人数(matched_count)及防窄化提示。不消耗任何推演点数,建议在确认发起推演前调用。

Inputs: region_code (required), gender, age_max, age_min, +5 more.

pv_get_account_statusA

查询当前平行变量账号的推演点数余额(1 点 = ¥1)、年度点数包、套餐版本(体验版/企业专业版)、样本上限、并发上限、A/B 对照权限及高敏公共政策推演白名单状态。免费调用。

Inputs: no named parameters.

pv_get_simulation_resultsA

查询指定推演任务(pipeline_id)的实时进度、账务消耗与观测结果。支持运行中随时查看进度;完成或有首批观测数据时,自动返回去重统计(unique_resident_summary)、社会舆情与分龄切片汇总(social_summary)以及精选脱敏数字居民真实原话。

Inputs: pipeline_id (required), day_index, quote_limit.

pv_get_targeting_optionsA

查询平行变量开放平台支持的人群定向筛选标准字典(性别 gender、人群标签 audience_tags、学历 education_levels、婚姻状态 marital_statuses、收入档位 income_bands 及组合规则)。免费调用,不消耗推演点数。

Inputs: no named parameters.

pv_list_regionsB

查询平行变量(Parallel Variable)开放平台当前已开放的数字居民区域列表(如 110105 北京朝阳等)。免费调用,不消耗推演点数。

Inputs: no named parameters.

pv_run_simulationA

【重要:扣费操作,调用前必须先向用户展示本次推演的样本量(sample_size)、步进单位与步数(step_unit + observation_days)以及预估推演点数消耗,并获得用户明确确认后再调用!】创建平行变量数字居民推演流水线并立即提交排队启动(内部依次调用 POST /v1/pipelines 与 POST /v1/pipelines/{id}/launch),立即返回 pipeline_id 与排队信息,不会阻塞等待推演结束。启动后请使用 pv_get_simulation_results 查询实时进度与居民反馈结果。

Inputs: description (required), region_code (required), sample_size (required), observation_days (required), +12 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool targets a distinct resource or workflow stage: regions, targeting dictionary, account status, scenario clarification, population estimate, simulation launch, and results retrieval. Although the estimate/launch/results tools belong to one pipeline, their boundaries are clear from their descriptions and the free versus paid distinction.

    Naming Consistency5/5

    All seven tools use the same pv_ prefix and follow a consistent verb_noun pattern (list_regions, get_targeting_options, get_account_status, clarify_scenario, estimate_population, run_simulation, get_simulation_results). Minor variation between get_/run_/clarify_/estimate_ mirrors the distinct actions and remains predictable.

    Tool Count5/5

    Seven tools map cleanly onto a single workflow: discovery (regions, targeting, account), planning (clarify, estimate), and execution/retrieval (run, results). No tool feels redundant or missing a pair, and the count sits comfortably in the ideal 3-15 range.

    Completeness4/5

    The core workflow from scenario clarification to population estimation to launch and live results is fully covered, including the critical billing-confirmation step. Minor gaps remain: no tool to list existing or historical pipelines, and no explicit cancel or delete operation for a running simulation.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients to inspect ad account structure, campaign performance, demographic breakdowns, and revenue attribution, and to prepare opt-in, preview-first draft campaigns, ads, and media uploads for explicitly selected accounts.
      18
      84 npm
      Apache 2.0