Moka MCP Server
This is a read-only MCP server that connects AI assistants to the Moka recruitment system, enabling querying of candidates, jobs, pipelines, departments, offers, and talent pools.
Candidate Management
search_candidates– Search by stage, email, phone, or time rangeget_candidate_detail– Full profile including education, work history, interviews, and offer infoget_candidate_applications– All job applications and their statuses for a candidateget_candidate_stage– Check a candidate's current recruitment stage
Job Management
list_jobs– List jobs filtered by recruitment mode (social/campus)get_job_detail– Full job details including custom fields and pipeline infoget_job_custom_fields– Extract only the custom fields for a specific job
Recruitment Pipelines & Stages
list_pipelines– List all pipelines with hire modes and entry conditionslist_stages– List all stages, optionally filtered by pipeline
Organizational Structure
list_departments– Retrieve the full department/org tree
Offer Fields
get_offer_custom_fields– Get offer custom field definitions for social and campus recruitment
Talent Pools
list_talent_pools– List all pools with metadata (name, hire mode, privacy status)list_talent_pool_candidates– Query candidates in specific pools within a date range
Key Constraints
Read-only: No write, update, or delete operations are supported
Sensitive data masking: Phone numbers and ID numbers are masked by default
Role-based access: Supports permission tiers (hr_admin, recruiter, hiring_manager, interviewer, viewer)
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Moka MCP Server find candidates for the senior data scientist job"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Moka MCP Server
基于 Moka 开放 API 的 MCP Server。让 Claude、Cursor 等 AI 助手能够直接查询 Moka 招聘系统中的候选人、职位、招聘流程、组织架构、Offer 字段与人才库等信息。
第一阶段:只读。 仅提供查询类能力,不涉及任何写入 / 删除等高危操作。
功能(Tool 一览)
下表的端点与版本均已对生产环境实测校准。Moka API 实际分布在三套基础路径上:
v1(多数)、v2(招聘流程/阶段)、candidate/v1(候选人申请记录)。
模块 | Tool | 真实端点 | 方法/版本 |
候选人 |
|
| GET v1 |
候选人 |
|
| GET v1 |
候选人 |
|
| POST candidate/v1 |
候选人 |
| 复用候选人详情的 | GET v1 |
职位 |
|
| GET v1 |
职位 |
|
| GET v1 |
职位 |
| 取自职位详情的 | GET v1 |
流程 |
|
| GET v2 |
流程 |
|
| GET v2 |
组织 |
|
| GET v1 |
Offer |
|
| GET v1 |
人才库 |
|
| GET v1 |
人才库 |
|
| GET v1 |
环境说明:当前 API Key 仅在生产环境有效(CSM 未开通 staging),故
MOKA_ENV请用production。所有 Tool 均为只读,首阶段不涉及任何写操作。
Related MCP server: Workday MCP Server
安装
要求 Python 3.10+。
# 推荐用 uv
uv pip install -e .
# 或者用标准 venv + pip
python3 -m venv .venv
source .venv/bin/activate
pip install -e .配置
复制 .env.example 为 .env 并填入真实值:
cp .env.example .env变量 | 必填 | 说明 |
| ✅ | Moka API Key(Basic Auth),由 CSM 发放 |
| 职位接口需要 | 组织标识,由 CSM 提供 |
|
| |
| 显式覆盖 Base URL,一般留空 | |
| 是否脱敏手机号/身份证,默认 | |
| HTTP 超时(秒),默认 30 | |
| 自动翻页累计上限,默认 200 |
运行
# 直接以 stdio 方式启动(供 MCP 客户端拉起)
moka-mcp-server
# 或
python -m moka_mcp.server接入 Claude Desktop
编辑 claude_desktop_config.json(macOS 路径:
~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"moka": {
"command": "/绝对路径/到/.venv/bin/moka-mcp-server",
"env": {
"MOKA_API_KEY": "your_api_key_here",
"MOKA_ORG_ID": "your_org_id",
"MOKA_ENV": "production",
"MOKA_MASK_SENSITIVE": "true"
}
}
}
}接入 Cursor
在 .cursor/mcp.json 中加入相同结构的配置即可。
自托管 HTTP 端点(Hermes / mcporter 接入)
除本地 stdio 外,本服务支持以 streamable-http 方式部署成一个 HTTP 端点,供
Hermes Agent 等通过 url + X-API-Key 请求头接入(与团队现有自研 MCP server 一致)。
1)以 http 方式启动
在 .env 中设置:
MOKA_TRANSPORT=http
MOKA_HTTP_HOST=0.0.0.0
MOKA_HTTP_PORT=8000
MOKA_HTTP_PATH=/mcp
MOKA_MCP_API_KEY=请设置一个足够随机的访问密钥 # agent 接入凭证然后启动:
moka-mcp-server
# 端点即为 http://<部署机IP>:8000/mcp鉴权:开启
MOKA_MCP_API_KEY后,所有请求必须携带请求头X-API-Key: <该值>, 否则返回 401。留空表示不校验(仅限完全可信的内网)。生产环境务必设置, 并在外层用 HTTPS(反向代理)保护。
2)mcporter / Hermes 配置
在 mcporter 配置(如 ~/.mcporter/mcporter.json 或项目 config/mcporter.json)中添加,
结构与团队其他 server 完全一致:
{
"mcpServers": {
"moka-mcp": {
"url": "https://<你的域名>/mcp",
"headers": {
"X-API-Key": "与 MOKA_MCP_API_KEY 相同的值"
}
}
}
}验证连通与工具列表:
mcporter list moka-mcp --schema
mcporter call moka-mcp.list_pipelines注意区分两套凭证:
MOKA_API_KEY是「本服务 → Moka」的认证;MOKA_MCP_API_KEY是「agent → 本服务」的认证(对应请求头X-API-Key),两者互不相同。
通过 uvx 作为 stdio 包接入(推荐)
本服务可作为标准 stdio MCP 包,由 agent(Hermes/mcporter)以子进程方式拉起, 无需常驻 HTTP 服务。宿主机需有 Python / uv。
mcporter(stdio 形式)配置示例:
{
"mcpServers": {
"moka-mcp": {
"command": "uvx",
"args": ["--from", "git+ssh://git@github.com/mingyangsun-sketch/moka-mcpserver.git", "moka-mcp-server"],
"env": {
"MOKA_API_KEY": "组织级 Moka Key",
"MOKA_ORG_ID": "Antalpha",
"MOKA_ENV": "production",
"MOKA_ACTING_EMAIL": "该 Slack 用户的可信邮箱(Hermes 校验后注入)"
}
}
}
}每个用户用各自的
env(角色 + 身份)拉起一个实例,即可实现按用户限权(见下)。
权限控制(面向企业内部用户)
由于 Moka 的 API Key 是组织级的(能读全量数据),按用户限权只能在本服务层实现。 身份模型为模型 A:Hermes 解析 Slack 用户 → 决定角色/部门 → 用对应 env 拉起该 用户的 MCP 实例。因此 stdio 下每个实例即一个调用者,角色由启动 env 决定。
角色
角色 | 对应人群 | 可用工具 | 数据范围 |
| HR/招聘团队负责人 | 全部 | 全量 |
| 招聘专员 | 候选人/职位/流程/Offer/人才库/组织(读) | 全量 |
| 用人经理/部门负责人 | 候选人/职位/流程/组织(无人才库) | 仅本部门 |
| 面试官 | 候选人状态/详情/阶段 + 职位/流程(无人才库/Offer) | 仅自己参与面试的候选人 |
| 普通员工 | 职位/流程/组织(不含候选人 PII) | 全量(公开信息) |
身份与角色的确定方式(两种)
① 按邮箱自动派生(推荐):Hermes 校验 Slack 用户后,注入其可信邮箱
MOKA_ACTING_EMAIL。本服务用组织 key 在 Moka 解析该用户(POST /users/list
按 email 精确查询),再按其 Moka role 与 department 自动定档:
Moka role | 自动派生角色 |
≥30(HR / 管理员 / 超级管理员) |
|
20 / 25(用人经理 / 高级用人经理) |
|
10(面试官) |
|
5 / 0(前台 / 内推人) |
|
邮箱在 Moka 找不到 → 退化为
viewer(最小权限)。无需手工维护角色表, 人员/部门在 Moka 一改,权限自动跟随。
② 静态配置(兜底,未配 MOKA_ACTING_EMAIL 时生效):
env | 说明 |
| 上表角色之一;默认 |
|
|
| 数据范围覆盖: |
| 工具白名单覆盖(逗号分隔, |
控制分两层:
工具级:角色决定可调用哪些 Tool(如
viewer不能调用search_candidates)。数据行级:
hiring_manager的候选人/职位结果按其部门过滤到本部门。
⚠️
MOKA_ACTING_EMAIL必须是 Hermes 校验过的可信邮箱,不能由 LLM 或用户 随意填入,否则可冒充他人。
权限模型边界(重要)
本服务的权限是我们自行设计的近似管控,不等同于用户登录 Moka 后台时的真实数据权限:
Moka 只提供组织级访问控制:这把 API Key 是全权的、不区分调用者,Moka 不会按用户过滤。
Moka 也未开放「查询某用户有效数据权限范围」的接口(
/users/*、/userGroup/*只给 角色、部门、分组成员等属性,不含数据可见范围规则)。因此本服务只能用用户的 Moka
role+department两个属性,套我们自己定的规则做近似—— 可能与该用户在 Moka 实际能看到的范围有出入(看多或看少)。
若业务/合规要求「AI 中看到的 = 本人在 Moka 能看到的」强一致,Moka 现有 API 无法支持 (用户级 OAuth 亦不可行,Moka 仅支持组织级)。当前定位为面向可信内部场景的近似管控。
⚠️ 安全前提:组织级 Key 会随实例分发,因此按用户限权只有在可信后端 (Hermes)统一持有 Key、并为每个用户 spawn 对应角色 env 的实例时才真正有效; 终端用户不能自行查看/修改 env,否则可拿全量 Key 绕过限制。
设计要点
认证:Basic Auth(
Authorization: Basic base64(api_key + ":")),无需处理 token 刷新。错误处理:统一映射 401/403/404/429/500 为友好提示;特别地,按
stage查询且该阶段无候选人时 Moka 返回 500,本服务会将其作为「空结果」处理。分页:基于
next游标自动翻页,受MOKA_MAX_ITEMS上限保护。脱敏:默认对手机号、身份证号掩码(
138****1234/4103**********2910)。重试:429 与网络错误做有限次指数退避重试。
项目结构
src/moka_mcp/
├── server.py # FastMCP 入口,注册全部 Tool
├── config.py # 配置(pydantic-settings)
├── client.py # Moka HTTP 客户端(Basic Auth / 错误 / 重试)
├── errors.py # 统一异常与状态码映射
├── tools/ # 各模块 Tool
│ ├── candidates.py
│ ├── jobs.py
│ ├── pipelines.py
│ ├── departments.py
│ ├── offers.py
│ └── talent_pools.py
└── utils/
├── pagination.py # next 游标自动翻页
└── sanitize.py # 敏感字段脱敏待办(第二阶段)
写入类能力(推进阶段、归档、创建职位、人才库导入、组织/人事同步等)暂未实现,详见需求文档第 3.3 节。
Available Tools
13 toolsget_candidate_applicationsA
查询某候选人的所有申请记录及状态(一人可投递多个职位)。
对应 Moka 接口:POST /getApplicationStates(candidate/v1,body 传 candidateId)
参数:
candidate_id:候选人 ID(注意区别于 applicationId)。
返回每条申请的 applicationId、status(in_progress/rejected 等)、 stageName、createdAt。
Inputs: candidate_id (required). Returns: object
get_candidate_detailA
获取单个候选人的完整信息。
对应 Moka 接口:GET /data/ehrApplications?applicationId={id}(v1)
参数:
application_id:候选人申请 ID;支持逗号分隔的多个 ID(如 "81,82,83")。
返回包含基本信息、教育/工作经历、自定义字段、阶段、职位、Offer、 面试官、内推人、附件等。注意附件与头像 URL 有效期仅 1 小时。
Inputs: application_id (required). Returns: object
get_candidate_stageA
查询候选人当前所处的招聘阶段。
实现说明:Moka v1 没有独立的单申请阶段查询接口,但候选人详情里自带 stageName,故本工具复用 GET /data/ehrApplications?applicationId={id}。
参数:
application_id:候选人申请 ID。
Inputs: application_id (required). Returns: object
get_job_custom_fieldsA
获取某职位的自定义字段。
实现说明:Moka 没有稳定的独立「职位自定义字段定义」读取接口, 但职位详情里自带 customFields,故本工具从 GET /jobs/{orgId}/{jobId} 提取。
参数:
job_id:职位 ID。
org_id:组织标识;留空则使用 .env 中的 MOKA_ORG_ID。
Inputs: job_id (required), org_id. Returns: object
get_job_detailA
获取单个职位详情(含自定义字段、招聘流程信息)。
对应 Moka 接口:GET /jobs/{orgId}/{jobId}(v1)
参数:
job_id:职位 ID。
org_id:组织标识;留空则使用 .env 中的 MOKA_ORG_ID。
Inputs: job_id (required), org_id. Returns: object
get_offer_custom_fieldsA
获取 Offer 自定义字段的定义(社招 / 校招)。
对应 Moka 接口:GET /offers/custom_fields(v1)
说明:实测返回结构为 {"social": [...], "campus": [...]},分别对应 社招和校招的字段定义(不是通用的 data 字段)。
Inputs: no named parameters. Returns: object
list_departmentsA
查询部门列表(树形组织架构)。
对应 Moka 接口:GET /departments(v1)
说明:实测返回结构为 {"departments": [...]}(不是通用的 data 字段)。
Inputs: no named parameters. Returns: object
list_jobsA
查询职位列表。
对应 Moka 接口:GET /jobs/{orgId}(v1)
参数:
mode:招聘模式,必填。social=社招 / campus=校招。
org_id:组织标识;留空则使用 .env 中的 MOKA_ORG_ID。
limit:返回条数上限。
说明:已关闭但未勾选「取消在官网显示」的职位仍会返回;已删除职位不返回。
Inputs: mode (required), org_id, limit. Returns: object
list_pipelinesA
获取招聘流程(Pipeline)列表。
对应 Moka 接口:GET /pipelines/getPipelinesList(v2)
返回每个流程的 id、name、hireMode、entryConditions 等。
Inputs: no named parameters. Returns: object
list_stagesB
获取招聘阶段(Stage)信息列表。
对应 Moka 接口:GET /stage/getStagesList(v2)
参数:
pipeline_id:可选,按指定流程过滤阶段。
返回每个阶段的 id、name、type。
Inputs: pipeline_id. Returns: object
list_talent_pool_candidatesA
查询指定人才库下的候选人(按归档时间范围)。
对应 Moka 接口:GET /talentPool/candidates(v1)
参数(均必填):
talent_pool_ids:人才库 ID 列表,如 [666, 888]。
archived_at_start:归档开始时间,如 "2019-06-01"。
archived_at_end:归档结束时间,如 "2019-11-01"。
Inputs: talent_pool_ids (required), archived_at_start (required), archived_at_end (required). Returns: object
list_talent_poolsA
查询所有人才库。
对应 Moka 接口:GET /talentPool/list(v1)
返回每个人才库的 id、name、hireMode、isPrivate 等(实测直接返回数组)。
Inputs: no named parameters. Returns: object
search_candidatesA
按条件搜索候选人(eHR 申请列表)。
对应 Moka 接口:GET /data/ehrApplications(v1)
参数说明:
stage:阶段筛选,offer=Offer 阶段 / pending_checkin=待入职 / all=两者。
email / phone:按邮箱或手机号精确筛选。
moved_at_start_time / moved_at_end_time:进入当前阶段的时间范围。
order:DESC(默认,从新到旧)/ ASC。
limit:返回条数上限(Moka 单页最大 20,这里支持跨页累计上限)。
注意:stage 与 applicationId 至少需要一个定位条件;按 stage 查询且该 阶段当前没有候选人时,Moka 会返回 500,本工具会将其作为「空结果」处理。
Inputs: stage, email, phone, moved_at_start_time, +3 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool has a clearly distinct purpose: candidate management (applications, detail, stage), job management (detail, custom fields), listing (departments, jobs, pipelines, stages, talent pools), and search. No overlapping functionality.
All tools follow a consistent verb_noun pattern in snake_case (e.g., get_candidate_detail, list_jobs, search_candidates). Verbs are uniformly 'get', 'list', or 'search', making the set predictable.
With 13 tools, the server covers the main entities of an HR platform (candidates, jobs, offers, departments, pipelines, stages, talent pools) without being excessive. The count feels well-scoped.
The server provides comprehensive read operations for all major entities but lacks any create, update, or delete tools. This means agents cannot perform full lifecycle management, leaving notable gaps for tasks requiring modifications.
Maintenance
Related MCP Connectors
Query professional profiles, search candidates, and get AI-powered summaries and job fit analysis.
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Recruiting data and workspace: search candidates, companies and jobs, score and shortlist them.
Read-only candidate intelligence — hiring questions answered from real interview transcripts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables read-only access to company data across PostgreSQL, MongoDB Atlas, and flat files through MCP tools, allowing AI assistants to query and retrieve information via natural language.-
- FlicenseNot gradedqualityCmaintenanceEnables read-only access to Workday HCM data such as workers, organizations, locations, job profiles, and cost centers through MCP tools an LLM can call.-
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to evaluate candidates against job requirements and retrieve evaluation results through MCP tools.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to search jobs, retrieve job details, and view or update career-profile data such as experiences, job summaries, career goals, and technical skills through MCP tools.-