@kontent-ai/mcp-server 0.29.0 → 0.30.0
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 +22 -31
- package/build/bin.js +1 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,28 +154,39 @@ npx @kontent-ai/mcp-server@latest shttp
|
|
|
154
154
|
|
|
155
155
|
## ⚙️ Configuration
|
|
156
156
|
|
|
157
|
-
The server supports two
|
|
157
|
+
The server supports two modes, each tied to its transport:
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
| Transport | Mode | Authentication | Use Case |
|
|
160
|
+
|-----------|------|----------------|----------|
|
|
161
|
+
| **STDIO** | Single-tenant | Environment variables | Local communication with a single Kontent.ai environment |
|
|
162
|
+
| **Streamable HTTP** | Multi-tenant | Bearer token per request | Remote/shared server handling multiple environments |
|
|
160
163
|
|
|
161
|
-
|
|
164
|
+
### Single-Tenant Mode (STDIO)
|
|
165
|
+
|
|
166
|
+
Configure credentials via environment variables:
|
|
162
167
|
|
|
163
168
|
| Variable | Description | Required |
|
|
164
169
|
|----------|-------------|----------|
|
|
165
170
|
| KONTENT_API_KEY | Your Kontent.ai Management API key | ✅ |
|
|
166
171
|
| KONTENT_ENVIRONMENT_ID | Your environment ID | ✅ |
|
|
167
|
-
| PORT | Port for HTTP transport (defaults to 3001) | ❌ |
|
|
168
172
|
| appInsightsConnectionString | Application Insights connection string for telemetry | ❌ |
|
|
169
173
|
| projectLocation | Project location identifier for telemetry tracking | ❌ |
|
|
170
174
|
| manageApiUrl | Custom Management API base URL (for preview environments) | ❌ |
|
|
171
175
|
|
|
172
|
-
### Multi-Tenant Mode
|
|
176
|
+
### Multi-Tenant Mode (Streamable HTTP)
|
|
173
177
|
|
|
174
|
-
For
|
|
178
|
+
For the Streamable HTTP transport, credentials are provided per request:
|
|
175
179
|
- **Environment ID** as a URL path parameter: `/{environmentId}/mcp`
|
|
176
180
|
- **API Key** via Bearer token in the Authorization header: `Authorization: Bearer <api-key>`
|
|
177
181
|
|
|
178
|
-
This
|
|
182
|
+
This allows a single server instance to handle requests for multiple Kontent.ai environments without requiring credential environment variables.
|
|
183
|
+
|
|
184
|
+
| Variable | Description | Required |
|
|
185
|
+
|----------|-------------|----------|
|
|
186
|
+
| PORT | Port for HTTP transport (defaults to 3001) | ❌ |
|
|
187
|
+
| appInsightsConnectionString | Application Insights connection string for telemetry | ❌ |
|
|
188
|
+
| projectLocation | Project location identifier for telemetry tracking | ❌ |
|
|
189
|
+
| manageApiUrl | Custom Management API base URL (for preview environments) | ❌ |
|
|
179
190
|
|
|
180
191
|
## 🚀 Transport Options
|
|
181
192
|
|
|
@@ -196,36 +207,16 @@ To run the server with STDIO transport, configure your MCP client with:
|
|
|
196
207
|
}
|
|
197
208
|
```
|
|
198
209
|
|
|
199
|
-
### 🌊 Streamable HTTP Transport
|
|
210
|
+
### 🌊 Streamable HTTP Transport (Multi-Tenant)
|
|
200
211
|
|
|
201
|
-
|
|
212
|
+
Streamable HTTP transport serves multiple Kontent.ai environments from a single server instance. Each request provides credentials via URL path parameters and Bearer authentication.
|
|
213
|
+
|
|
214
|
+
First start the server:
|
|
202
215
|
|
|
203
216
|
```bash
|
|
204
217
|
npx @kontent-ai/mcp-server@latest shttp
|
|
205
218
|
```
|
|
206
219
|
|
|
207
|
-
#### Single-Tenant Mode
|
|
208
|
-
|
|
209
|
-
With environment variables in a `.env` file, or otherwise accessible to the process:
|
|
210
|
-
```env
|
|
211
|
-
KONTENT_API_KEY=<management-api-key>
|
|
212
|
-
KONTENT_ENVIRONMENT_ID=<environment-id>
|
|
213
|
-
PORT=3001 # optional, defaults to 3001
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Then configure your MCP client:
|
|
217
|
-
```json
|
|
218
|
-
{
|
|
219
|
-
"kontent-ai-http": {
|
|
220
|
-
"url": "http://localhost:3001/mcp"
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
#### Multi-Tenant Mode
|
|
226
|
-
|
|
227
|
-
No environment variables required. The server accepts requests for multiple environments using URL path parameters and Bearer authentication.
|
|
228
|
-
|
|
229
220
|
<details>
|
|
230
221
|
<summary><strong>VS Code</strong></summary>
|
|
231
222
|
|
package/build/bin.js
CHANGED
|
@@ -12,55 +12,6 @@ const version = packageJson.version;
|
|
|
12
12
|
async function startStreamableHTTP() {
|
|
13
13
|
const app = express();
|
|
14
14
|
app.use(express.json());
|
|
15
|
-
app.post("/mcp", async (req, res) => {
|
|
16
|
-
try {
|
|
17
|
-
const { server } = createServer();
|
|
18
|
-
const transport = new StreamableHTTPServerTransport({
|
|
19
|
-
sessionIdGenerator: undefined,
|
|
20
|
-
});
|
|
21
|
-
res.on("close", () => {
|
|
22
|
-
console.log("Request closed");
|
|
23
|
-
transport.close();
|
|
24
|
-
server.close();
|
|
25
|
-
});
|
|
26
|
-
await server.connect(transport);
|
|
27
|
-
await transport.handleRequest(req, res, req.body);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.error("Error handling MCP request:", error);
|
|
31
|
-
trackException(error, "MCP Request Handler");
|
|
32
|
-
if (!res.headersSent) {
|
|
33
|
-
res.status(500).json({
|
|
34
|
-
jsonrpc: "2.0",
|
|
35
|
-
error: {
|
|
36
|
-
code: -32603,
|
|
37
|
-
message: "Internal server error",
|
|
38
|
-
},
|
|
39
|
-
id: null,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
app.get("/mcp", async (_, res) => {
|
|
45
|
-
res.writeHead(405).end(JSON.stringify({
|
|
46
|
-
jsonrpc: "2.0",
|
|
47
|
-
error: {
|
|
48
|
-
code: -32000,
|
|
49
|
-
message: "Method not allowed.",
|
|
50
|
-
},
|
|
51
|
-
id: null,
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
app.delete("/mcp", async (_, res) => {
|
|
55
|
-
res.writeHead(405).end(JSON.stringify({
|
|
56
|
-
jsonrpc: "2.0",
|
|
57
|
-
error: {
|
|
58
|
-
code: -32000,
|
|
59
|
-
message: "Method not allowed.",
|
|
60
|
-
},
|
|
61
|
-
id: null,
|
|
62
|
-
}));
|
|
63
|
-
});
|
|
64
15
|
app.post("/:environmentId/mcp", async (req, res) => {
|
|
65
16
|
try {
|
|
66
17
|
const { environmentId } = req.params;
|
|
@@ -144,8 +95,7 @@ async function startStreamableHTTP() {
|
|
|
144
95
|
const PORT = process.env.PORT || 3001;
|
|
145
96
|
app.listen(PORT, () => {
|
|
146
97
|
console.log(`Kontent.ai MCP Server v${version} (Streamable HTTP) running on port ${PORT}.
|
|
147
|
-
Available
|
|
148
|
-
/mcp
|
|
98
|
+
Available endpoint:
|
|
149
99
|
/{environmentId}/mcp (requires Bearer authentication)`);
|
|
150
100
|
});
|
|
151
101
|
}
|