简历匹配生成API

一个基于REST API的简历匹配与生成服务,支持通过文本、URL或PDF输入匹配职位需求,并生成或更新简历。

  • by Chenjinyu
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Chenjinyu/jcus-link-rest

使用说明

jcus链接休息

带MCP的REST API

如何跑步

选项1:使用run脚本

uv run python run_server.py

选项2:直接使用uvicorn

uv run uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload

选项3:使用Python模块语法

uv run python -m uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload

使用Docker镜像运行

docker build -f Dockerfile -t jcus-rest:latest .

docker run --rm -p 8000:8000 --env-file .env.prod jcus-rest:latest

MCP工具示例

FastMCP的流式HTTP传输可以在同一端点上以两种模式进行回复:

  • application/json用于正常的json-RPC响应(单个响应体)。
  • 用于流式响应和会话事件的文本/事件流。

服务器强制客户端明确声明它可以处理这两种情况,因为它可以根据请求或服务器状态进行选择。这就是为什么它拒绝只接受其中一个请求的原因。 因此:FastMCP流式HTTP要求客户端同时接受 application/json 和 text/event-stream,因此在中包含Accept标头 请求:

以下是您可以发送到的JSON-RPC有效载荷示例 /mcp 对于MCP工具。

开发人员说明

LLM快速建设现在生活在 src/services/resume_service.pyLLM服务 暴露 embed_text, generate_stream_text,以及 generate_text_response 用于嵌入 以及文本生成。

工具

1.1.通过提供文本获得匹配的工作经验

curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "tools/call",
      "params": {
        "name": "generate_matched_resume",
        "arguments": {
          "input_type": "text",
          "input_data": "We need a backend engineer with FastAPI and AWS.",
          "top_k": 10,
          "threshold": 0.5
        }
      }
    }'

1.2.通过提供url获得匹配的工作经验

  curl -s http://localhost:8001/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "tools/call",
      "params": {
        "name": "generate_matched_resume",
        "arguments": {
          "input_type": "url",
          "input_data": "https://nvidia.wd5.myworkdayjobs.com/en-US/NVIDIAExternalCareerSite/details/Senior-Software-Engineer--AI-Inference-Systems_JR2008495?q=software&locationHierarchy1=2fcb99c455831013ea529c3b93ba3236",
          "top_k": 10,
          "threshold": 0.5
        }
      }
    }'

1.3通过提供pdf文件获得匹配的工作经验

curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "tools/call",
      "params": {
        "name": "generate_matched_resume",
        "arguments": {
          "input_type": "pdf",
          "filename": "job_description.pdf",
          "input_data": "<BASE64_PDF_BYTES>", # web app should send like this
          "input_data": "JVBERi0xLjQKJcTl8uXr...<base64-encoded-pdf-bytes>...",
          "top_k": 10,
          "threshold": 0.5
        }
      }
    }'

1.4.通过搜索配置文件表获取相似内容

curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "tools/call",
      "params": {
        "name": "search_similar_content",
        "arguments": {
          "input_text": "API",
          "top_k": 10,
          "threshold": 0.7
        }
      }
    }'
  1. 生成最新/更新的简历
curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 2,
      "method": "tools/call",
      "params": {
        "name": "search_similar_content",
        "arguments": {
          "job_description": "We need a backend engineer with FastAPI and AWS.",
          "top_k": 5,
          "use_cache": true
        }
      }
    }'
  1. 下载最新简历
curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 3,
      "method": "tools/call",
      "params": {
        "name": "download_latest_resume",
        "arguments": {
          "use_cache": true
        }
      }
    }'
  1. 使用LRU检查存储简历的缓存状态
curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 4,
      "method": "tools/call",
      "params": {
        "name": "resume_cache_status",
        "arguments": {}
      }
    }'

资源

  1. 获取所有资源
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 9,
      "method": "resources/list",
      "params": {}
    }'
  1. 获取服务器信息
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 10,
      "method": "resources/read",
      "params": {
        "uri": "resource://mcp/server-info"
      }
    }'
  1. 获取提示信息
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 11,
      "method": "resources/read",
      "params": {
        "uri": "resource://mcp/prompts"
      }
    }'
  1. 从资源中获取简历生成提示
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 12,
      "method": "resources/read",
      "params": {
        "uri": "resource://mcp/prompts/resume_generation_prompt"
      }
    }'

提示

  1. 列出所有提示
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 5,
      "method": "prompts/list",
      "params": {}
    }'
  1. 获取简历整理提示
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 6,
      "method": "prompts/get",
      "params": {
        "name": "resume_generation_prompt",
        "arguments": {
          "job_description": "We need a backend engineer with FastAPI and AWS.",
          "matched_resumes": []
        }
      }
    }'
  1. 获取作业分析提示
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 7,
      "method": "prompts/get",
      "params": {
        "name": "job_analysis_prompt",
        "arguments": {
          "job_description": "We need a backend engineer with FastAPI and AWS."
        }
      }
    }'
  1. 从源提示符获取简历
  curl -s -X POST http://localhost:8000/mcp \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{
      "jsonrpc": "2.0",
      "id": 8,
      "method": "prompts/get",
      "params": {
        "name": "resume_from_source_prompt",
        "arguments": {
          "job_description": "We need a backend engineer with FastAPI and AWS.",
          "resume_source": {"skills": ["FastAPI", "AWS"]},
          "match_summary": {"top_matches": ["FastAPI"]}
        }
      }
    }'