wr-admin-mcp-connector

v1.2.1
wr-admin-mcp-connector Checked 1 day ago Published 2 months ago

MCP connector for wr admin management system.

MCP Server for wr admin management system. Provides AI-callable tools for order queries, user course lookups, SCRM data (sales leads, appointments, bound orders, member lists), and reference data — all through SMS login + Cookie session. WorkBuddy ships its own managed Node runtime plus a dedicated directory for CLI connectors — cli-connector-packages.

Summary extracted from the README.

wr-admin-mcp-connector

MCP Server for wr admin management system. Provides AI-callable tools for order queries, user course lookups, SCRM data (sales leads, appointments, bound orders, member lists), and reference data — all through SMS login + Cookie session.

Install

WorkBuddy ships its own managed Node runtime plus a dedicated directory for CLI connectors — cli-connector-packages. Install there (the prefix is cli-connector-packages itself, without a trailing lib; npm appends the rest internally) so the package survives runtime rebuilds, and register it by its bare command name — WorkBuddy resolves CLI connector commands out of the bin directory of that folder (on macOS/Linux <prefix>/bin; on Windows the folder itself), so it picks up the Node runtime on its own and a runtime rename never breaks the launcher.

macOS / Linux:

npm install -g wr-admin-mcp-connector --prefix ~/.workbuddy/binaries/node/cli-connector-packages

Windows (cmd):

npm install -g wr-admin-mcp-connector --prefix %USERPROFILE%\.workbuddy\binaries\node\cli-connector-packages

Windows (PowerShell):

npm install -g wr-admin-mcp-connector --prefix "$env:USERPROFILE\.workbuddy\binaries\node\cli-connector-packages"

-g is required, not cosmetic. It is what makes npm put the launcher where WorkBuddy looks for it. Dropping it silently installs the command into a directory WorkBuddy never searches, and the bare command name in mcp.json then resolves to nothing:

Command Package lands in (macOS/Linux) Launcher lands in On the PATH WorkBuddy gives MCP servers?
npm install -g … --prefix <prefix> <prefix>/lib/node_modules/ <prefix>/bin/<name> ✅ yes — this is the supported form
npm install … --prefix <prefix> (no -g) <prefix>/node_modules/ <prefix>/node_modules/.bin/<name> ❌ no

On Windows the layout differs: the package lands in <prefix>\node_modules\ and the launcher at <prefix>\<name>.cmd — no intermediate lib or bin level. That is npm's own global-install layout, and it is the directory WorkBuddy looks in, so the very same -g --prefix command is correct on both platforms.

Do not add --bin-links=false either: it suppresses the launcher link entirely, <prefix>/bin is never created, and a bare command name cannot resolve.

Then register it by bare command name (no absolute Node path, no env.PATH):

{
  "mcpServers": {
    "wr-admin-mcp": {
      "command": "wr-admin-mcp-connector",
      "args": []
    }
  }
}

