@letoribo/mcp-graphql-enhanced 2.1.2 → 2.1.5
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 +53 -49
- package/mcp-manifest.json +36 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
# mcp-graphql-enhanced
|
|
2
|
-
|
|
3
2
|
[](https://smithery.ai/server/@letoribo/mcp-graphql-enhanced)
|
|
4
3
|
[](https://glama.ai/mcp/servers/@letoribo/mcp-graphql-enhanced)
|
|
5
4
|
An **enhanced MCP (Model Context Protocol) server for GraphQL** that fixes real-world interoperability issues between LLMs and GraphQL APIs.
|
|
6
|
-
|
|
7
5
|
> Drop-in replacement for `mcp-graphql` — with dynamic headers, robust variables parsing, and zero breaking changes.
|
|
8
|
-
|
|
9
6
|
## ✨ Key Enhancements
|
|
10
|
-
|
|
11
7
|
- ✅ **Dynamic headers** — pass `Authorization`, `X-API-Key`, etc., via tool arguments (no config restarts)
|
|
12
8
|
- ✅ **Robust variables parsing** — fixes `“Query variables must be a null or an object”` error
|
|
13
9
|
- ✅ **Filtered introspection** — request only specific types (e.g., `typeNames: ["Query", "User"]`) to reduce LLM context noise
|
|
14
10
|
- ✅ **Full MCP compatibility** — works with **Claude Desktop**, **Cursor**, **Glama**, and **Smithery**
|
|
15
11
|
- ✅ **Secure by default** — mutations disabled unless explicitly enabled
|
|
16
|
-
|
|
17
12
|
## 🔍 Filtered Introspection (New!)
|
|
18
|
-
|
|
19
13
|
Avoid 50k-line schema dumps. Ask for only what you need:
|
|
20
|
-
|
|
21
|
-
@introspect-schema typeNames ["Query", "User"]
|
|
22
|
-
|
|
14
|
+
```@introspect-schema typeNames ["Query", "User"]```
|
|
23
15
|
## 🔍 Debug & Inspect
|
|
24
|
-
|
|
25
16
|
Use the official MCP Inspector to test your server live:
|
|
26
|
-
|
|
27
17
|
```bash
|
|
28
18
|
npx @modelcontextprotocol/inspector \
|
|
29
19
|
-e ENDPOINT=https://api.example.com/graphql \
|
|
30
20
|
npx @letoribo/mcp-graphql-enhanced --debug
|
|
31
21
|
```
|
|
32
|
-
|
|
33
22
|
### Environment Variables (Breaking change in 1.0.0)
|
|
34
|
-
|
|
35
23
|
> **Note:** As of version 1.0.0, command line arguments have been replaced with environment variables.
|
|
36
24
|
|
|
37
25
|
| Environment Variable | Description | Default |
|
|
@@ -41,73 +29,89 @@ npx @modelcontextprotocol/inspector \
|
|
|
41
29
|
| `ALLOW_MUTATIONS` | Enable mutation operations (disabled by default) | `false` |
|
|
42
30
|
| `NAME` | Name of the MCP server | `mcp-graphql-enhanced` |
|
|
43
31
|
| `SCHEMA` | Path to a local GraphQL schema file or URL (optional) | - |
|
|
44
|
-
|
|
45
32
|
### Examples
|
|
46
|
-
|
|
47
33
|
```bash
|
|
48
34
|
# Basic usage
|
|
49
35
|
ENDPOINT=http://localhost:3000/graphql npx @letoribo/mcp-graphql-enhanced
|
|
50
|
-
|
|
51
36
|
# With auth header
|
|
52
37
|
ENDPOINT=https://api.example.com/graphql \
|
|
53
38
|
HEADERS='{"Authorization":"Bearer xyz"}' \
|
|
54
39
|
npx @letoribo/mcp-graphql-enhanced
|
|
55
|
-
|
|
56
40
|
# Enable mutations
|
|
57
41
|
ENDPOINT=http://localhost:3000/graphql \
|
|
58
42
|
ALLOW_MUTATIONS=true \
|
|
59
43
|
npx @letoribo/mcp-graphql-enhanced
|
|
60
|
-
|
|
61
44
|
# Use local schema file
|
|
62
45
|
ENDPOINT=http://localhost:3000/graphql \
|
|
63
46
|
SCHEMA=./schema.graphql \
|
|
64
47
|
npx @letoribo/mcp-graphql-enhanced
|
|
65
48
|
```
|
|
66
|
-
|
|
49
|
+
### 🖥️ Claude Desktop Configuration Examples
|
|
50
|
+
You can connect Claude Desktop to your GraphQL API using either the npx package (recommended for simplicity) or the Docker image (ideal for reproducibility and isolation).
|
|
51
|
+
### ✅ Option 1: Using npx
|
|
52
|
+
```bash
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"mcp-graphql-enhanced": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["@letoribo/mcp-graphql-enhanced"],
|
|
58
|
+
"env": {
|
|
59
|
+
"ENDPOINT": "https://your-api.com/graphql"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
### 🐳 Option 2: Using Docker (auto-pull supported)
|
|
66
|
+
```bash
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"mcp-graphql-enhanced": {
|
|
70
|
+
"command": "sh",
|
|
71
|
+
"args": [
|
|
72
|
+
"-c",
|
|
73
|
+
"docker run --rm -i -e ENDPOINT=$ENDPOINT -e HEADERS=$HEADERS -e ALLOW_MUTATIONS=$ALLOW_MUTATIONS ghcr.io/letoribo/mcp-graphql-enhanced:main"
|
|
74
|
+
],
|
|
75
|
+
"env": {
|
|
76
|
+
"ENDPOINT": "https://your-api.com/graphql",
|
|
77
|
+
"HEADERS": "{\"Authorization\": \"Bearer YOUR_TOKEN\"}",
|
|
78
|
+
"ALLOW_MUTATIONS": "false"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
### 🧪 Option 3: Using node with local build (for development)
|
|
85
|
+
If you’ve cloned the repo and built the project (npm run build → outputs to dist/):
|
|
86
|
+
```bash
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"mcp-graphql-enhanced": {
|
|
90
|
+
"command": "node",
|
|
91
|
+
"args": ["dist/index.js"],
|
|
92
|
+
"env": {
|
|
93
|
+
"ENDPOINT": "https://your-api.com/graphql",
|
|
94
|
+
"ALLOW_MUTATIONS": "true"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
67
100
|
## Resources
|
|
68
|
-
|
|
69
101
|
- **graphql-schema**: The server exposes the GraphQL schema as a resource that clients can access. This is either the local schema file, a schema file hosted at a URL, or based on an introspection query.
|
|
70
|
-
|
|
71
102
|
## Available Tools
|
|
72
|
-
|
|
73
103
|
The server provides two main tools:
|
|
74
|
-
|
|
75
104
|
1. **introspect-schema**: This tool retrieves the GraphQL schema or a filtered subset (via typeNames). Use this first if you don't have access to the schema as a resource.
|
|
76
105
|
This uses either the local schema file, a schema file hosted at a URL, or an introspection query.
|
|
77
106
|
Filtered introspection (typeNames) is only available when using a live GraphQL endpoint (not with SCHEMA file or URL).
|
|
78
|
-
|
|
79
107
|
2. **query-graphql**: Execute GraphQL queries against the endpoint. By default, mutations are disabled unless `ALLOW_MUTATIONS` is set to `true`.
|
|
80
|
-
|
|
81
108
|
## Installation
|
|
82
|
-
|
|
83
|
-
### Installing via Smithery
|
|
84
|
-
|
|
109
|
+
#### Installing via Smithery
|
|
85
110
|
To install GraphQL MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@letoribo/mcp-graphql-enhanced):
|
|
86
|
-
|
|
87
111
|
```bash
|
|
88
112
|
npx -y @smithery/cli install @letoribo/mcp-graphql-enhanced --client claude
|
|
89
113
|
```
|
|
90
|
-
|
|
91
|
-
### Installing Manually
|
|
92
|
-
|
|
93
|
-
It can be manually installed to Claude:
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"mcpServers": {
|
|
97
|
-
"mcp-graphql": {
|
|
98
|
-
"command": "npx",
|
|
99
|
-
"args": ["@letoribo/mcp-graphql-enhanced"],
|
|
100
|
-
"env": {
|
|
101
|
-
"ENDPOINT": "https://your-api.com/graphql"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
114
|
## Security Considerations
|
|
109
|
-
|
|
110
115
|
Mutations are disabled by default to prevent unintended data changes. Always validate HEADERS and SCHEMA inputs in production. Use HTTPS endpoints and short-lived tokens where possible.
|
|
111
116
|
## Customize for your own server
|
|
112
|
-
|
|
113
117
|
This is a very generic implementation where it allows for complete introspection and for your users to do whatever (including mutations). If you need a more specific implementation I'd suggest to just create your own MCP and lock down tool calling for clients to only input specific query fields and/or variables. You can use this as a reference.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@letoribo/mcp-graphql-enhanced",
|
|
3
|
+
"version": "2.1.3",
|
|
4
|
+
"description": "Enhanced MCP server for GraphQL with filtered introspection and full variable support.",
|
|
5
|
+
"transport": "stdio",
|
|
6
|
+
"tools": [
|
|
7
|
+
{
|
|
8
|
+
"name": "introspect-schema",
|
|
9
|
+
"description": "Fetch filtered GraphQL schema by type names"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "query-graphql",
|
|
13
|
+
"description": "Execute GraphQL queries with variables and headers"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"resources": [
|
|
17
|
+
{
|
|
18
|
+
"name": "graphql-schema",
|
|
19
|
+
"description": "GraphQL schema as a resource"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"configSchema": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": ["ENDPOINT"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"ENDPOINT": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "GraphQL endpoint URL"
|
|
29
|
+
},
|
|
30
|
+
"HEADERS": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "JSON string of headers"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -16,10 +16,13 @@
|
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
18
|
"bin": {
|
|
19
|
-
"mcp-graphql-enhanced": "
|
|
19
|
+
"mcp-graphql-enhanced": "dist/index.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
22
|
+
"dist",
|
|
23
|
+
"mcp-manifest.json",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md"
|
|
23
26
|
],
|
|
24
27
|
"engines": {
|
|
25
28
|
"node": ">=18"
|
|
@@ -46,5 +49,5 @@
|
|
|
46
49
|
"ts-node": "^10.9.2",
|
|
47
50
|
"typescript": "5.8.3"
|
|
48
51
|
},
|
|
49
|
-
"version": "2.1.
|
|
52
|
+
"version": "2.1.5"
|
|
50
53
|
}
|