clew-code 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +292 -299
- package/dist/main.js +2745 -2869
- package/docs/architecture.html +148 -145
- package/docs/architecture.th.html +79 -78
- package/docs/clew-code-architecture.html +1125 -0
- package/docs/commands.html +224 -223
- package/docs/commands.th.html +131 -130
- package/docs/configuration.html +147 -145
- package/docs/configuration.th.html +108 -106
- package/docs/css/styles.css +48 -42
- package/docs/daemon.html +129 -128
- package/docs/daemon.th.html +73 -72
- package/docs/features/bridge-mode.html +99 -98
- package/docs/features/bridge-mode.th.html +90 -89
- package/docs/features/evals.html +182 -181
- package/docs/features/evals.th.html +90 -89
- package/docs/features/peer.html +178 -177
- package/docs/features/searxng-search.html +151 -150
- package/docs/features/searxng-search.th.html +95 -94
- package/docs/features/sentry-setup.html +157 -156
- package/docs/features/sentry-setup.th.html +97 -96
- package/docs/index.html +299 -298
- package/docs/index.th.html +292 -290
- package/docs/installation.html +105 -103
- package/docs/installation.th.html +105 -103
- package/docs/internals/growthbook-ab-testing.html +113 -112
- package/docs/internals/growthbook-ab-testing.th.html +81 -80
- package/docs/internals/hidden-features.html +149 -147
- package/docs/internals/hidden-features.th.html +109 -107
- package/docs/js/main.js +83 -3
- package/docs/loop.html +181 -180
- package/docs/loop.th.html +227 -226
- package/docs/mcp.html +247 -246
- package/docs/mcp.th.html +207 -206
- package/docs/models.html +111 -110
- package/docs/models.th.html +61 -60
- package/docs/peer.html +236 -235
- package/docs/peer.th.html +280 -279
- package/docs/permission-model.html +102 -101
- package/docs/permission-model.th.html +67 -66
- package/docs/plugins.html +102 -101
- package/docs/plugins.th.html +79 -78
- package/docs/providers.html +126 -117
- package/docs/providers.th.html +80 -78
- package/docs/quick-start.html +93 -92
- package/docs/quick-start.th.html +40 -39
- package/docs/research-memory.html +82 -79
- package/docs/research-memory.th.html +72 -71
- package/docs/skills.html +117 -116
- package/docs/skills.th.html +90 -89
- package/docs/tools.html +170 -169
- package/docs/tools.th.html +84 -83
- package/docs/troubleshooting.html +106 -105
- package/docs/troubleshooting.th.html +85 -84
- package/package.json +164 -162
- package/docs/taste.html +0 -436
- package/docs/taste.th.html +0 -236
package/docs/mcp.th.html
CHANGED
|
@@ -1,206 +1,207 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="th">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>MCP
|
|
7
|
-
<meta name="description" content="Model Context Protocol (MCP)
|
|
8
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
-
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
11
|
-
<link rel="stylesheet" href="css/styles.css">
|
|
12
|
-
<link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<header class="header"></header>
|
|
16
|
-
<div class="app">
|
|
17
|
-
<aside class="sidebar" id="sidebar"></aside>
|
|
18
|
-
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
|
19
|
-
<div class="content-wrap">
|
|
20
|
-
<main class="content">
|
|
21
|
-
<div class="breadcrumbs"><a href="index.th.html"
|
|
22
|
-
<h1>Model Context Protocol (MCP)</h1>
|
|
23
|
-
<p class="section-subtitle"
|
|
24
|
-
|
|
25
|
-
<p>MCP
|
|
26
|
-
|
|
27
|
-
<h2
|
|
28
|
-
<pre><code>
|
|
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
|
-
<h2
|
|
77
|
-
|
|
78
|
-
<h3
|
|
79
|
-
<p>MCP servers
|
|
80
|
-
<ol>
|
|
81
|
-
<li><strong><code>settings.json</code></strong>
|
|
82
|
-
<li><strong>CLI <code>--mcp-config</code></strong>
|
|
83
|
-
<li><strong>Plugins</strong>
|
|
84
|
-
</ol>
|
|
85
|
-
|
|
86
|
-
<h3
|
|
87
|
-
<table>
|
|
88
|
-
<tr><th
|
|
89
|
-
<tr>
|
|
90
|
-
<td><strong>Stdio</strong></td>
|
|
91
|
-
<td>stdin/stdout</td>
|
|
92
|
-
<td>Clew spawn subprocess (
|
|
93
|
-
</tr>
|
|
94
|
-
<tr>
|
|
95
|
-
<td><strong>SSE</strong></td>
|
|
96
|
-
<td>HTTP + SSE</td>
|
|
97
|
-
<td
|
|
98
|
-
</tr>
|
|
99
|
-
<tr>
|
|
100
|
-
<td><strong>Direct Connect</strong></td>
|
|
101
|
-
<td>In-process</td>
|
|
102
|
-
<td
|
|
103
|
-
</tr>
|
|
104
|
-
</table>
|
|
105
|
-
|
|
106
|
-
<h3>Tool Lifecycle</h3>
|
|
107
|
-
<pre><code> 1. CONNECT
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
2. DISCOVER
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
3. MERGE
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
4. PRESENT
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
5. EXECUTE
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
6. RESPOND
|
|
123
|
-
|
|
124
|
-
<h3
|
|
125
|
-
<ul>
|
|
126
|
-
<li><strong>OAuth 2.0</strong>
|
|
127
|
-
<li><strong>Bearer token</strong>
|
|
128
|
-
<li><strong>XAA token</strong>
|
|
129
|
-
<li><strong>Credential vault</strong>
|
|
130
|
-
</ul>
|
|
131
|
-
|
|
132
|
-
<h2
|
|
133
|
-
<table>
|
|
134
|
-
<tr><th
|
|
135
|
-
<tr><td><code>/mcp</code></td><td
|
|
136
|
-
<tr><td><code>/mcp list</code></td><td
|
|
137
|
-
<tr><td><code>/mcp add <name> <command> [args...]</code></td><td
|
|
138
|
-
<tr><td><code>/mcp remove <name></code></td><td
|
|
139
|
-
<tr><td><code>/mcp reconnect <name></code></td><td
|
|
140
|
-
</table>
|
|
141
|
-
|
|
142
|
-
<h2
|
|
143
|
-
<div class="code-block-wrap">
|
|
144
|
-
<div class="code-block-header"><span>json</span></div>
|
|
145
|
-
<pre><code>{
|
|
146
|
-
"mcpServers": {
|
|
147
|
-
"filesystem": {
|
|
148
|
-
"command": "npx",
|
|
149
|
-
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"],
|
|
150
|
-
"env": {}
|
|
151
|
-
},
|
|
152
|
-
"database": {
|
|
153
|
-
"command": "node",
|
|
154
|
-
"args": ["./mcp/db-server.js"],
|
|
155
|
-
"env": {
|
|
156
|
-
"DB_URL": "postgresql://localhost:5432/mydb"
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
"remote-api": {
|
|
160
|
-
"url": "https://mcp.example.com",
|
|
161
|
-
"headers": {
|
|
162
|
-
"Authorization": "Bearer sk-..."
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}</code></pre>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<h2>Plugin-Bundled MCP Servers</h2>
|
|
170
|
-
<p>Plugin
|
|
171
|
-
|
|
172
|
-
<h2
|
|
173
|
-
<table>
|
|
174
|
-
<tr><th>Tool</th><th>MCP
|
|
175
|
-
<tr><td><code>ListMcpResources</code></td><td
|
|
176
|
-
<tr><td><code>ReadMcpResource</code></td><td
|
|
177
|
-
</table>
|
|
178
|
-
|
|
179
|
-
<h2
|
|
180
|
-
<table>
|
|
181
|
-
<tr><th
|
|
182
|
-
<tr><td><code>src/services/mcp/MCPConnectionManager.tsx</code></td><td
|
|
183
|
-
<tr><td><code>src/services/mcp/config.ts</code></td><td
|
|
184
|
-
<tr><td><code>src/services/mcp/client.ts</code></td><td>JSON-RPC client</td></tr>
|
|
185
|
-
<tr><td><code>src/services/mcp/auth.ts</code></td><td>OAuth + Bearer token authentication</td></tr>
|
|
186
|
-
<tr><td><code>src/services/mcp/oauthPort.ts</code></td><td>Local HTTP server
|
|
187
|
-
<tr><td><code>src/services/mcp/types.ts</code></td><td>Type definitions</td></tr>
|
|
188
|
-
<tr><td><code>src/services/mcp/InProcessTransport.ts</code></td><td>In-process transport
|
|
189
|
-
<tr><td><code>src/services/mcp/officialRegistry.ts</code></td><td
|
|
190
|
-
<tr><td><code>src/tools.ts</code></td><td>assembleToolPool()
|
|
191
|
-
</table>
|
|
192
|
-
|
|
193
|
-
<footer class="footer">
|
|
194
|
-
<span>Clew Code
|
|
195
|
-
<div class="footer-links">
|
|
196
|
-
<a href="https://github.com/
|
|
197
|
-
<a href="https://github.com/
|
|
198
|
-
</div>
|
|
199
|
-
</footer>
|
|
200
|
-
</main>
|
|
201
|
-
<nav class="toc-sidebar"></nav>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
<script src="js/main.js"></script>
|
|
205
|
-
</body>
|
|
206
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="th">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>MCP — Clew Code</title>
|
|
7
|
+
<meta name="description" content="Model Context Protocol (MCP) — เชื่à¸à¸¡à¸•่à¸à¹€à¸„รื่à¸à¸‡à¸¡à¸·à¸à¸ ายนà¸à¸, ทรัพยาà¸à¸£, à¹à¸¥à¸°à¸šà¸£à¸´à¸à¸²à¸£ ผ่าน stdio, SSE, à¹à¸¥à¸° OAuth">
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
11
|
+
<link rel="stylesheet" href="css/styles.css">
|
|
12
|
+
<link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<header class="header"></header>
|
|
16
|
+
<div class="app">
|
|
17
|
+
<aside class="sidebar" id="sidebar"></aside>
|
|
18
|
+
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
|
19
|
+
<div class="content-wrap">
|
|
20
|
+
<main class="content">
|
|
21
|
+
<div class="breadcrumbs"><a href="index.th.html">หน้าà¹à¸£à¸</a><span class="sep">/</span><span>MCP</span></div>
|
|
22
|
+
<h1>Model Context Protocol (MCP)</h1>
|
|
23
|
+
<p class="section-subtitle">เชื่à¸à¸¡à¸•่ภClew à¸à¸±à¸šà¹€à¸„รื่à¸à¸‡à¸¡à¸·à¸à¸ ายนà¸à¸, à¹à¸«à¸¥à¹ˆà¸‡à¸‚้à¸à¸¡à¸¹à¸¥, à¹à¸¥à¸°à¸šà¸£à¸´à¸à¸²à¸£à¸œà¹ˆà¸²à¸™ MCP — มาตรà¸à¸²à¸™à¹€à¸›à¸´à¸”สำหรับ AI-tool integration</p>
|
|
24
|
+
|
|
25
|
+
<p>MCP à¸à¸¢à¸¹à¹ˆà¹ƒà¸™ <code>src/services/mcp/</code> — Clew ค้นหาเซิร์ฟเวà¸à¸£à¹Œ MCP จาภ<strong>settings.json</strong>, <strong>CLI flags</strong>, à¹à¸¥à¸° <strong>plugin manifests</strong> à¹à¸¥à¹‰à¸§à¸£à¸§à¸¡à¹€à¸„รื่à¸à¸‡à¸¡à¸·à¸à¹€à¸‚้าสู่ runtime</p>
|
|
26
|
+
|
|
27
|
+
<h2>สถาปัตยà¸à¸£à¸£à¸¡</h2>
|
|
28
|
+
<pre><code> ┌──────────────────────────────────────────────────────────────────────────â”
|
|
29
|
+
│ MCP — MODEL CONTEXT PROTOCOL │
|
|
30
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
31
|
+
|
|
32
|
+
┌──────────────────────────â”
|
|
33
|
+
│ Settings / CLI Config │
|
|
34
|
+
│ src/services/mcp/config │
|
|
35
|
+
└────────────┬─────────────┘
|
|
36
|
+
│
|
|
37
|
+
â–¼
|
|
38
|
+
┌──────────────────────────â”
|
|
39
|
+
│ MCPConnectionManager │
|
|
40
|
+
│ จัดà¸à¸²à¸£ lifecycle │
|
|
41
|
+
│ ขà¸à¸‡à¹€à¸‹à¸´à¸£à¹Œà¸Ÿà¹€à¸§à¸à¸£à¹Œ MCP ทั้งหมด │
|
|
42
|
+
└────────────┬─────────────┘
|
|
43
|
+
│
|
|
44
|
+
┌───────────────────┼───────────────────â”
|
|
45
|
+
â–¼ â–¼ â–¼
|
|
46
|
+
┌──────────────┠┌──────────────┠┌──────────────â”
|
|
47
|
+
│ Stdio MCP │ │ SSE MCP │ │Direct Connect│
|
|
48
|
+
│ (subprocess) │ │ (remote) │ │ (in-process) │
|
|
49
|
+
│ npx/node/etc │ │ HTTP + SSE │ │ │
|
|
50
|
+
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
|
|
51
|
+
│ │ │
|
|
52
|
+
└──────────────────┼───────────────────┘
|
|
53
|
+
│
|
|
54
|
+
â–¼
|
|
55
|
+
┌──────────────────────â”
|
|
56
|
+
│ Client (JSON-RPC) │
|
|
57
|
+
│ tools/list │
|
|
58
|
+
│ tools/call │
|
|
59
|
+
│ resources/list │
|
|
60
|
+
└──────────┬───────────┘
|
|
61
|
+
│
|
|
62
|
+
â–¼
|
|
63
|
+
┌──────────────────────â”
|
|
64
|
+
│ assembleToolPool │
|
|
65
|
+
│ (MCP + built-in │
|
|
66
|
+
│ tools รวมà¸à¸±à¸™) │
|
|
67
|
+
└──────────┬───────────┘
|
|
68
|
+
│
|
|
69
|
+
â–¼
|
|
70
|
+
┌──────────────────────â”
|
|
71
|
+
│ Query Engine │
|
|
72
|
+
│ Model เห็น tools │
|
|
73
|
+
│ ทั้งหมดใน pool │
|
|
74
|
+
└──────────────────────┘</code></pre>
|
|
75
|
+
|
|
76
|
+
<h2>วิธีà¸à¸²à¸£à¸—ำงาน</h2>
|
|
77
|
+
|
|
78
|
+
<h3>à¸à¸²à¸£à¸„้นหาเซิร์ฟเวà¸à¸£à¹Œ</h3>
|
|
79
|
+
<p>MCP servers ถูà¸à¸„้นหาจาภ3 à¹à¸«à¸¥à¹ˆà¸‡à¹€à¸¡à¸·à¹ˆà¸à¹€à¸£à¸´à¹ˆà¸¡à¸•้น:</p>
|
|
80
|
+
<ol>
|
|
81
|
+
<li><strong><code>settings.json</code></strong> — คีย์ <code>mcpServers</code> à¸à¸³à¸«à¸™à¸” command, args, env</li>
|
|
82
|
+
<li><strong>CLI <code>--mcp-config</code></strong> — ไฟล์หรืภinline JSON</li>
|
|
83
|
+
<li><strong>Plugins</strong> — manifest ขà¸à¸‡ plugin สามารถประà¸à¸²à¸¨ MCP server ได้; เริ่มเมื่ภplugin โหลด, หยุดเมื่ภunload</li>
|
|
84
|
+
</ol>
|
|
85
|
+
|
|
86
|
+
<h3>ประเภทà¸à¸²à¸£à¹€à¸Šà¸·à¹ˆà¸à¸¡à¸•่à¸</h3>
|
|
87
|
+
<table>
|
|
88
|
+
<tr><th>ประเภท</th><th>Transport</th><th>วิธีà¸à¸²à¸£</th></tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td><strong>Stdio</strong></td>
|
|
91
|
+
<td>stdin/stdout</td>
|
|
92
|
+
<td>Clew spawn subprocess (เช่น <code>npx @modelcontextprotocol/server-filesystem</code>) à¹à¸¥à¸°à¸ªà¸·à¹ˆà¸à¸ªà¸²à¸£à¸œà¹ˆà¸²à¸™ JSON-RPC ทาง stdin/stdout</td>
|
|
93
|
+
</tr>
|
|
94
|
+
<tr>
|
|
95
|
+
<td><strong>SSE</strong></td>
|
|
96
|
+
<td>HTTP + SSE</td>
|
|
97
|
+
<td>เชื่à¸à¸¡à¸•่ภremote MCP server ผ่าน HTTP ใช้ SSE สำหรับ server→client, HTTP POST สำหรับ client→server รà¸à¸‡à¸£à¸±à¸š OAuth</td>
|
|
98
|
+
</tr>
|
|
99
|
+
<tr>
|
|
100
|
+
<td><strong>Direct Connect</strong></td>
|
|
101
|
+
<td>In-process</td>
|
|
102
|
+
<td>รัน MCP server ใน process เดียวà¸à¸±à¸™ ใช้ InProcessTransport — ไม่มี network, ไม่มี subprocess ใช้ใน plugin-bundled servers</td>
|
|
103
|
+
</tr>
|
|
104
|
+
</table>
|
|
105
|
+
|
|
106
|
+
<h3>Tool Lifecycle</h3>
|
|
107
|
+
<pre><code> 1. CONNECT ──► MCPConnectionManager เชื่à¸à¸¡à¸•่ภserver
|
|
108
|
+
│
|
|
109
|
+
â–¼
|
|
110
|
+
2. DISCOVER ──► เรียภtools/list (รà¸à¸‡à¸£à¸±à¸š paginated)
|
|
111
|
+
│
|
|
112
|
+
â–¼
|
|
113
|
+
3. MERGE ──► assembleToolPool() รวม MCP tools
|
|
114
|
+
│ à¸à¸±à¸š built-in tools (sort + dedup)
|
|
115
|
+
â–¼
|
|
116
|
+
4. PRESENT ──► Model เห็น MCP tools เป็น native tools
|
|
117
|
+
│ (permission gating, hooks, logging)
|
|
118
|
+
â–¼
|
|
119
|
+
5. EXECUTE ──► Model เรียภtool → toolExecution.ts
|
|
120
|
+
│ route ไปยัง server ที่ถูà¸à¸•้à¸à¸‡
|
|
121
|
+
â–¼
|
|
122
|
+
6. RESPOND ──► ผลลัพธ์à¸à¸¥à¸±à¸šà¹„ปหา model</code></pre>
|
|
123
|
+
|
|
124
|
+
<h3>à¸à¸²à¸£à¸¢à¸·à¸™à¸¢à¸±à¸™à¸•ัวตน (Authentication)</h3>
|
|
125
|
+
<ul>
|
|
126
|
+
<li><strong>OAuth 2.0</strong> — redirect flow สำหรับ remote MCP servers เปิด local HTTP port เพื่à¸à¸£à¸±à¸š callback</li>
|
|
127
|
+
<li><strong>Bearer token</strong> — static API token ใน <code>Authorization</code> header</li>
|
|
128
|
+
<li><strong>XAA token</strong> — auth provider token สำหรับ Claude-specific servers</li>
|
|
129
|
+
<li><strong>Credential vault</strong> — credentials ที่เà¸à¹‡à¸šà¹„ว้ใน vault ถูภinject à¸à¸±à¸•โนมัติ</li>
|
|
130
|
+
</ul>
|
|
131
|
+
|
|
132
|
+
<h2>คำสั่ง MCP</h2>
|
|
133
|
+
<table>
|
|
134
|
+
<tr><th>คำสั่ง</th><th>คำà¸à¸˜à¸´à¸šà¸²à¸¢</th></tr>
|
|
135
|
+
<tr><td><code>/mcp</code></td><td>เปิดเมนูจัดà¸à¸²à¸£ MCP — list servers, add, remove, reconnect</td></tr>
|
|
136
|
+
<tr><td><code>/mcp list</code></td><td>à¹à¸ªà¸”งเซิร์ฟเวà¸à¸£à¹Œ MCP ทั้งหมด พร้à¸à¸¡ tools, resources, prompts</td></tr>
|
|
137
|
+
<tr><td><code>/mcp add <name> <command> [args...]</code></td><td>เพิ่ม stdio MCP server ใหม่</td></tr>
|
|
138
|
+
<tr><td><code>/mcp remove <name></code></td><td>ลบ MCP server</td></tr>
|
|
139
|
+
<tr><td><code>/mcp reconnect <name></code></td><td>เชื่à¸à¸¡à¸•่ภMCP server ใหม่</td></tr>
|
|
140
|
+
</table>
|
|
141
|
+
|
|
142
|
+
<h2>รูปà¹à¸šà¸š Config (settings.json)</h2>
|
|
143
|
+
<div class="code-block-wrap">
|
|
144
|
+
<div class="code-block-header"><span>json</span></div>
|
|
145
|
+
<pre><code>{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"filesystem": {
|
|
148
|
+
"command": "npx",
|
|
149
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"],
|
|
150
|
+
"env": {}
|
|
151
|
+
},
|
|
152
|
+
"database": {
|
|
153
|
+
"command": "node",
|
|
154
|
+
"args": ["./mcp/db-server.js"],
|
|
155
|
+
"env": {
|
|
156
|
+
"DB_URL": "postgresql://localhost:5432/mydb"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"remote-api": {
|
|
160
|
+
"url": "https://mcp.example.com",
|
|
161
|
+
"headers": {
|
|
162
|
+
"Authorization": "Bearer sk-..."
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}</code></pre>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<h2>Plugin-Bundled MCP Servers</h2>
|
|
170
|
+
<p>Plugin สามารถประà¸à¸²à¸¨ MCP server ใน manifest เมื่ภplugin โหลด Clew จะสร้าง DirectConnect session ให้à¸à¸±à¸•โนมัติ — ไม่ต้à¸à¸‡ subprocess ไม่ต้à¸à¸‡ network — server จะพร้à¸à¸¡à¹ƒà¸Šà¹‰à¸‡à¸²à¸™à¸—ันที</p>
|
|
171
|
+
|
|
172
|
+
<h2>เครื่à¸à¸‡à¸¡à¸·à¸ Built-in ที่ใช้ MCP</h2>
|
|
173
|
+
<table>
|
|
174
|
+
<tr><th>Tool</th><th>MCP ใช้ทำà¸à¸°à¹„ร</th></tr>
|
|
175
|
+
<tr><td><code>ListMcpResources</code></td><td>à¹à¸ªà¸”ง resources จาภMCP servers ทั้งหมด (resources/list)</td></tr>
|
|
176
|
+
<tr><td><code>ReadMcpResource</code></td><td>à¸à¹ˆà¸²à¸™ resource ตาม URI จาภMCP server (resources/read)</td></tr>
|
|
177
|
+
</table>
|
|
178
|
+
|
|
179
|
+
<h2>ไฟล์สำคัà¸</h2>
|
|
180
|
+
<table>
|
|
181
|
+
<tr><th>ไฟล์</th><th>หน้าที่</th></tr>
|
|
182
|
+
<tr><td><code>src/services/mcp/MCPConnectionManager.tsx</code></td><td>จัดà¸à¸²à¸£ lifecycle ขà¸à¸‡à¹€à¸‹à¸´à¸£à¹Œà¸Ÿà¹€à¸§à¸à¸£à¹Œ MCP</td></tr>
|
|
183
|
+
<tr><td><code>src/services/mcp/config.ts</code></td><td>โหลด config จาภsettings.json à¹à¸¥à¸° CLI flags</td></tr>
|
|
184
|
+
<tr><td><code>src/services/mcp/client.ts</code></td><td>JSON-RPC client</td></tr>
|
|
185
|
+
<tr><td><code>src/services/mcp/auth.ts</code></td><td>OAuth + Bearer token authentication</td></tr>
|
|
186
|
+
<tr><td><code>src/services/mcp/oauthPort.ts</code></td><td>Local HTTP server สำหรับ OAuth callback</td></tr>
|
|
187
|
+
<tr><td><code>src/services/mcp/types.ts</code></td><td>Type definitions</td></tr>
|
|
188
|
+
<tr><td><code>src/services/mcp/InProcessTransport.ts</code></td><td>In-process transport สำหรับ DirectConnect</td></tr>
|
|
189
|
+
<tr><td><code>src/services/mcp/officialRegistry.ts</code></td><td>ทะเบียน MCP server ทางà¸à¸²à¸£</td></tr>
|
|
190
|
+
<tr><td><code>src/tools.ts</code></td><td>assembleToolPool() รวม MCP tools</td></tr>
|
|
191
|
+
</table>
|
|
192
|
+
|
|
193
|
+
<footer class="footer">
|
|
194
|
+
<span>Clew Code — โà¸à¹€à¸žà¸™à¸‹à¸à¸£à¹Œà¸ª</span>
|
|
195
|
+
<div class="footer-links">
|
|
196
|
+
<a href="https://github.com/ClewCode/ClewCode">GitHub</a>
|
|
197
|
+
<a href="https://github.com/ClewCode/ClewCode/issues">ปัà¸à¸«à¸²</a>
|
|
198
|
+
</div>
|
|
199
|
+
</footer>
|
|
200
|
+
</main>
|
|
201
|
+
<nav class="toc-sidebar"></nav>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
<script src="js/main.js"></script>
|
|
205
|
+
</body>
|
|
206
|
+
</html>
|
|
207
|
+
|