@letoribo/mcpgql 1.2.2 → 1.3.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/core.ts +26 -6
- package/mcpgql.config.json +6 -2
- package/package.json +12 -2
package/core.ts
CHANGED
|
@@ -53,30 +53,34 @@ function getDistPath(): string {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
async function startSelection(
|
|
56
|
+
config: Config,
|
|
56
57
|
entries: [string, string][],
|
|
57
58
|
selected: Set<string>,
|
|
58
59
|
allowMutations: { value: boolean },
|
|
59
60
|
headers: { value: string }
|
|
60
61
|
) {
|
|
61
|
-
const mutationIdx = entries.length + 1;
|
|
62
|
-
const headersIdx = entries.length + 2;
|
|
63
|
-
|
|
64
62
|
while (true) {
|
|
63
|
+
const mutationIdx = entries.length + 1;
|
|
64
|
+
const headersIdx = entries.length + 2;
|
|
65
|
+
const addEndpointIdx = entries.length + 3;
|
|
66
|
+
|
|
65
67
|
console.clear();
|
|
66
68
|
console.log('\n--- Select Endpoints (Enter to confirm) ---');
|
|
67
69
|
entries.forEach(([key], i) => {
|
|
68
70
|
console.log(`${selected.has(key) ? ' [✓] ' : ' [ ] '} ${i + 1}. ${key}`);
|
|
69
71
|
});
|
|
70
72
|
|
|
71
|
-
console.log('--- Environment variables ---');
|
|
73
|
+
console.log('--- Environment variables & Config ---');
|
|
72
74
|
const mutationStatus = allowMutations.value ? '[YES]' : '[NO]';
|
|
73
75
|
console.log(`${mutationStatus} ${mutationIdx}. Allow Mutations`);
|
|
74
76
|
|
|
75
77
|
let hasAuth = false;
|
|
76
78
|
try { if (Object.keys(JSON.parse(headers.value)).length > 0) hasAuth = true; } catch (e) {}
|
|
77
79
|
console.log(`${hasAuth ? '[OK]' : '[ ]'} ${headersIdx}. Headers (Loaded from: ${headersPath})`);
|
|
80
|
+
|
|
81
|
+
console.log(`[+] ${addEndpointIdx}. Add New Endpoint`);
|
|
78
82
|
|
|
79
|
-
const choice = await rl.question('\nEnter number to toggle (or Enter to proceed): ');
|
|
83
|
+
const choice = await rl.question('\nEnter number to toggle/edit (or Enter to proceed): ');
|
|
80
84
|
if (choice.trim() === '') break;
|
|
81
85
|
|
|
82
86
|
const choiceNum = parseInt(choice.trim());
|
|
@@ -103,6 +107,22 @@ async function startSelection(
|
|
|
103
107
|
}
|
|
104
108
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
105
109
|
}
|
|
110
|
+
} else if (choiceNum === addEndpointIdx) {
|
|
111
|
+
console.log('\n--- Add New Endpoint ---');
|
|
112
|
+
const newName = await rl.question('Enter friendly name (e.g. "Staging API"): ');
|
|
113
|
+
if (newName.trim() !== '') {
|
|
114
|
+
const newUrl = await rl.question('Enter GraphQL URL (e.g. "https://api.example.com/graphql"): ');
|
|
115
|
+
if (newUrl.trim() !== '') {
|
|
116
|
+
config.endpoints[newName.trim()] = newUrl.trim();
|
|
117
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
118
|
+
|
|
119
|
+
entries.push([newName.trim(), newUrl.trim()]);
|
|
120
|
+
selected.add(newName.trim());
|
|
121
|
+
|
|
122
|
+
console.log(`[INFO] Endpoint '${newName.trim()}' added successfully.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
106
126
|
}
|
|
107
127
|
}
|
|
108
128
|
}
|
|
@@ -118,7 +138,7 @@ async function main() {
|
|
|
118
138
|
const allowMutations = { value: false };
|
|
119
139
|
const headers = { value: fs.readFileSync(headersPath, 'utf-8') };
|
|
120
140
|
|
|
121
|
-
await startSelection(entries, selected, allowMutations, headers);
|
|
141
|
+
await startSelection(config, entries, selected, allowMutations, headers);
|
|
122
142
|
|
|
123
143
|
const selectedUrls = Array.from(selected).map(k => config.endpoints[k]);
|
|
124
144
|
if (selectedUrls.length === 0) {
|
package/mcpgql.config.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"activeEndpoints": [
|
|
2
|
+
"activeEndpoints": [
|
|
3
|
+
"mcp",
|
|
4
|
+
"neo4j"
|
|
5
|
+
],
|
|
3
6
|
"endpoints": {
|
|
4
7
|
"mcp": "https://mcp-discord.vercel.app/api/graphiql",
|
|
5
|
-
"neo4j": "https://mcp-neo4j-discord.vercel.app/api/graphiql"
|
|
8
|
+
"neo4j": "https://mcp-neo4j-discord.vercel.app/api/graphiql",
|
|
9
|
+
"github": "https://api.github.com/graphql"
|
|
6
10
|
}
|
|
7
11
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letoribo/mcpgql",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "CLI tool for MCP GraphQL Enhanced",
|
|
5
|
+
"repository": "github:letoribo/mcpgql",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mcp",
|
|
8
|
+
"model-context-protocol",
|
|
9
|
+
"graphql",
|
|
10
|
+
"claude-desktop",
|
|
11
|
+
"cli",
|
|
12
|
+
"federated-graphql"
|
|
13
|
+
],
|
|
5
14
|
"main": "index.js",
|
|
6
15
|
"bin": {
|
|
7
16
|
"mcpgql": "index.js"
|
|
@@ -9,7 +18,8 @@
|
|
|
9
18
|
"files": [
|
|
10
19
|
"index.js",
|
|
11
20
|
"core.ts",
|
|
12
|
-
"mcpgql.config.json"
|
|
21
|
+
"mcpgql.config.json",
|
|
22
|
+
"README.md"
|
|
13
23
|
],
|
|
14
24
|
"scripts": {
|
|
15
25
|
"test": "echo \"Error: no test specified\" && exit 1"
|