# Discovering Team Members via Feishu MCP

When the Feishu Contact API is unavailable (permission not approved), use MCP tools to discover all active team members.

## Method: Cross-Type Creator Query

Pull unique creators from multiple work item types to get a comprehensive user list:

```sql
-- Activities (most coverage)
SELECT DISTINCT `创建者`, `跟进部门` FROM `销售管理`.`活动`
  WHERE `创建时间` >= "2026-01-01" LIMIT 500

-- Opportunities (stories) - catches people with no recent activities
SELECT DISTINCT `创建者` FROM `销售管理`.`商机`
  WHERE `创建时间` >= "2026-01-01" LIMIT 500
```

Each result includes: `user_key`, `email`, `name_cn` in the `user_value` object.

## Method: search_user_info for Known Names

When you have incomplete lists, batch query specific names:

```javascript
mcp__feishu_project__search_user_info({
  user_keys: ["刘欣","吴云","韩远怀"],
  project_key: "6593cd71471290e3cc6be6e6"
})
```

Returns: user_key, email, name_cn, status (activated/deactivated).

## Pitfalls

- **Some work item types lack time fields**: 缺陷 (issue) and 线索 don't have `创建时间`, filter differently.
- **Not all members create work items**: 刘欣 appeared in search_user_info but not in activity data.
- **Dept field returns option IDs**: `跟进部门` returns codes like `2o467stav`, not readable names. Cross-reference with known department mappings.
- **Rate limiting**: search_by_mql + search_user_info both hit the same MCP server. Space them out.

## Compiling a Complete User List

1. Pull activities (SELECT DISTINCT 创建者, 跟进部门)
2. Pull stories (SELECT DISTINCT 创建者)
3. Deduplicate by name_cn
4. Use search_user_info to fill gaps
5. Map department codes from activity data's `跟进部门` field
