Skip to content

Commit bfd27f7

Browse files
committed
docs: improve readme with better information
1 parent 17971b9 commit bfd27f7

File tree

2 files changed

+46
-31
lines changed

2 files changed

+46
-31
lines changed

README.md

+45-30
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,55 @@
22

33
[![smithery badge](https://smithery.ai/badge/mcp-graphql)](https://smithery.ai/server/mcp-graphql)
44

5-
Model Context Protocol server for working with GraphQL servers.
6-
It's a simple implementation using an introspection query to read the schema and one tool to query your server.
7-
8-
For clients that do not support resources it also has an introspection tool call it will recommend to use first.
5+
A Model Context Protocol server that enables LLMs to interact with GraphQL APIs. This implementation provides schema introspection and query execution capabilities, allowing models to discover and use GraphQL APIs dynamically.
96

107
<a href="https://glama.ai/mcp/servers/4zwa4l8utf"><img width="380" height="200" src="https://glama.ai/mcp/servers/4zwa4l8utf/badge" alt="mcp-graphql MCP server" /></a>
118

129
## Usage
13-
Run `mcp-graphql` with the correct endpoint, it will automatically try to introspect your queries. You can optionally add a JSON string containing headers if needed.
10+
11+
Run `mcp-graphql` with the correct endpoint, it will automatically try to introspect your queries.
12+
13+
### Command Line Arguments
14+
15+
| Argument | Description | Default |
16+
|----------|-------------|---------|
17+
| `--endpoint` | GraphQL endpoint URL | `http://localhost:4000/graphql` |
18+
| `--headers` | JSON string containing headers for requests | `{}` |
19+
| `--enable-mutations` | Enable mutation operations (disabled by default) | `false` |
20+
| `--name` | Name of the MCP server | `mcp-graphql` |
21+
| `--schema` | Path to a local GraphQL schema file (optional) | - |
22+
23+
### Examples
1424

1525
```bash
16-
# Example using a local GraphQL server which also publicly outputs the GraphQL schema
17-
mcp-graphql --endpoint http://localhost:3000/graphql --headers '{"X-Custom-Header":"foobar"}'
26+
# Basic usage with a local GraphQL server
27+
npx mcp-graphql --endpoint http://localhost:3000/graphql
28+
29+
# Using with custom headers
30+
npx mcp-graphql --endpoint https://api.example.com/graphql --headers '{"Authorization":"Bearer token123"}'
31+
32+
# Enable mutation operations
33+
npx mcp-graphql --endpoint http://localhost:3000/graphql --enable-mutations
34+
35+
# Using a local schema file instead of introspection
36+
npx mcp-graphql --endpoint http://localhost:3000/graphql --schema ./schema.graphql
1837
```
1938

39+
## Available Tools
40+
41+
The server provides two main tools:
42+
43+
1. **introspect-schema**: This tool retrieves the GraphQL schema. Use this first if you don't have access to the schema as a resource.
44+
This uses either the local schema file or an introspection query.
45+
46+
2. **query-graphql**: Execute GraphQL queries against the endpoint. By default, mutations are disabled unless `--enable-mutations` is specified.
47+
48+
## Resources
49+
50+
- **graphql-schema**: The server exposes the GraphQL schema as a resource that clients can access. This is either the local schema file or based on an introspection query.
51+
52+
## Installation
53+
2054
### Installing via Smithery
2155

2256
To install GraphQL MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-graphql):
@@ -26,6 +60,7 @@ npx -y @smithery/cli install mcp-graphql --client claude
2660
```
2761

2862
### Installing Manually
63+
2964
It can be manually installed to Claude:
3065
```json
3166
{
@@ -38,30 +73,10 @@ It can be manually installed to Claude:
3873
}
3974
```
4075

41-
### Enabling mutations
76+
## Security Considerations
4277

43-
Mutations are disabled by default as to not allow an LLM to mutate your database or service. You can enable them by using `--enable-mutations` as a flag.
78+
Mutations are disabled by default as a security measure to prevent an LLM from modifying your database or service data. Consider carefully before enabling mutations in production environments.
4479

4580
## Customize for your own server
46-
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.
47-
48-
## Development
49-
50-
To install dependencies:
51-
52-
```bash
53-
bun install
54-
```
55-
56-
To run for development:
57-
58-
```bash
59-
bun dev
60-
```
61-
62-
To build:
63-
64-
```bash
65-
bun run build
66-
```
6781

82+
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.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "mcp-graphql",
33
"module": "index.ts",
44
"type": "module",
5-
"version": "0.2.0",
5+
"version": "0.2.1",
66
"repository": "github:blurrah/mcp-graphql",
77
"bin": {
88
"mcp-graphql": "./dist/index.js"

0 commit comments

Comments
 (0)