Skip to content

Commit 3183d93

Browse files
authored
Merge pull request #139 from apollographql/gt-234-add-custom-scalars-config-docs
docs:Adding a section for custom scalars config file
2 parents d360a35 + daf140f commit 3183d93

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

docs/source/command-reference.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ apollo-mcp-server [OPTIONS] --directory <DIRECTORY>
9292
|:------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
9393
| `-d, --directory <DIRECTORY>` | The working directory to use. Defaults the current working directory. |
9494
| `-s, --schema <SCHEMA>` | The path to the GraphQL API schema file. |
95-
| `-c, --custom-scalars-config <CUSTOM_SCALARS_CONFIG>` | The path to the GraphQL custom_scalars_config file. |
95+
| `-c, --custom-scalars-config <CUSTOM_SCALARS_CONFIG>` | The path to the GraphQL custom_scalars_config file. [Learn more](/apollo-mcp-server/guides/#custom-scalars-configuration). |
9696
| `-e, --endpoint <ENDPOINT>` | The GraphQL endpoint the server will invoke.<br />[default: `http://127.0.0.1:4000`] |
9797
| `--header <HEADERS>` | Headers to send to the endpoint. |
9898
| `--sse-port <SSE_PORT>` | Start the server using the SSE transport on the given port (default: 5000). |
@@ -101,7 +101,7 @@ apollo-mcp-server [OPTIONS] --directory <DIRECTORY>
101101
| `--http-address <HTTP_ADDRESS>` | The IP address to bind the Streamable HTTP server to (default: 127.0.0.1). |
102102
| `-i, --introspection` | Expose the schema to the MCP client through `introspect` and `execute` tools. [Learn more](/apollo-mcp-server/guides/#from-schema-introspection). |
103103
| `-u, --uplink` | Enable use of uplink to get the schema and persisted queries (requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`). [Learn more](/apollo-mcp-server/guides/#from-graphos-managed-persisted-queries). |
104-
| `-x, --explorer` | Expose a tool that returns the URL to open a GraphQL operation in Apollo Explorer (requires `APOLLO_GRAPH_REF`). |
104+
| `-x, --explorer` | Expose a tool that returns the URL to open a GraphQL operation in Apollo Explorer (requires `APOLLO_GRAPH_REF`). |
105105
| `-o, --operations [<OPERATIONS>...]` | Operation files to expose as MCP tools. [Learn more](/apollo-mcp-server/guides/#from-operation-files). |
106106
| `--manifest <MANIFEST>` | The path to the persisted query manifest containing operations. |
107107
| `--collection <COLLECTION_ID>` | The ID of an operation collection to use as the source for operations |

docs/source/guides/index.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,22 @@ npx @modelcontextprotocol/inspector
274274
- **URL**: Enter `http://127.0.0.1:5000/mcp`, where the port must match the `--http-port` option
275275

276276
1. Click **Connect** and **List Tools**. You should see the tools for the operations you provided.
277+
278+
## Custom scalars configuration
279+
280+
You can specify a custom scalars configuration JSON file to map a custom scalar to a [JSON schema type](https://json-schema.org/understanding-json-schema/reference/type). The JSON file is an object with custom scalar names as keys and JSON schema types as values:
281+
```json
282+
{
283+
"MyCustomScalar": { "type": "string" }
284+
}
285+
```
286+
Other than JSON schema type, an overriding description can also be provided. In the following example the description provided in the schema, `scalar description`, would get overridden by the description found in the custom scalar configuration file, `override description`:
287+
```graphql
288+
"""scalar description"""
289+
scalar MyCustomScalar
290+
```
291+
```json
292+
{
293+
"MyCustomScalar": { "type": "string", "description": "override description" }
294+
}
295+
```

0 commit comments

Comments
 (0)