Skip to content

Commit 58c35ba

Browse files
authored
Merge pull request #3 from Chengmun58/claude/add-lark-wiki-docs-PYpDg
docs: add Lark Wiki integration section to README
2 parents 9c68400 + db1b5ff commit 58c35ba

1 file changed

Lines changed: 208 additions & 0 deletions

File tree

docs/lark-wiki-integration.md

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# Lark Wiki Integration
2+
3+
This server ships with [`install-lark-cli.sh`](../install-lark-cli.sh) which installs the [lark-cli](https://github.com/larksuite/cli) tool alongside the Hostinger MCP server. Once installed, AI agents have access to Lark/Feishu Wiki knowledge-base operations through the `lark-cli wiki` family of commands.
4+
5+
## Quick Setup
6+
7+
```bash
8+
# Install lark-cli and its AI agent skills
9+
bash install-lark-cli.sh
10+
11+
# Configure Lark app credentials (interactive)
12+
lark-cli config init
13+
14+
# Authenticate
15+
lark-cli auth login --recommend
16+
```
17+
18+
## Available Wiki Commands
19+
20+
### Shortcuts (Recommended)
21+
22+
Shortcuts are high-level wrappers that handle common multi-step workflows automatically.
23+
24+
| Command | Description |
25+
|---------|-------------|
26+
| `lark-cli wiki +node-create` | Create a wiki node with automatic space resolution |
27+
| `lark-cli wiki +node-copy` | Copy a wiki node to a new location, with automatic space resolution |
28+
| `lark-cli wiki +move` | Move a wiki node, or migrate a Drive document into Wiki |
29+
| `lark-cli wiki +delete-space` | Delete a wiki space (async-safe with polling) |
30+
31+
### `wiki +node-create`
32+
33+
Creates a new node in a Lark Wiki space. Resolves the target space automatically from a parent node token or falls back to the caller's personal document library.
34+
35+
```bash
36+
# Create a page in your personal wiki (user identity default)
37+
lark-cli wiki +node-create --title "Project Plan"
38+
39+
# Create under a specific parent node
40+
lark-cli wiki +node-create \
41+
--parent-node-token <PARENT_TOKEN> \
42+
--title "Sprint Notes"
43+
44+
# Create in an explicit space
45+
lark-cli wiki +node-create \
46+
--space-id <SPACE_ID> \
47+
--title "Release Checklist"
48+
49+
# Create a shortcut node pointing to an existing node
50+
lark-cli wiki +node-create \
51+
--parent-node-token <PARENT_TOKEN> \
52+
--node-type shortcut \
53+
--origin-node-token <ORIGIN_TOKEN> \
54+
--title "Shortcut to Design Doc"
55+
56+
# Preview without writing
57+
lark-cli wiki +node-create --title "Draft" --dry-run
58+
```
59+
60+
**Key flags:**
61+
62+
| Flag | Required | Description |
63+
|------|----------|-------------|
64+
| `--title` | No | Node title |
65+
| `--space-id` | No | Target space ID; use `my_library` for personal wiki |
66+
| `--parent-node-token` | No | Parent node token; space is inferred automatically |
67+
| `--node-type` | No | `origin` (default) or `shortcut` |
68+
| `--obj-type` | No | `docx` (default), `sheet`, `bitable`, `mindnote`, `slides` |
69+
| `--origin-node-token` | No | Required when `--node-type=shortcut` |
70+
71+
### `wiki +node-copy`
72+
73+
Copies an existing wiki node to a new location within the same space. The space ID is resolved automatically from the node token when omitted.
74+
75+
```bash
76+
# Copy a node (space resolved automatically)
77+
lark-cli wiki +node-copy --node-token <NODE_TOKEN>
78+
79+
# Copy to a specific parent node
80+
lark-cli wiki +node-copy \
81+
--node-token <NODE_TOKEN> \
82+
--target-parent-token <TARGET_PARENT_TOKEN>
83+
84+
# Copy with a new title
85+
lark-cli wiki +node-copy \
86+
--node-token <NODE_TOKEN> \
87+
--title "Copy: Project Plan"
88+
89+
# Provide space ID explicitly (skips the look-up step)
90+
lark-cli wiki +node-copy \
91+
--node-token <NODE_TOKEN> \
92+
--space-id <SPACE_ID> \
93+
--target-parent-token <TARGET_PARENT_TOKEN>
94+
95+
# Preview without writing
96+
lark-cli wiki +node-copy --node-token <NODE_TOKEN> --dry-run
97+
```
98+
99+
**Key flags:**
100+
101+
| Flag | Required | Description |
102+
|------|----------|-------------|
103+
| `--node-token` | Yes | Wiki node token to copy |
104+
| `--space-id` | No | Source space ID; inferred from `--node-token` if omitted |
105+
| `--target-parent-token` | No | Target parent node; defaults to same parent as source |
106+
| `--title` | No | Title for the copy; defaults to original title |
107+
108+
**Required scopes:** `wiki:node:copy`, `wiki:node:read`
109+
110+
### `wiki +move`
111+
112+
Moves an existing wiki node to a different location, or migrates a Drive document into a wiki space. Handles both synchronous and asynchronous API responses.
113+
114+
```bash
115+
# Move a wiki node to another parent
116+
lark-cli wiki +move \
117+
--node-token <NODE_TOKEN> \
118+
--target-parent-token <TARGET_PARENT_TOKEN>
119+
120+
# Move a wiki node to a space root
121+
lark-cli wiki +move \
122+
--node-token <NODE_TOKEN> \
123+
--target-space-id <TARGET_SPACE_ID>
124+
125+
# Migrate a Drive document into wiki
126+
lark-cli wiki +move \
127+
--obj-type docx \
128+
--obj-token <DOC_TOKEN> \
129+
--target-space-id <TARGET_SPACE_ID>
130+
```
131+
132+
### `wiki +delete-space`
133+
134+
Deletes a wiki space. Polls the async task automatically within a bounded window and returns a resume command if the task is still processing.
135+
136+
```bash
137+
# Delete a wiki space (irreversible — --yes required)
138+
lark-cli wiki +delete-space \
139+
--space-id <SPACE_ID> \
140+
--yes
141+
```
142+
143+
> **Warning:** This operation is irreversible. The `--yes` flag is required as an explicit confirmation.
144+
145+
## Raw API Access
146+
147+
For operations not covered by shortcuts, use the underlying API commands directly:
148+
149+
```bash
150+
# Inspect available parameters before calling
151+
lark-cli schema wiki.spaces.list
152+
lark-cli schema wiki.nodes.list
153+
lark-cli schema wiki.members.create
154+
155+
# List wiki spaces
156+
lark-cli wiki spaces list --format json
157+
158+
# Get a node by token
159+
lark-cli wiki spaces get_node --params '{"token":"<wiki_token>"}'
160+
161+
# List child nodes of a space
162+
lark-cli wiki nodes list --params '{"space_id":"<SPACE_ID>"}'
163+
164+
# Add a space member
165+
lark-cli wiki members create \
166+
--params '{"space_id":"<SPACE_ID>"}' \
167+
--data '{"member_type":"openid","member_id":"<OPEN_ID>","role":"editor"}'
168+
```
169+
170+
## Permissions Reference
171+
172+
| Operation | Required Scope |
173+
|-----------|----------------|
174+
| `nodes.copy` / `+node-copy` | `wiki:node:copy`, `wiki:node:read` |
175+
| `nodes.create` / `+node-create` | `wiki:node:create`, `wiki:node:read`, `wiki:space:read` |
176+
| `+move` (node mode) | `wiki:node:move`, `wiki:node:read`, `wiki:space:read` |
177+
| `+delete-space` | `wiki:space:write_only`, `wiki:space:read` |
178+
| `spaces.list` | `wiki:space:retrieve` |
179+
| `spaces.get` / `spaces.get_node` | `wiki:space:read` / `wiki:node:read` |
180+
| `members.create` | `wiki:member:create` |
181+
| `members.delete` | `wiki:member:update` |
182+
| `members.list` | `wiki:member:retrieve` |
183+
| `nodes.list` | `wiki:node:retrieve` |
184+
185+
To grant the necessary scopes:
186+
187+
```bash
188+
lark-cli auth login --scope "wiki:node:copy wiki:node:read wiki:node:create wiki:space:read"
189+
```
190+
191+
## Identity Modes
192+
193+
All wiki commands support `--as user` (default) and `--as bot`:
194+
195+
```bash
196+
# Run as the authenticated user
197+
lark-cli wiki +node-copy --node-token <TOKEN> --as user
198+
199+
# Run as the configured bot (app identity)
200+
lark-cli wiki +node-copy --node-token <TOKEN> --as bot
201+
```
202+
203+
> **Note:** Bot identity cannot access the personal wiki library (`my_library`) and does not support adding department members to wiki spaces. Use `--as user` for those operations.
204+
205+
## Further Reading
206+
207+
- [lark-cli README](https://github.com/larksuite/cli)
208+
- [Lark Open Platform — Wiki API](https://open.larksuite.com/document/server-docs/docs/wiki-v2/wiki-overview)

0 commit comments

Comments
 (0)