skills/happycapy-feishu/SKILL.md
为 HappyCapy 安装并授权飞书(Lark)MCP,让 Claude 直接操作飞书消息、文档、多维表格、日历等。当用户提到安装飞书 MCP、配置飞书、接入飞书、飞书 MCP setup、connect feishu/lark、飞书重新授权、飞书 token 过期、lark mcp 失效等场景时,必须使用此 skill。
npx skillsauth add happycapy-ai/happycapy-skills happycapy-feishuInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
首先询问用户: 你是否已经有飞书应用的 App ID 和 App Secret?
告知用户按以下步骤操作,完成后把 App ID 和 App Secret 发给你:
Claude MCP)http://localhost:3000/callback重要: 每次引导用户时,必须读取
assets/feishu-permissions.json并将其完整内容全量输出,不得省略、截断或用省略号代替任何内容。
左侧菜单进入添加应用能力 → 务必开启 机器人 能力
左侧菜单进入事件与回调 → 事件配置:
im.message.receive_v1(接收消息),勾选添加左侧菜单进入版本管理与发布,创建版本并发布(内部测试版即可)
直接编辑 ~/.claude.json,向其中写入 mcpServers 字段(保留已有内容):
python3 -c "
import json, os
f = os.path.expanduser('~/.claude.json')
with open(f) as fp:
cfg = json.load(fp)
cfg.setdefault('mcpServers', {})['lark-mcp'] = {
'command': 'npx',
'args': ['-y', '@larksuiteoapi/lark-mcp', 'mcp',
'-a', '<APP_ID>', '-s', '<APP_SECRET>',
'--oauth',
'--tools', 'preset.default,im.v1.message.reply,im.v1.message.get,im.v1.message.patch,im.v1.message.delete,im.v1.chat.get,im.v1.chat.search']
}
with open(f, 'w') as fp:
json.dump(cfg, fp, indent=2, ensure_ascii=False)
print('MCP 注册完成')
"
无桌面 Linux 环境中 keytar 依赖 dbus-launch,导致 token 只存内存、重启即丢失。先触发下载并定位目录:
# 触发一次确保包已下载
npx -y @larksuiteoapi/lark-mcp --version 2>/dev/null || true
# 定位缓存目录,后续 2.3 和 2.4 共用此变量
LARK_DIR=$(find ~/.npm/_npx -name "package.json" 2>/dev/null \
| xargs grep -l '"@larksuiteoapi/lark-mcp"' 2>/dev/null \
| grep -v node_modules | head -1 | xargs dirname)
echo "LARK_DIR: $LARK_DIR"
使用 skill 内置的预置文件替换 keytar(token 保存在 ~/.lark-mcp-keychain.json):
KEYTAR_PATH="$LARK_DIR/node_modules/keytar/lib/keytar.js"
cp "$KEYTAR_PATH" "${KEYTAR_PATH}.bak"
cp ~/.claude/skills/happycapy-feishu/assets/keytar-file-storage.js "$KEYTAR_PATH"
echo "keytar 替换完成: $KEYTAR_PATH"
lark-mcp 有两处独立超时需要同时修改,必须用 perl -i 而非 sed -i(后者在此环境会截断文件):
# 修复 handler-local.js(HTTP 服务器超时)
HANDLER="$LARK_DIR/node_modules/@larksuiteoapi/lark-mcp/dist/auth/handler/handler-local.js"
perl -i -pe 's/this\.stopServer\(\), 60 \* 1000/this.stopServer(), 300 * 1000/g' "$HANDLER"
# 修复 login-handler.js(token 轮询超时)
LOGIN_HANDLER="$LARK_DIR/node_modules/@larksuiteoapi/lark-mcp/dist/cli/login-handler.js"
perl -i -pe 's/timeout = 60000/timeout = 300000/g' "$LOGIN_HANDLER"
echo "handler-local: $(grep -o '[0-9]* \* 1000' $HANDLER)"
echo "login-handler: $(grep -o 'timeout = [0-9]*' $LOGIN_HANDLER)"
kill $(lsof -ti:3000) 2>/dev/null; sleep 1
nohup npx -y @larksuiteoapi/lark-mcp login \
-a <APP_ID> -s <APP_SECRET> > /tmp/lark-oauth.log 2>&1 &
sleep 5 && cat /tmp/lark-oauth.log
从日志的 Authorization URL 中提取 code_challenge= 后面的值。
跳过此步会导致 callback 时报错
PKCE validation failed: code challenge not found
FEISHU_URL=$(curl -s -w "%{redirect_url}" -o /dev/null \
"http://localhost:3000/authorize?client_id=client_id_for_local_auth&response_type=code&code_challenge=<CODE_CHALLENGE>&code_challenge_method=S256&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&state=reauthorize")
echo "$FEISHU_URL"
把上一步输出的 https://open.feishu.cn/... 链接发给用户,明确告知以下三点:
第一步: 在浏览器打开上面的链接,用飞书账号登录并点击授权。
第二步: 授权完成后,浏览器会自动跳转到一个以
http://localhost:3000/callback?code=...开头的地址,并显示"无法访问此网站"或"连接被拒绝"的错误页面——这是完全正常的,不要关闭页面。第三步: 忽略错误提示,直接复制浏览器地址栏的完整 URL(以
http://localhost:3000/callback开头),粘贴发给我。
curl -s "<用户发来的完整 URL>"
# 返回 "success, you can close this page now" 即成功
npx -y @larksuiteoapi/lark-mcp whoami
tools
Universal LaTeX document skill: create, compile, and convert any document to professional PDF with PNG previews. Supports resumes, reports, cover letters, invoices, academic papers, theses/dissertations, academic CVs, presentations (Beamer), scientific posters, formal letters, exams/quizzes, books, cheat sheets, reference cards, exam formula sheets, fillable PDF forms (hyperref form fields), conditional content (etoolbox toggles), mail merge from CSV/JSON (Jinja2 templates), version diffing (latexdiff), charts (pgfplots + matplotlib), tables (booktabs + CSV import), images (TikZ), Mermaid diagrams, AI-generated images, watermarks, landscape pages, bibliography/citations (BibTeX/biblatex), multi-language/CJK (auto XeLaTeX), algorithms/pseudocode, colored boxes (tcolorbox), SI units (siunitx), Pandoc format conversion (Markdown/DOCX/HTML ↔ LaTeX), and PDF-to-LaTeX conversion of handwritten or printed documents (math, business, legal, general). Compile script supports pdflatex, xelatex, lualatex with auto-detection, latexmk backend, texfot log filtering, PDF/A output, and verbosity control (--verbose/--quiet). Empirically optimized scaling: single agent 1-10 pages, split 11-20, batch-7 pipeline 21+. Use when user asks to: (1) create a resume/CV/cover letter, (2) write a LaTeX document, (3) create PDF with tables/charts/images, (4) compile a .tex file, (5) make a report/invoice/presentation, (6) anything involving LaTeX or pdflatex, (7) convert/OCR a PDF to LaTeX, (8) convert handwritten notes, (9) create charts/graphs/diagrams, (10) create slides, (11) write a thesis or dissertation, (12) create an academic CV, (13) create a poster, (14) create an exam/quiz, (15) create a book, (16) convert between document formats (Markdown, DOCX, HTML to/from LaTeX), (17) generate Mermaid diagrams for LaTeX, (18) create a formal business letter, (19) create a cheat sheet or reference card, (20) create an exam formula sheet or crib sheet, (21) condense lecture notes/PDFs into a cheat sheet, (22) create a fillable PDF form with text fields/checkboxes/dropdowns, (23) create a document with conditional content/toggles (show/hide sections), (24) generate batch/mail-merge documents from CSV/JSON data, (25) create a version diff PDF (latexdiff) highlighting changes between documents, (26) create a homework or assignment submission with problems and solutions, (27) create a lab report with data tables, graphs, and error analysis, (28) encrypt or password-protect a PDF, (29) merge multiple PDFs into one, (30) optimize/compress a PDF for web or email, (31) lint or check a LaTeX document for common issues, (32) count words in a LaTeX document, (33) analyze document statistics (figures, tables, citations), (34) fetch BibTeX from a DOI, (35) convert a Graphviz .dot file to PDF/PNG, (36) convert a PlantUML .puml file to PDF/PNG, (37) create a one-pager/fact sheet/executive summary, (38) create a datasheet or product specification sheet, (39) extract pages from a PDF (page ranges, odd/even), (40) check LaTeX package availability before compiling, (41) analyze citations and cross-reference with .bib files, (42) debug LaTeX compilation errors, (43) make a document accessible (PDF/A, tagged PDF), (44) create lecture notes or course handouts, (45) fill an existing PDF form (fillable fields or non-fillable with annotations), (46) extract text or tables from a PDF (pdfplumber, pypdf), (47) OCR a scanned PDF to text (pytesseract), (48) create a PDF programmatically with reportlab (Canvas, Platypus), (49) rotate or crop PDF pages (pypdf), (50) add a watermark to an existing PDF, (51) extract metadata from a PDF (title, author, subject).
testing
Improves the quality of images, especially screenshots, by enhancing resolution, sharpness, and clarity. Perfect for preparing images for presentations, documentation, or social media posts.
tools
HappyCapy-specific skill for publishing content to 13+ social media platforms (Instagram, Twitter, LinkedIn, Threads, Facebook, TikTok, YouTube, Pinterest, Reddit, Telegram, Discord, etc.) simultaneously with platform-optimized styles, optional AI-generated media (video/image), and smart error handling. Uses Late MCP integration available in HappyCapy environment. Use when you need to cross-post to social media, create multi-platform marketing content, share announcements across platforms, publish with platform-specific adaptations, generate AI media for posts, or manage social media publishing workflows. Supports interactive content creation with user-guided platform selection, media generation choices, preview before publish, and automatic retry with character limit adjustments.
development
Automate HappyCapy skill creation by finding and adapting existing skills from anthropics/skills repository. Handles environment constraints (Python 3.11, Node.js 24, no Docker). Use when user wants to create or adapt skills for specific tasks.