File size: 14,413 Bytes
0dbc9de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
---
title: MCP μ„œλ²„
description: 둜컬 및 원격 MCP 도ꡬλ₯Ό μΆ”κ°€ν•˜μ„Έμš”.
---

Model Context Protocol , λ˜λŠ” MCPλ₯Ό μ‚¬μš©ν•˜μ—¬ opencode에 μ™ΈλΆ€ 도ꡬλ₯Ό μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€. opencodeλŠ” 둜컬 및 원격 μ„œλ²„λ₯Ό λͺ¨λ‘ μ§€μ›ν•©λ‹ˆλ‹€.

μΆ”κ°€λ˜λ©΄ MCP λ„κ΅¬λŠ” λ‚΄μž₯ 도ꡬ와 ν•¨κ»˜ LLM에 μžλ™μœΌλ‘œ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

---

#### μ£Όμ˜μ‚¬ν•­

MCP μ„œλ²„λ₯Ό μ‚¬μš©ν•  λ•Œ μ»¨ν…μŠ€νŠΈμ— μΆ”κ°€λ©λ‹ˆλ‹€. 도ꡬ가 많으면 μ»¨ν…μŠ€νŠΈκ°€ λΉ λ₯΄κ²Œ μ±„μ›Œμ§ˆ 수 μžˆμŠ΅λ‹ˆλ‹€. κ·Έλž˜μ„œ μš°λ¦¬λŠ” 당신이 μ‚¬μš©ν•˜λŠ” MCP μ„œλ²„μ™€ 주의λ₯Ό κΈ°μšΈμ—¬μ•Ό ν•©λ‹ˆλ‹€.

:::tip
MCP μ„œλ²„λŠ” κ·€ν•˜μ˜ μ»¨ν…μŠ€νŠΈμ— μΆ”κ°€ν•˜λ―€λ‘œ, ν™œμ„±ν™”ν•  수 μžˆλŠ” 것을 μ£Όμ˜ν•΄μ•Ό ν•©λ‹ˆλ‹€.
:::

GitHub MCP μ„œλ²„μ™€ 같은 νŠΉμ • MCP μ„œλ²„λŠ” λ§Žμ€ 토큰을 μΆ”κ°€ν•˜κ³  μ»¨ν…μŠ€νŠΈ μ œν•œμ„ μ‰½κ²Œ 초과 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

---

## ꡬ성

`mcp`μ—μ„œ MCP μ„œλ²„λ₯Ό μ •μ˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 각 MCPλ₯Ό 고유 μ΄λ¦„μœΌλ‘œ μΆ”κ°€ν•©λ‹ˆλ‹€. LLM을 ν”„λ‘¬ν”„νŠΈν•  λ•Œ MCPλ₯Ό μ°Έμ‘°ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```jsonc title="opencode.jsonc" {6}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "name-of-mcp-server": {
      // ...
      "enabled": true,
    },
    "name-of-other-mcp-server": {
      // ...
    },
  },
}
```

`enabled`λ₯Ό `false`둜 μ„€μ •ν•˜μ—¬ μ„œλ²„λ₯Ό λΉ„ν™œμ„±ν™” ν•  수 μžˆμŠ΅λ‹ˆλ‹€. configμ—μ„œ μ œκ±°ν•˜μ§€ μ•Šκ³  μ„œλ²„λ₯Ό μΌμ‹œμ μœΌλ‘œ λΉ„ν™œμ„±ν™”ν•˜λ €λŠ” 경우 μœ μš©ν•©λ‹ˆλ‹€.

---

### 원격 κΈ°λ³Έκ°’ μž¬μ •μ˜

쑰직은 `.well-known/opencode` μ—”λ“œν¬μΈνŠΈλ₯Ό 톡해 κΈ°λ³Έ MCP μ„œλ²„λ₯Ό 제곡 ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 이 μ„œλ²„λŠ” 기본적으둜 λΉ„ν™œμ„±ν™” 될 수 있으며 μ‚¬μš©μžκ°€ ν•„μš”ν•œ 것듀에 λŒ€ν•΄ 선택 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

