Skip to content

Commit 8e85d38

Browse files
committed
feat: allow for custom server name
See issue #4, should've allowed this from the start
1 parent fe4b53d commit 8e85d38

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const handler = await createGraphQLHandler(config);
1414

1515
const server = new Server(
1616
{
17-
name: "mcp-graphql",
17+
name: config.name,
1818
version: getVersion(),
19-
description: `GraphQL client for ${config.endpoint}`,
19+
description: `GraphQL server for ${config.endpoint}`,
2020
},
2121
{
2222
capabilities: {

src/lib/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { hideBin } from "yargs/helpers";
33
import { z } from "zod";
44

55
export const configSchema = z.object({
6+
name: z.string().default("mcp-graphql"),
67
// Endpoint for the schema to be introspected and transformed into tools
78
endpoint: z.string().url(),
89
// File path alternative to endpoint, will read the file instead of fetching the endpoint
@@ -21,6 +22,11 @@ export type Config = z.infer<typeof configSchema>;
2122

2223
export function parseArgumentsToConfig(): Config {
2324
const argv = yargs(hideBin(process.argv))
25+
.option("name", {
26+
type: "string",
27+
description:
28+
"Name of the MCP server, can be used if you want to override the default name",
29+
})
2430
.option("endpoint", {
2531
type: "string",
2632
description:

0 commit comments

Comments
 (0)