Do not use npm i -g without --prefix (the global prefix can point inside the managed runtime's lib/node_modules, which is wiped on rebuild — it is the missing --prefix that hurts, not the -g), and do not use npx (re-resolves online at launch and may be missing from the MCP subprocess PATH).

Upgrade

Re-run the install command with @latest in the same cli-connector-packages prefix, keeping the -g. Upgrading is exactly one command — never edit mcp.json, and never rebuild/reinstall the managed Node runtime.

macOS / Linux:

npm install -g wr-admin-mcp-connector@latest --prefix ~/.workbuddy/binaries/node/cli-connector-packages

Windows (cmd):

npm install -g wr-admin-mcp-connector@latest --prefix %USERPROFILE%\.workbuddy\binaries\node\cli-connector-packages

Windows (PowerShell):

npm install -g wr-admin-mcp-connector@latest --prefix "$env:USERPROFILE\.workbuddy\binaries\node\cli-connector-packages"

Verify the new version in <prefix>/lib/node_modules/wr-admin-mcp-connector/package.json (Windows: <prefix>\node_modules\wr-admin-mcp-connector\package.json), then restart WorkBuddy. Because mcp.json did not change, the existing trust approval stays valid — no re-authorization needed.

For WorkBuddy users, paste this one-liner to update:

把 wr-admin-mcp 更新到最新版:执行 npm install -g wr-admin-mcp-connector@latest --prefix ~/.workbuddy/binaries/node/cli-connector-packages(Windows 用 %USERPROFILE%.workbuddy\binaries\node\cli-connector-packages),更新完报版本号并提示我重启。红线:别重装/重建 Node 运行时、别改 mcp.json、别用 npx、别用不带 --prefix 的裸 -g。

Authentication

SMS login flow — no hardcoded credentials:

send_sms_captcha(domain, phone) → user receives SMS → login(domain, phone, captcha) → Cookie stored in session → subsequent tools use it

The session is persisted to disk (~/.wr-mcp/admin-session.json on macOS/Linux, %APPDATA%\wr-mcp\admin-session.json on Windows), so it survives process restarts. Call clear_auth to wipe it.

Tools

login

Authenticate with the admin backend.

Param Required Description
domain yes Admin backend URL, e.g. https://admin.example.com
phone yes Phone number
captcha yes SMS verification code

send_sms_captcha

Trigger an SMS verification code to a phone number. No login required — call this first to obtain the captcha, then pass the received code to login.

Param Required Description
domain yes Admin backend URL, e.g. https://admin.example.com
phone yes Phone number to receive the SMS

query_orders

Query order list. Supports raw param string or individual fields.

Param Required Description
params no Raw query string, e.g. page=1&page_size=20&status=2
page no Page number
pageSize no Items per page
phone no Buyer phone
nickname no Buyer nickname
orderNum no Order number
goodsId no Goods ID
goodsName no Goods name
goodsType no Goods type
courseId no Course ID
classifyId no Category ID
gradeIds no Grade ID
subjectId no Subject ID
year no Year, e.g. 2026
termId no Semester ID
cityCode no City code
schoolId no Campus ID
classroomId no Classroom ID
orderType no Order type (2=user order, 3=renewal)
orderTag no Order tag
status no 1=unpaid, 2=paid, 3=cancelled, 4=direct refund, 5=timeout cancel, 6=offline refund, 7=refund requested, 8=refunding, 9=single-section refunding
minPrice no Min actual payment
maxPrice no Max actual payment
startDay no Start date, e.g. 2026-07-26
endDay no End date

query_user_courses

Query user course list.

Param Required Description
params no Raw query string
page no Page number
pageSize no Items per page
phone no Buyer phone
orderNum no Order number
courseId no Course ID
courseName no Course name
gradeIds no Grade ID
subjectId no Subject ID
year no Year
termId no Semester ID
classifyId no Category ID
versionId no Version ID
difficultyId no Difficulty ID
cityCode no City code
schoolId no Campus ID
classroomId no Classroom ID
buyStartDay no Purchase start date
buyEndDay no Purchase end date
startDay no Course start date
endDay no Course end date
status no 0=all, 1=active (not expired), 2=expired, 3=refunded, 4=transferred out, 5=active (including expired)

query_member_list

Query advisor/sales member list. Returns data scoped to the logged-in user's team. No parameters.

Key response fields: list[].member_id, list[].member_name. Use member_id to correlate with other query results for per-advisor aggregation.

query_sales_leads_list

Query sales leads list. Supports filtering by student, phone, stage, status, date range, and advisor.

start_day/end_day filter on create_time (when the lead was created).

Key response fields: total, list[].creator_id, list[].creator_name, list[].leads_num, list[].leads_name, list[].stage, list[].status, list[].create_time. Group by creator_id to count per advisor.

Param Required Description
user_id no Student ID
phone no Student phone
stage no Stage: 1=lead, 2=info completed, 3=appointment, 4=visit
status no Status: 1=unaudited, 2=in progress, 3=completed, 4=terminated
start_day no Start date (filters create_time), e.g. 2026-07-01
end_day no End date (filters create_time), e.g. 2026-07-31
member_id no Advisor ID; omit for all
page no Page number
page_size no Items per page. Set 9999 to fetch all in one call

query_appointment_list

Query appointment list. Supports filtering by student, phone, status, date range, and advisor.

start_day/end_day filter on day (appointment date). Use status=2 for visit count (到店数量).

Key response fields: total, list[].creator_id, list[].creator_name, list[].user_name, list[].day, list[].status, list[].create_time. Group by creator_id to count per advisor.

Param Required Description
user_id no Student ID
phone no Student phone
start_day no Start date (filters appointment day), e.g. 2026-07-01
end_day no End date (filters appointment day), e.g. 2026-07-31
status no Status: 1=scheduled, 2=visited, 3=no-show, 4=voided
member_id no Advisor ID; omit for all
page no Page number
page_size no Items per page. Set 9999 to fetch all in one call

query_bind_order_list

Query bound orders linked to sales leads. Tracks lead → order conversion.

start_day/end_day filter on create_time (when the order was created).

Key response fields: total, list[].creator_id, list[].creator_name, list[].leads_num, list[].order_num, list[].order_price, list[].create_time. Group by creator_id to count per advisor.

Param Required Description
start_day no Start date (filters create_time), e.g. 2026-07-01
end_day no End date (filters create_time), e.g. 2026-07-31
member_id no Advisor ID; omit for all
page no Page number
page_size no Items per page. Set 9999 to fetch all in one call

query_classroom_calendar

Query classroom calendar — which classrooms are occupied at which times.

Param Required Description
city_code yes City code
school_id yes Campus ID
classroom_id no Classroom ID; omit for all classrooms in the campus
start_day yes Start date, e.g. 2026-07-01
end_day yes End date, e.g. 2026-07-31

query_teacher_calendar

Query teacher calendar — which classes a teacher has scheduled.

Param Required Description
teacher_name yes Teacher name (plain text)
start_day yes Start date, e.g. 2026-07-01
end_day yes End date, e.g. 2026-07-31

query_course_list

Query course list with schedule info. Returns classtime field (e.g. "周三 09:00-10:30"), start/end dates, teacher list, campus, classroom.

Param Required Description
course_id no Course ID; use with IDs from query_goods
course_name no Course name (fuzzy match)
goods_id no Goods ID (reverse lookup)
course_status no 1=normal, 2=deleted
shelves_status no 1=draft, 2=published, 3=unpublished
teacher_name no Teacher name
city_code no City code
school_id no Campus ID
classroom_id no Classroom ID
class_day no Class date, e.g. 2026-07-30
grade_id no Grade ID
subject_id no Subject ID
year no Year, e.g. 2026
term_id no Semester ID
classify_id no Category ID
version_id no Version ID
difficulty_id no Difficulty ID
classtime_id no Class time slot ID
page no Page number
page_size no Items per page

Response includes type (1=in-person, 2=recorded, 3=live, 4=OMO), status (1=normal, 2=deleted), shelves_status (1=draft, 2=published, 3=unpublished).

query_section_list

Query section (individual lesson) list. More granular than query_course_list — each section has its own date, time, classroom, and teacher.

Param Required Description
course_id no Course ID
course_name no Course name (fuzzy match)
section_id no Section ID
city_code no City code
school_id no Campus ID
classroom_id no Classroom ID
classify_id no Category ID
grade_ids no Grade IDs, comma-separated, e.g. 1,2,3
subject_id no Subject ID
year no Year, e.g. 2026
term_id no Semester ID
teacher_name no Teacher name
start_day no Section start date, e.g. 2026-07-01
end_day no Section end date, e.g. 2026-07-31
page no Page number
page_size no Items per page

Response includes status (1=normal, 2=frozen), class_status (1=not started, 2=about to start, 3=in progress, 4=finished), course_type (1=in-person, 2=recorded, 3=live, 4=OMO), section_sort (lesson sequence number).

query_select_list

Query reference/dictionary data — grade, subject, term, category, version, difficulty, classroom, class-time, teacher, and year code mappings. No parameters.

Response: gradeList/subjectList/termList/classifyList/versionList/difficultyList/classroomList/classtimeList/teacherList/yearList/defaultCoverImg. Each item has id + name; campus is a city → school → classroom three-level tree.

Call this first to get grade_ids, subject_id, school_id, classroom_id, etc. before querying orders/courses, to avoid hardcoding codes.

clear_auth

Clear stored session and domain config. No parameters.

Example

Daily order lookup

User: "查昨天的已支付订单"
AI: send_sms_captcha(domain="https://admin.wr.com", phone="138...")
User: "验证码是 123456"
AI: login(domain="https://admin.wr.com", phone="138...", captcha="123456")
AI: query_select_list(type="grade")  → get grade codes
AI: query_orders(startDay="2026-07-26", endDay="2026-07-26", status="2")
AI: "昨天共15笔已支付订单,合计金额..."

Monthly advisor report

Each tool is called once with page_size=9999 to get all records. The AI groups results by creator_id and joins with query_member_list for names.

User: "2026年5月所有顾问的商机数、预约数、到店数、绑定订单数"
AI: send_sms_captcha(domain="...", phone="138...")
User: "验证码是 123456"
AI: login(domain="...", phone="138...", captcha="123456")
AI: query_member_list()
    → [{member_id: 1, member_name: "张三"}, {member_id: 2, member_name: "李四"}]
AI: query_sales_leads_list(start_day="2026-05-01", end_day="2026-05-31", page_size="9999")
    → count by creator_id
AI: query_appointment_list(start_day="2026-05-01", end_day="2026-05-31", page_size="9999")
    → count by creator_id = 预约数
AI: query_appointment_list(start_day="2026-05-01", end_day="2026-05-31", status="2", page_size="9999")
    → count by creator_id = 到店数
AI: query_bind_order_list(start_day="2026-05-01", end_day="2026-05-31", page_size="9999")
    → count by creator_id = 绑定订单数
AI: "5月顾问业绩:
     张三:商机15个,预约8个,到店5个,绑定订单3个
     李四:商机12个,预约6个,到店4个,绑定订单2个
     ..."