@letoribo/mcp-graphql-enhanced 3.4.0 → 3.5.1
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 +9 -0
- package/dist/index.js +33 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
An **enhanced MCP (Model Context Protocol) server for GraphQL** that fixes real-world interoperability issues between LLMs and GraphQL APIs.
|
|
4
4
|
> Drop-in replacement for `mcp-graphql` — with dynamic headers, robust variables parsing, and zero breaking changes.
|
|
5
5
|
|
|
6
|
+
## 💬 Community & Support
|
|
7
|
+
|
|
8
|
+
Join the conversation! If you have questions about using this bridge with Neo4j, Discord data graphs, or GraphQL in general, come hang out with us:
|
|
9
|
+
|
|
10
|
+
* **Discord Channel:** [#mcp-graphql-enhanced](https://discord.com/channels/625400653321076807/1480510460339159184)
|
|
11
|
+
* **Server:** The official **GraphQL Discord**
|
|
12
|
+
|
|
13
|
+
This is the best place to share your feedback, report issues, or suggest new "enhanced" features for the bridge.
|
|
14
|
+
|
|
6
15
|
## ✨ Key Enhancements
|
|
7
16
|
* ✅ **Built-in GraphiQL IDE** — Visual playground at http://localhost:MCP_PORT/ (or /graphiql) with pre-configured headers.
|
|
8
17
|
* ✅ **Dual Transport** — Supports both **STDIO** (for local CLI/client tools) and **HTTP/JSON-RPC** (for external/browser clients).
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ const env = EnvSchema.parse(process.env);
|
|
|
58
58
|
const server = new mcp_js_1.McpServer({
|
|
59
59
|
name: env.NAME,
|
|
60
60
|
version: getVersion(),
|
|
61
|
+
description: "Start of the #mcp-graphql-enhanced channel on GraphQL server. Join here: https://discord.com/channels/622115132221685760/1348633379555184640"
|
|
61
62
|
});
|
|
62
63
|
// --- CACHE STATE ---
|
|
63
64
|
let cachedSDL = null;
|
|
@@ -298,10 +299,15 @@ const introspectHandler = async ({ typeNames }) => {
|
|
|
298
299
|
});
|
|
299
300
|
}
|
|
300
301
|
const coreEntities = Array.from(discoveredEntities).sort();
|
|
302
|
+
const communityHeader = [
|
|
303
|
+
`🌐 Community Channel: #mcp-graphql-enhanced`,
|
|
304
|
+
`🔗 Join the discussion: https://discord.com/channels/625400653321076807/1480510460339159184`,
|
|
305
|
+
`---`
|
|
306
|
+
].join('\n');
|
|
301
307
|
return {
|
|
302
308
|
content: [{
|
|
303
309
|
type: "text",
|
|
304
|
-
text: `${evolutionSummary}\n\n` + // Include the report from performUpdate
|
|
310
|
+
text: `${communityHeader}\n${evolutionSummary}\n\n` + // Include the report from performUpdate
|
|
305
311
|
`GraphQL Schema Manifest [ID: ${schemaVersion}]\n\n` +
|
|
306
312
|
`ENTRY_POINT_ENTITIES: ${coreEntities.join(", ") || "None"}\n` +
|
|
307
313
|
`TOTAL_SCHEMA_TYPES: ${typeKeys.length}\n\n` +
|
|
@@ -369,18 +375,38 @@ async function handleHttpRequest(req, res) {
|
|
|
369
375
|
}
|
|
370
376
|
// --- STARTUP ---
|
|
371
377
|
async function main() {
|
|
372
|
-
|
|
378
|
+
const rawEnableHttp = process.env.ENABLE_HTTP;
|
|
379
|
+
// Determine if we should open the HTTP port.
|
|
380
|
+
// 1. Check if we're not running inside the MCP Inspector.
|
|
381
|
+
// 2. Ensure the user hasn't explicitly disabled HTTP (ENABLE_HTTP="false").
|
|
382
|
+
const isInspector = !!(process.env.MCP_INSPECTOR || process.env.INSPECTOR_PORT);
|
|
383
|
+
const shouldOpenPort = rawEnableHttp !== "false" && !isInspector;
|
|
384
|
+
if (shouldOpenPort) {
|
|
373
385
|
const serverHttp = node_http_1.default.createServer(handleHttpRequest);
|
|
386
|
+
// Error handling to prevent crashes if the port is already in use
|
|
387
|
+
serverHttp.on('error', (e) => {
|
|
388
|
+
if (e.code !== 'EADDRINUSE')
|
|
389
|
+
console.error(`[HTTP-ERROR] ${e.message}`);
|
|
390
|
+
});
|
|
374
391
|
serverHttp.listen(env.MCP_PORT, () => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
392
|
+
// Log URLs only if HTTP is explicitly enabled
|
|
393
|
+
if (env.ENABLE_HTTP === true) {
|
|
394
|
+
console.error(`[HTTP] Server started on http://localhost:${env.MCP_PORT}`);
|
|
395
|
+
console.error(`🎨 GraphiQL IDE: http://localhost:${env.MCP_PORT}/graphiql`);
|
|
396
|
+
}
|
|
397
|
+
console.error(`🤖 MCP Endpoint: http://localhost:${env.MCP_PORT}/mcp`);
|
|
378
398
|
});
|
|
379
399
|
}
|
|
380
400
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
381
401
|
await server.connect(transport);
|
|
382
|
-
|
|
383
|
-
|
|
402
|
+
// Maintain quiet mode when running inside the Inspector to avoid protocol interference
|
|
403
|
+
if (!isInspector) {
|
|
404
|
+
console.error(`[STDIO] MCP Server "${env.NAME}" v${getVersion()} started`);
|
|
405
|
+
}
|
|
406
|
+
getSchema().catch(e => {
|
|
407
|
+
if (!isInspector)
|
|
408
|
+
console.error(`[SCHEMA] Warning: ${e.message}`);
|
|
409
|
+
});
|
|
384
410
|
}
|
|
385
411
|
process.on('SIGINT', () => process.exit(0));
|
|
386
412
|
process.on('SIGTERM', () => process.exit(0));
|
package/package.json
CHANGED