|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// *mcp_gateway_config/mcp-gateway-register-ext-mcp-servers.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="proc-register-ext-mcp-server-mcpserverregistration_{context}"] |
| 7 | += Creating an MCPServerRegistration for an external MCP server |
| 8 | + |
| 9 | +[role="_abstract"] |
| 10 | +To use an external MCP server, you must create an `MCPServerRegistration` custom resource (CR) that registers your external MCP server with the MCP gateway. |
| 11 | + |
| 12 | +.Prerequisites |
| 13 | + |
| 14 | +* You completed all of the installation and configuration steps for {mcpg}. |
| 15 | +* You have the information for the external MCP server you want to connect to. |
| 16 | +* You installed the {oc-first}. |
| 17 | +* You are using Istio for ingress control. |
| 18 | +* You created `ServiceEntry`, `DestinationRule`, `HTTPRoute`, and `Secret` objects. |
| 19 | +* Recommended: You created an `AuthPolicy` CR. |
| 20 | +
|
| 21 | +.Procedure |
| 22 | + |
| 23 | +. Create a `MCPServerRegistration` CR that registers the external MCP server with the MCP gateway by using the following example: |
| 24 | ++ |
| 25 | +.Example MCPServerRegistration CR |
| 26 | +[source,yaml,subs="+quotes"] |
| 27 | +---- |
| 28 | +apiVersion: mcp.kuadrant.io/v1alpha1 |
| 29 | +kind: MCPServerRegistration |
| 30 | +metadata: |
| 31 | + name: _<external_mcp_server>_ |
| 32 | + namespace: _<mcp_test>_ |
| 33 | +spec: |
| 34 | + toolPrefix: _<"extserver_">_ |
| 35 | + targetRef: |
| 36 | + group: "gateway.networking.k8s.io" |
| 37 | + kind: "HTTPRoute" |
| 38 | + name: "_<mcp_api_key_server_route>_" |
| 39 | + namespace: "_<mcp_test>_" |
| 40 | + credentialRef: |
| 41 | + name: _<mcp_backend_secret>_ |
| 42 | + key: api-key |
| 43 | +---- |
| 44 | ++ |
| 45 | +* Replace the `metadata.name:` field value with the name you want to use. |
| 46 | +* Replace the `metadata.namespace:` field value with the namespace you need to use. If you did not use a `ReferenceGrant` CR, the value of `metadata.namespace:` must be the same as the namepsace specified in the `HTTPRoute` object. |
| 47 | +* Replace the `spec.toolPrefix:` field with the value that you want to use to prefix the tools available with this MCP server. |
| 48 | +* Replace the `spec.targetRef.name:` field value with the name of the `HTTPRoute` CR you applied. |
| 49 | +* Replace the value of `spec.targetRef.namespace:` with the namespace where your `HTTPRoute` CR is applied. |
| 50 | +* The `spec.credentialRef:` field points to the `Secret` CR that has credentials for the external MCP server. |
| 51 | +
|
| 52 | +. Apply the CR by running the following command: |
| 53 | ++ |
| 54 | +[source,terminal,subs="+quotes"] |
| 55 | +---- |
| 56 | +$ oc apply -f _<mcp_external_server_mcpsr.yaml>_ |
| 57 | +---- |
| 58 | ++ |
| 59 | +Replace `_<mcp_external_server_mcpsr.yaml>_` with the name of your CR. |
0 commit comments