쑰직의 원격 μ„€μ •μ—μ„œ νŠΉμ • μ„œλ²„λ₯Ό ν™œμ„±ν™”ν•˜λ €λ©΄ `enabled: true`둜 둜컬 ꡬ성에 μΆ”κ°€ν•˜μ‹­μ‹œμ˜€.

```json title="opencode.json"
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "jira": {
      "type": "remote",
      "url": "https://jira.example.com/mcp",
      "enabled": true
    }
  }
}
```

둜컬 μ„€μ • 값은 원격 기본값을 λ¬΄μ‹œν•©λ‹ˆλ‹€. μžμ„Έν•œ λ‚΄μš©μ€ [config precedence](/docs/config#precedence-order)λ₯Ό μ°Έμ‘°ν•˜μ‹­μ‹œμ˜€.

---

## 둜컬

MCP 객체 λ‚΄μ—μ„œ `type`λ₯Ό `"local"`둜 μ‚¬μš©ν•˜λŠ” 둜컬 MCP μ„œλ²„λ₯Ό μΆ”κ°€ν•˜μ‹­μ‹œμ˜€.

```jsonc title="opencode.jsonc" {15}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-local-mcp-server": {
      "type": "local",
      // Or ["bun", "x", "my-mcp-command"]
      "command": ["npx", "-y", "my-mcp-command"],
      "enabled": true,
      "environment": {
        "MY_ENV_VAR": "my_env_var_value",
      },
    },
  },
}
```

λͺ…령은 둜컬 MCP μ„œλ²„κ°€ μ‹œμž‘λ˜λŠ” λ°©λ²•μž…λ‹ˆλ‹€. λ˜ν•œ ν™˜κ²½ λ³€μˆ˜ λͺ©λ‘μ—μ„œ 전달할 수 μžˆμŠ΅λ‹ˆλ‹€.

예λ₯Ό λ“€μ–΄, ν…ŒμŠ€νŠΈ [`@modelcontextprotocol/server-everything`](https://www.npmjs.com/package/@modelcontextprotocol/server-everything) MCP μ„œλ²„λ₯Ό μΆ”κ°€ν•  수 μžˆλŠ” λ°©λ²•μž…λ‹ˆλ‹€.

```jsonc title="opencode.jsonc"
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "mcp_everything": {
      "type": "local",
      "command": ["npx", "-y", "@modelcontextprotocol/server-everything"],
    },
  },
}
```

그리고 `use the mcp_everything tool`λ₯Ό λ‚΄ ν”„λ‘¬ν”„νŠΈμ— μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```txt "mcp_everything"
use the mcp_everything tool to add the number 3 and 4
```

---

#### μ˜΅μ…˜

둜컬 MCP μ„œλ²„λ₯Ό κ΅¬μ„±ν•˜λŠ” λͺ¨λ“  μ˜΅μ…˜μ΄ μžˆμŠ΅λ‹ˆλ‹€.

| μ˜΅μ…˜          | νƒ€μž…    | ν•„μˆ˜ | μ„€λͺ…                                                  |
| ------------- | ------- | ---- | ----------------------------------------------------- |
| `type`        | λ¬Έμžμ—΄  | Y    | MCP μ„œλ²„ μ—°κ²° μœ ν˜•μ€ `"local"`.                       |
| `command`     | Array   | Y    | MCP μ„œλ²„λ₯Ό μ‹€ν–‰ν•˜λŠ” λͺ…λ Ήκ³Ό 인수.                      |
| `environment` | 개체    |      | μ„œλ²„ μ‹€ν–‰μ‹œ μ„€μ •ν•˜λŠ” ν™˜κ²½ λ³€μˆ˜                        |
| `enabled`     | boolean |      | μ‹œλ™μ—μ„œ MCP μ„œλ²„ μ‚¬μš© κ°€λŠ₯                           |
| `timeout`     | number  |      | MCP μ„œλ²„μ—μ„œ νƒœν•‘νˆ΄μ„ μœ„ν•œ νƒ€μž„μ•„μ›ƒ κΈ°λ³Έ 5000 (5 초). |

---

## 원격

`type`λ₯Ό `"remote"`둜 μ„€μ •ν•˜μ—¬ 원격 MCP μ„œλ²„λ₯Ό μΆ”κ°€ν•˜μ‹­μ‹œμ˜€.

```json title="opencode.json"
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-remote-mcp": {
      "type": "remote",
      "url": "https://my-mcp-server.com",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer MY_API_KEY"
      }
    }
  }
}
```

`url`λŠ” 원격 MCP μ„œλ²„μ˜ URL이며 `headers` μ˜΅μ…˜μœΌλ‘œ 헀더 λͺ©λ‘μ—μ„œ 전달할 수 μžˆμŠ΅λ‹ˆλ‹€.

---

#### μ˜΅μ…˜

| μ˜΅μ…˜      | νƒ€μž…    | ν•„μˆ˜ | μ„€λͺ…                                                        |
| --------- | ------- | ---- | ----------------------------------------------------------- |
| `type`    | λ¬Έμžμ—΄  | Y    | MCP μ„œλ²„ μ—°κ²° μœ ν˜•μ€ `"remote"`.                            |
| `url`     | λ¬Έμžμ—΄  | Y    | 원격 MCP μ„œλ²„μ˜ URL.                                        |
| `enabled` | boolean |      | μ‹œλ™μ—μ„œ MCP μ„œλ²„ μ‚¬μš© κ°€λŠ₯                                 |
| `headers` | 개체    |      | ν—€λ“œλŸ¬λŠ” μš”μ²­μœΌλ‘œ λ³΄λ‚΄λ“œλ¦½λ‹ˆλ‹€.                             |
| `oauth`   | 개체    |      | OAuth 인증 ꡬ성 [OAuth](#oauth) μ•„λž˜μ˜ μ„Ήμ…˜μ„ μ°Έμ‘°ν•˜μ‹­μ‹œμ˜€. |
| `timeout` | number  |      | MCP μ„œλ²„μ—μ„œ νƒœν•‘νˆ΄μ„ μœ„ν•œ νƒ€μž„μ•„μ›ƒ κΈ°λ³Έ 5000 (5 초).       |

---

## OAuth

opencodeλŠ” 원격 MCP μ„œλ²„μ— λŒ€ν•œ OAuth 인증을 μžλ™μœΌλ‘œ μ²˜λ¦¬ν•©λ‹ˆλ‹€. μ„œλ²„κ°€ 인증이 ν•„μš”ν•  λ•Œ, opencodeλŠ”:

1. 401 응닡을 κ²€μΆœν•˜κ³  OAuth 흐름을 μ‹œμž‘
2. **Dynamic Client 등둝 (RFC 7591) ** μ„œλ²„μ—μ„œ μ§€μ›λ˜λŠ” 경우
3. 미래의 μš”μ²­μ— λŒ€ν•΄ μ•ˆμ „ν•˜κ²Œ 보관 토큰

---

## μžλ™ μ„€μ •

λŒ€λΆ€λΆ„μ˜ OAuth-enabled MCP μ„œλ²„λ₯Ό μœ„ν•΄, νŠΉλ³„ν•œ ꡬ성은 ν•„μš”ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 원격 μ„œλ²„λ₯Ό ꡬ성:

```json title="opencode.json"
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-oauth-server": {
      "type": "remote",
      "url": "https://mcp.example.com/mcp"
    }
  }
}
```

μ„œλ²„κ°€ 인증이 ν•„μš”ν•œ 경우, opencodeλŠ” λ¨Όμ € μ‚¬μš©ν•˜λ €κ³  ν•  λ•Œ μΈμ¦λ©λ‹ˆλ‹€. κ·Έλ ‡μ§€ μ•Šλ‹€λ©΄, `opencode mcp auth <server-name>`λ₯Ό μ‚¬μš©ν•˜μ—¬ [μˆ˜λ™μœΌλ‘œ 트리거](#authenticating)ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

---

### 사전등둝

MCP μ„œλ²„ κ³΅κΈ‰μžμ˜ ν΄λΌμ΄μ–ΈνŠΈ μžκ²©μ΄μžˆλŠ” 경우, ꡬ성 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```json title="opencode.json" {7-11}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-oauth-server": {
      "type": "remote",
      "url": "https://mcp.example.com/mcp",
      "oauth": {
        "clientId": "{env:MY_MCP_CLIENT_ID}",
        "clientSecret": "{env:MY_MCP_CLIENT_SECRET}",
        "scope": "tools:read tools:execute"
      }
    }
  }
}
```

---

### 인증

인증 λ˜λŠ” 자격 증λͺ…을 μˆ˜λ™μœΌλ‘œ 트리거 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

νŠΉμ • MCP μ„œλ²„μ™€ 인증:

```bash
opencode mcp auth my-oauth-server
```

λͺ¨λ“  MCP μ„œλ²„λ₯Ό λ‚˜μ—΄ν•˜κ³  auth μƒνƒœ:

```bash
opencode mcp list
```

μ €μž₯된 자격 제거:

```bash
opencode mcp logout my-oauth-server
```

`mcp auth` λͺ…령은 μ‚¬μš©μžμ˜ λΈŒλΌμš°μ €λ₯Ό μ—½λ‹ˆλ‹€. `~/.local/share/opencode/mcp-auth.json`μ—μ„œ 토큰을 μ•ˆμ „ν•˜κ²Œ μ €μž₯ν•©λ‹ˆλ‹€.

---

#### OAuth λΉ„ν™œμ„±ν™”

μ„œλ²„μ˜ μžλ™ OAuthλ₯Ό λΉ„ν™œμ„±ν™”ν•˜λ €λŠ” 경우 (예λ₯Ό λ“€μ–΄, λŒ€μ‹  API ν‚€λ₯Ό μ‚¬μš©ν•˜λŠ” μ„œλ²„), `oauth`λ₯Ό `false`둜 μ„€μ •:

```json title="opencode.json" {7}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-api-key-server": {
      "type": "remote",
      "url": "https://mcp.example.com/mcp",
      "oauth": false,
      "headers": {
        "Authorization": "Bearer {env:MY_API_KEY}"
      }
    }
  }
}
```

---

#### OAuth μ˜΅μ…˜

| μ˜΅μ…˜           | μœ ν˜•          | μ„€λͺ…                                                                        |
| -------------- | ------------- | --------------------------------------------------------------------------- |
| `oauth`        | 개체 \| false | OAuth config object, λ˜λŠ” `false`λ₯Ό λΉ„ν™œμ„±ν™”ν•˜λŠ” OAuth μžλ™κ²€μΆœ. Β·          |
| `clientId`     | λ¬Έμžμ—΄        | OAuth ν΄λΌμ΄μ–ΈνŠΈ ID. μ œκ³΅λ˜μ§€ μ•Šμ€ 경우, 동적 ν΄λΌμ΄μ–ΈνŠΈ 등둝 μ‹œλ„λ©λ‹ˆλ‹€. Β· |
| `clientSecret` | String        | OAuth ν΄λΌμ΄μ–ΈνŠΈ λΉ„λ°€, ν—ˆκ°€μ„œ μ„œλ²„κ°€ ν•„μš”ν•œ 경우.                           |
| `scope`        | String        | OAuth λ²”μœ„λŠ” 인증 μ€‘μž…λ‹ˆλ‹€.                                                 |

###### 디버깅

원격 MCP μ„œλ²„κ°€ 인증에 μ‹€νŒ¨ν•˜λ©΄ λ‹€μŒκ³Ό 같은 문제λ₯Ό 진단 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```bash
# View auth status for all OAuth-capable servers
opencode mcp auth list

# Debug connection and OAuth flow for a specific server
opencode mcp debug my-oauth-server
```

`mcp debug` λͺ…령은 ν˜„μž¬ auth μƒνƒœλ₯Ό 보여 μ£Όλ©° HTTP 연결을 ν…ŒμŠ€νŠΈν•˜κ³  OAuth 발견 흐름을 μ‹œλ„ν•©λ‹ˆλ‹€.

---

## 관리

MCPλŠ” opencode의 λ„κ΅¬λ‘œ μ‚¬μš©ν•  수 있으며 λ‚΄μž₯ 도ꡬ와 ν•¨κ»˜ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€. λ‹€λ₯Έ 도ꡬ와 같이 opencode configλ₯Ό 톡해 관리할 수 μžˆμŠ΅λ‹ˆλ‹€.

---

## μ „μ—­

μ΄λŠ” μ „μ—­μ μœΌλ‘œ ν™œμ„±ν™”ν•˜κ±°λ‚˜ λΉ„ν™œμ„±ν™”ν•  수 μžˆμŒμ„ μ˜λ―Έν•©λ‹ˆλ‹€.

```json title="opencode.json" {14}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-mcp-foo": {
      "type": "local",
      "command": ["bun", "x", "my-mcp-command-foo"]
    },
    "my-mcp-bar": {
      "type": "local",
      "command": ["bun", "x", "my-mcp-command-bar"]
    }
  },
  "tools": {
    "my-mcp-foo": false
  }
}
```

λ˜ν•œ glob νŒ¨ν„΄μ„ μ‚¬μš©ν•˜μ—¬ μΌμΉ˜ν•˜λŠ” λͺ¨λ“  MCPλ₯Ό λΉ„ν™œμ„±ν™”ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```json title="opencode.json" {14}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-mcp-foo": {
      "type": "local",
      "command": ["bun", "x", "my-mcp-command-foo"]
    },
    "my-mcp-bar": {
      "type": "local",
      "command": ["bun", "x", "my-mcp-command-bar"]
    }
  },
  "tools": {
    "my-mcp*": false
  }
}
```

여기에 μš°λ¦¬λŠ” λͺ¨λ“  MCPλ₯Ό λΉ„ν™œμ„±ν™”ν•˜λŠ” glob νŒ¨ν„΄ `my-mcp*`λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.

---

## μ—μ΄μ „νŠΈλ³„

λ§Žμ€ MCP μ„œλ²„κ°€ μžˆλ‹€λ©΄ μ „μ—­μ μœΌλ‘œλŠ” λΉ„ν™œμ„±ν™”ν•˜κ³  μ—μ΄μ „νŠΈλ³„λ‘œλ§Œ ν™œμ„±ν™”ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 이 μž‘μ—…μ„ μˆ˜ν–‰:

1. κΈ€λ‘œλ²Œ λ„κ΅¬λ‘œ μ‚¬μš© κ°€λŠ₯.
2. [agent config](/docs/agents#tools)μ—μ„œ MCP μ„œλ²„λ₯Ό λ„κ΅¬λ‘œ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```json title="opencode.json" {11, 14-18}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "my-mcp": {
      "type": "local",
      "command": ["bun", "x", "my-mcp-command"],
      "enabled": true
    }
  },
  "tools": {
    "my-mcp*": false
  },
  "agent": {
    "my-agent": {
      "tools": {
        "my-mcp*": true
      }
    }
  }
}
```

---

### Glob νŒ¨ν„΄

glob νŒ¨ν„΄μ€ κ°„λ‹¨ν•œ regex globbing νŒ¨ν„΄μ„ μ‚¬μš©ν•©λ‹ˆλ‹€ :

- `*`λŠ” μ–΄λ–€ νŠΉμ„± (예λ₯Όλ“€λ©΄, `"my-mcp*"` κ²½κΈ° `my-mcp_search`, `my-mcp_list`, λ“±)의 0개 이상 μΌμΉ˜ν•©λ‹ˆλ‹€.
- `?`λŠ” μ •ν™•νžˆ ν•˜λ‚˜μ˜ 문자 일치
- λ‹€λ₯Έ λͺ¨λ“  문자 일치 말 κ·ΈλŒ€λ‘œ

:::note
MCP μ„œλ²„ λ„κ΅¬λŠ” μ„œλ²„ μ΄λ¦„μœΌλ‘œ prefix둜 λ“±λ‘λ˜λ―€λ‘œ μ„œλ²„μ˜ λͺ¨λ“  도ꡬλ₯Ό κ°„λ‹¨ν•˜κ²Œ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```
"mymcpservername_*": false
```

:::

---

## 예제

λ‹€μŒμ€ 일반적인 MCP μ„œλ²„μ˜ μ˜ˆμž…λ‹ˆλ‹€. λ‹€λ₯Έ μ„œλ²„μ— λ¬Έμ„œλ₯Ό μž‘μ„±ν•˜λ €λ©΄ PR을 μ œμΆœν•  수 μžˆμŠ΅λ‹ˆλ‹€.

---

#### Sentry

[Sentry MCP μ„œλ²„](https://mcp.sentry.dev)λ₯Ό μΆ”κ°€ν•˜μ—¬ Sentry ν”„λ‘œμ νŠΈμ™€ λ¬Έμ œμ™€ μƒν˜Έ μž‘μš©ν•©λ‹ˆλ‹€.

```json title="opencode.json" {4-8}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "sentry": {
      "type": "remote",
      "url": "https://mcp.sentry.dev/mcp",
      "oauth": {}
    }
  }
}
```

ꡬ성을 μΆ”κ°€ ν•œ ν›„, Sentry둜 인증:

```bash
opencode mcp auth sentry
```

λΈŒλΌμš°μ € 창을 μ—΄μ–΄ OAuth 흐름을 μ™„λ£Œν•˜κ³  opencodeλ₯Ό Sentry 계정에 μ—°κ²°ν•˜μ‹­μ‹œμ˜€.

일단 인증되면, 당신은 쿼리 문제, ν”„λ‘œμ νŠΈ, 였λ₯˜ 데이터에 λŒ€ν•œ ν”„λ¦°νŠΈ 도ꡬλ₯Ό μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```txt "use sentry"
Show me the latest unresolved issues in my project. use sentry
```

---

### Context7

[Context7 MCP μ„œλ²„](https://github.com/upstash/context7)을 μΆ”κ°€ν•˜μ—¬ λ¬Έμ„œλ₯Ό κ²€μƒ‰ν•©λ‹ˆλ‹€.

```json title="opencode.json" {4-7}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "context7": {
      "type": "remote",
      "url": "https://mcp.context7.com/mcp"
    }
  }
}
```

무료 κ³„μ •μœΌλ‘œ κ°€μž…ν•œ 경우 API ν‚€λ₯Ό μ‚¬μš©ν•˜μ—¬ 더 높은 속도 μ œν•œμ„ 얻을 수 μžˆμŠ΅λ‹ˆλ‹€.

```json title="opencode.json" {7-9}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "context7": {
      "type": "remote",
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
      }
    }
  }
}
```

μ—¬κΈ°μ—μ„œ μš°λ¦¬λŠ” 당신이 `CONTEXT7_API_KEY` ν™˜κ²½ λ³€μˆ˜ μ„ΈνŠΈκ°€ μžˆλ‹€λŠ” 것을 assumingμž…λ‹ˆλ‹€.

Context7 MCP μ„œλ²„λ₯Ό μ‚¬μš©ν•˜μ—¬ `use context7`λ₯Ό μ‹ μ†ν•˜κ²Œ μΆ”κ°€ν•˜μ‹­μ‹œμ˜€.

```txt "use context7"
Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7
```

λŒ€μ•ˆμœΌλ‘œ, 당신은이 같은 λ­”κ°€λ₯Ό μΆ”κ°€ ν•  수 μžˆμŠ΅λ‹ˆλ‹€ [AGENTS.md](/docs/rules/).

```md title="AGENTS.md"
When you need to search docs, use `context7` tools.
```

---

## Grep by Vercel

[Grep by Vercel](https://grep.app) MCP μ„œλ²„λ₯Ό μΆ”κ°€ν•˜μ—¬ GitHubμ—μ„œ μ½”λ“œ μŠ€λ‹ˆνŽ«μ„ κ²€μƒ‰ν•©λ‹ˆλ‹€.

```json title="opencode.json" {4-7}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "gh_grep": {
      "type": "remote",
      "url": "https://mcp.grep.app"
    }
  }
}
```

MCP μ„œλ²„ `gh_grep`λΌλŠ” μ΄λ¦„μœΌλ‘œ, `use the gh_grep tool`λ₯Ό μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

```txt "use the gh_grep tool"
What's the right way to set a custom domain in an SST Astro component? use the gh_grep tool
```

λŒ€μ•ˆμœΌλ‘œ, 당신은이 같은 λ­”κ°€λ₯Ό μΆ”κ°€ ν•  수 μžˆμŠ΅λ‹ˆλ‹€ [AGENTS.md](/docs/rules/).

```md title="AGENTS.md"
If you are unsure how to do something, use `gh_grep` to search code examples from GitHub.
```