@graphql-hive/plugin-mcp 0.1.0-rc-4c5cf489d3b874b0239a4b8e856a16691cb7acc4 → 0.1.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/CHANGELOG.md +0 -55
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,60 +1,5 @@
|
|
|
1
1
|
# @graphql-hive/plugin-mcp
|
|
2
2
|
|
|
3
|
-
## 0.1.0-rc-4c5cf489d3b874b0239a4b8e856a16691cb7acc4
|
|
4
|
-
### Minor Changes
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- [#1932](https://github.com/graphql-hive/gateway/pull/1932) [`9177415`](https://github.com/graphql-hive/gateway/commit/9177415b347d055450f4fdc7acae6b32f7c71539) Thanks [@adambenhassen](https://github.com/adambenhassen)! - New plugin that lets AI agents interact with your GraphQL API through [MCP](https://modelcontextprotocol.io/) (Model Context Protocol). Each GraphQL operation becomes a tool that agents can discover and call.
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
npm i @graphql-hive/plugin-mcp
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
```ts
|
|
15
|
-
import { defineConfig } from '@graphql-hive/gateway';
|
|
16
|
-
import { type MCPConfig, useMCP } from '@graphql-hive/plugin-mcp';
|
|
17
|
-
|
|
18
|
-
const mcp: MCPConfig = {
|
|
19
|
-
name: 'my-api',
|
|
20
|
-
path: '/mcp',
|
|
21
|
-
tools: [
|
|
22
|
-
{
|
|
23
|
-
name: 'get_user',
|
|
24
|
-
source: {
|
|
25
|
-
type: 'inline',
|
|
26
|
-
query: 'query GetUser($id: ID!) { user(id: $id) { name email } }',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const gatewayConfig = defineConfig({
|
|
33
|
-
plugins: (ctx) => [useMCP(ctx, mcp)],
|
|
34
|
-
});
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Then start the gateway as usual. The MCP endpoint is available at `/mcp`.
|
|
38
|
-
|
|
39
|
-
Tools can also be auto-registered from `.graphql` files using `@mcpTool` directives:
|
|
40
|
-
|
|
41
|
-
```graphql
|
|
42
|
-
query GetWeather($location: String!) @mcpTool(name: "get_weather", description: "Current weather") {
|
|
43
|
-
weather(location: $location) { temperature conditions }
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
**Features:**
|
|
48
|
-
|
|
49
|
-
- **Tool sources** - inline queries, named operations from files, `@mcpTool` directives, or a user-provided `loader` for fetching operations from any external source (CDN, object store, persisted-documents service)
|
|
50
|
-
- **Description providers** - dynamic tool/field descriptions via Langfuse or custom providers
|
|
51
|
-
- **Input transforms** - field aliases, defaults, hidden fields, `@mcpHeader` for injecting from HTTP headers
|
|
52
|
-
- **Output transforms** - `output.path` to extract nested data, `outputSchema` control
|
|
53
|
-
- **Hooks** - `preprocess` (validation gates, arg injection) and `postprocess` (format results)
|
|
54
|
-
- **Resources** - static docs (inline text or file) and parameterized resource templates with dynamic URI patterns
|
|
55
|
-
|
|
56
|
-
See the [README](https://github.com/graphql-hive/gateway/blob/main/packages/plugins/mcp/README.md) for full documentation, and [`examples/`](https://github.com/graphql-hive/gateway/tree/main/packages/plugins/mcp/examples) for runnable demos.
|
|
57
|
-
|
|
58
3
|
## 0.1.0
|
|
59
4
|
### Minor Changes
|
|
60
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-hive/plugin-mcp",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"tslib": "^2.8.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@graphql-hive/gateway-runtime": "2.8.9
|
|
59
|
+
"@graphql-hive/gateway-runtime": "2.8.9",
|
|
60
60
|
"@langfuse/client": "^5.0.2",
|
|
61
61
|
"@opentelemetry/api": "^1.9.0",
|
|
62
62
|
"graphql": "^16.13.2",
|