Skip to content

Add support for Model Context Protocol #8197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
casperOne opened this issue Mar 29, 2025 · 5 comments
Open

Add support for Model Context Protocol #8197

casperOne opened this issue Mar 29, 2025 · 5 comments

Comments

@casperOne
Copy link

casperOne commented Mar 29, 2025

Product

Hot Chocolate

Is your feature request related to a problem?

Model Context Protocol was generated as a standard to connect AI systems to data sources in a dynamic way.

Here is the overall architecture (screen capture from https://modelcontextprotocol.io/introduction):

Image

MCP clients interact with MCP servers through tools, resources and prompts, all of which are dynamically discovered by the clients.

These tools provide additional language/information about the actions that can be taken, parameters, data types on input and output, as well as descriptions for everything.

This allows the LLM to interpret the best tool to call along with the appropriate parameters based on the prompt the LLM has received.

Where does GraphQL/HotChocolate come in?

GraphQL has many of the prerequisites for generating an MCP server:

  • A type system with descriptions for all inputs/outputs
  • Fields on queries and mutations are akin to tools

The solution you'd like

It would be valuable for users of HotChocolate be able to leverage their infrastructure for GraphQL to expose an MCP server.

There are already existing projects which ingest GraphQL schemas and expose them as MCP servers:

https://github.com/hannesj/mcp-graphql-schema
https://github.com/blurrah/mcp-graphql

Additionally, Microsoft has an official MCP server toolkit for C#:

https://github.com/modelcontextprotocol/csharp-sdk

Finally, the specification:

https://spec.modelcontextprotocol.io/specification/2025-03-26/

@michaelstaib
Copy link
Member

I have put this on the next release ... we already had conversations around this with the DAB team.

@mausch
Copy link

mausch commented Apr 19, 2025

https://github.com/hannesj/mcp-graphql-schema
https://github.com/blurrah/mcp-graphql

These seem pretty limited, i.e. they just expose generic tools to invoke/introspect.
I think a better way to do it would be exposing every query/mutation as a separate tool, which should improve discoverability and would be also more precise in the parameter types for example as they could be translated roughly into JSON schema.
A blocklist/allowlist would be useful too.
A generic tool could be written probably but it would be easier to just have this built into HotChocolate (fewer moving parts etc)

@JerryNixon
Copy link

JerryNixon commented Apr 21, 2025

Considering Data API builder (preliminary, of course):

"mcp": {
  "enabled": true,
  "path": "/mcp",
  "cache": { ... },
  "white-list": {
    "http://localhost": {
      "scopes": [ "*", "mcp.read", "mcp.write" ],
      "role-override": "mcp-client"
    }
  },
  "permissions": {
    "anonymous": {
      "allowed-actions": [
        "list-types",
        "get-type",
        "list-query-fields",
        "get-query-field"
      ],
      "mutation-enabled": false,
      "schema-filters": {
        "exclude-types": [ "__InternalType" ],
        "exclude-fields": {
          "User": [ "passwordHash", "ssn" ],
          "Admin": [ "accessToken" ]
        }
      }
    },
    "admin": {
      "allowed-actions": [ "*" ],
      "mutation-enabled": true
    }
  },
  "response": {
    "max-types": 100,
    "max-depth": 10,
    "max-fields-per-type": 50,
    "max-rows-per-type": 1000
  }
}

@michaelstaib
Copy link
Member

@mausch We’re not following the broader ecosystem here—much of it feels like throwing ideas at the wall that will soon be binned. We believe we have a much stronger, more coherent story that fuses GraphQL semantics with the stateful model underlying MCP.

We’ll be sharing more soon, including the first preview bits. The integration will debut in the new Hot Chocolate Fusion gateway and roll out to core Hot Chocolate by August.

@JerryNixon
Copy link

The real question remains around configurable control. It will be important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants