Kcring Emotion Data Skill
Purpose
Retrieve the user's current emotion and stress status from a remote MCP server (Kcring) using the MCP Streamable HTTP transport protocol. The JWT token is stored locally after the user provides it once, so subsequent uses do not require re-entering the token unless it expires.
Zero runtime dependencies — uses only curl (pre-installed on macOS and Windows 10+) and WorkBuddy's built-in Read/Write/Bash tools. No Python, Node.js, or external scripts required. Works cross-platform (macOS, Linux, Windows).
Server Configuration
| Property | Value |
|-------------------|--------------------------------------------|
| MCP Endpoint | https://clientapi.lunabeing.cn/mcp/ |
| Transport | Streamable HTTP (JSON-RPC 2.0 over POST) |
| Response Format | SSE (text/event-stream) |
| Auth Header | Authorization: Bearer <JWT_TOKEN> |
| Protocol Version | 2024-11-05 |
| Server Name | mindrest v1.0.0 |
| Token Storage | ~/.workbuddy/skills/kcring-emotion/.token |
IMPORTANT: The endpoint URL must include the trailing slash (/mcp/). Without it, the server returns a 301 redirect and the POST body is lost, resulting in a 400 error.
MCP Tool: get_current_emotion_stress
This is the only tool exposed by the server.
| Property | Value |
|----------------|-----------------------------------------------------------------------|
| Tool Name | get_current_emotion_stress |
| Description | Get the authenticated user's current emotion and stress status |
| Parameters | timezone (optional, string, IANA timezone, e.g. Asia/Shanghai) |
| Returns | Current emotion status, stress status, summary, and status guide |
Emotion Status Values
| Status | Score Range | Description |
|-------------|-------------|--------------------------|
| tired | < 15 | 疲惫 |
| restless | 15-29 | 紧绷 |
| tense | 30-44 | 烦闷 |
| calm | 45-59 | 平静 |
| relaxed | 60-74 | 放松 |
| energetic | 75-89 | 愉悦 |
| excited | >= 90 | 激动 |
Stress Status Values
| Status | Score Range | Description |
|----------|-------------|--------------------------|
| good | < 30 | 压力较低 |
| normal | 30-69 | 压力中等 |
| bad | >= 70 | 压力较高 |
Cross-Platform Notes
This skill is designed to work on macOS, Linux, and Windows. Key differences:
| Concern | macOS / Linux | Windows |
|---------|---------------|---------|
| curl command | curl | curl.exe (avoid PowerShell's curl alias) |
| Token file path | ~/.workbuddy/skills/kcring-emotion/.token | %USERPROFILE%\.workbuddy\skills\kcring-emotion\.token |
| File permissions | chmod 600 after saving | Not applicable (NTFS handles ACLs) |
WorkBuddy handles this automatically: Use Read/Write tools for token file operations (cross-platform), and use Bash tool for curl commands. When constructing curl commands, detect the OS and use curl on macOS/Linux or curl.exe on Windows.
When to Use
- User asks to check, view, or analyze their current emotion or mood status
- User asks about their stress level
- User mentions "情绪数据", "心情状态", "压力状况", "emotion data", "mood status", "stress level", "情绪分析"
- User wants to know how they're feeling right now (emotion-wise)
Token Persistence Flow
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Read .token file │───▶ │ TOKEN_FOUND? │───▶ │ Initialize MCP │
│ (Read tool) │ └──────┬───────────┘ │ + Call tool │
└──────────────────┘ │ No └──────┬───────────┘
┌─────▼──────┐ 401?
│ Ask user │ ┌─────▼──────────┐
│ for JWT │ │ Ask for new │
│ token │ │ JWT token │
└─────┬──────┘ └─────┬──────────┘
│ Write .token │ Write .token
│ (Write tool) │ (Write tool)
└────────────────────────┘
│
┌────────▼─────────┐
│ Initialize MCP │
│ + Call tool │
└──────────────────┘
How to Use
All operations use WorkBuddy's built-in tools (Read, Write, Bash). No scripts or runtimes needed.
Step 1: Check if a token is already stored
Use the Read tool to try reading the token file at:
-
macOS/Linux:
~/.workbuddy/skills/kcring-emotion/.token -
Windows:
%USERPROFILE%\.workbuddy\skills\kcring-emotion\.token -
If Read succeeds and the file has non-empty content: TOKEN_FOUND — proceed to Step 3.
-
If Read fails (file does not exist): TOKEN_NOT_FOUND — proceed to Step 2.
Step 2: Ask user for JWT token and save it (first time only)
Ask the user: "请提供你的 JWT 认证 token,我会安全地存储它供后续使用。"
Once the user provides the token, save it using the Write tool:
- Write the token value to the token file path above.
After writing, on macOS/Linux only, use the Bash tool to set file permissions:
chmod 600 ~/.workbuddy/skills/kcring-emotion/.token
On Windows, skip this step (file permissions are managed by NTFS).
Important: Never echo or print the token value in the final response to the user.
Step 3: Initialize MCP session
- Use the Read tool to read the token file and obtain the JWT token value.
- Use the Bash tool to run curl. Embed the token value directly in the command.
macOS / Linux:
curl -s -i -X POST "https://clientapi.lunabeing.cn/mcp/" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer <TOKEN_VALUE>" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"kcring-emotion-skill","version":"1.0.0"}}}'
Windows (PowerShell):
curl.exe -s -i -X POST "https://clientapi.lunabeing.cn/mcp/" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -H "Authorization: Bearer <TOKEN_VALUE>" -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"kcring-emotion-skill","version":"1.0.0"}}}'
Replace <TOKEN_VALUE> with the actual token read from the file.
Parse the response:
- The
-iflag includes HTTP headers in the output. Look forMcp-Session-Id:in the headers — save this value for subsequent requests. - The body is SSE format: lines starting with
data:contain JSON-RPC responses. Look for"result"with"serverInfo": success. If HTTP status is 401: token expired, go to Step 6.
Step 4: Call the MCP tool get_current_emotion_stress
Use the Bash tool to run curl with the tools/call method. Include the Mcp-Session-Id header from Step 3.
macOS / Linux:
curl -s -X POST "https://clientapi.lunabeing.cn/mcp/" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer <TOKEN_VALUE>" \
-H "Mcp-Session-Id: <SESSION_ID>" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_current_emotion_stress","arguments":{"timezone":"Asia/Shanghai"}}}'
Windows (PowerShell):
curl.exe -s -X POST "https://clientapi.lunabeing.cn/mcp/" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -H "Authorization: Bearer <TOKEN_VALUE>" -H "Mcp-Session-Id: <SESSION_ID>" -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_current_emotion_stress","arguments":{"timezone":"Asia/Shanghai"}}}'
Replace <TOKEN_VALUE> and <SESSION_ID> with actual values. Use the user's timezone if known (e.g., Asia/Shanghai for China). The timezone parameter is optional — omit it to use the server default.
Step 5: Handle token expiration
If any curl response indicates HTTP 401 (the response body contains "error" or the -i header output shows 401):
- Inform the user that the JWT token has expired
- Ask the user to provide a new JWT token
- Save the new token (Step 2)
- Retry the MCP request (Steps 3-4)
Step 6: Parse SSE response
The MCP server responds with SSE format (text/event-stream). The response looks like:
event: message
data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"{...}"}],"structuredContent":{...}}}
WorkBuddy should:
- Find lines starting with
data:in the raw output - Extract the JSON payload after the
data:prefix - Parse the JSON to access
result.structuredContent(preferred — it's already structured JSON) orresult.content[0].text(fallback — parse the text field as JSON)
Step 7: Present and Analyze Results
After fetching the data, parse the structuredContent (or content[0].text parsed as JSON). The response contains:
{
"emotion_status_data": {
"status": "energetic", // mood: calm|energetic|restless|tense|excited|relaxed|tired
"score": 86, // 0-100
"description": "" // optional additional text
},
"stress_status_data": {
"status": "good", // severity: good(<30)|normal(30-69)|bad(>=70)
"score": 26, // 0-100
"description": "" // optional additional text
},
"last_updated_at": "2026-07-23 14:59:30",
"summary": "慢慢来,你已经在路上了。",
"status_guide": {
"emotion_status": { ... }, // reference guide for emotion status values
"stress_status": { ... } // reference guide for stress status values
}
}
Presentation guidance:
- Display the summary prominently — it's a personalized insight from the service
- Show emotion status: status name (translated to Chinese if needed), score, and description
- Show stress status: status name (translated to Chinese if needed), score, and description
- Show last updated time so the user knows data freshness
- Add context using the
status_guideto explain what the status values mean - Visualize if appropriate: use the Visualizer to render a simple gauge or status indicator showing emotion score and stress score side by side
- Provide insights: compare emotion and stress scores, note any correlations, offer encouraging or supportive commentary based on the summary
Quick Reference: curl Command Template
All MCP requests use POST to https://clientapi.lunabeing.cn/mcp/ (trailing slash required).
| OS | curl command |
|----|-------------|
| macOS/Linux | curl -s -i -X POST "https://clientapi.lunabeing.cn/mcp/" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -H "Authorization: Bearer <TOKEN>" -H "Mcp-Session-Id: <SESSION>" -d '<JSON_BODY>' |
| Windows | curl.exe -s -i -X POST "https://clientapi.lunabeing.cn/mcp/" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -H "Authorization: Bearer <TOKEN>" -H "Mcp-Session-Id: <SESSION>" -d '<JSON_BODY>' |
| Operation | JSON-RPC Body |
|------------|-----------------------------------------------------------------------------------------------------------------------------------|
| Initialize | {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"kcring-emotion-skill","version":"1.0.0"}}} |
| Call tool | {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_current_emotion_stress","arguments":{"timezone":"Asia/Shanghai"}}} |
Note: After initialize, the server returns a Mcp-Session-Id header. Include it in all subsequent requests. If the server does not return a session ID, omit the header.
Security Notes
- On macOS/Linux, the token file is set to
0600permission. On Windows, file ACLs are managed by the OS. - Never log, print, or expose the JWT token in plain text in the final response to the user
- The token is only used in the Authorization header for MCP requests
- If the token is invalid or expired, inform the user and ask them to provide a new one
- Do not include the token value in any output file or conversation message
- When using the Bash tool, construct the curl command with the token embedded directly — avoid shell variables that would be visible in process listings
API Reference
For detailed MCP protocol request/response examples, refer to references/api_docs.md.
Scan to join WeChat group