Skip to content

Commit d741b08

Browse files
authored
Merge pull request #199 from kagent-dev/docs-remote-mcp
Remote mcp server capability
2 parents 4f12ca1 + 30e18ce commit d741b08

File tree

2 files changed

+128
-38
lines changed

2 files changed

+128
-38
lines changed

src/app/docs/kmcp/deploy/server/page.mdx

Lines changed: 119 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ pageOrder: 20
44
description:
55
---
66

7+
import { Tabs, Tab } from '@/components/mdx/tabs';
8+
79
export const metadata = {
810
title: "Deploy MCP servers",
911
description: "Deploy MCP servers using kmcp",
@@ -21,59 +23,137 @@ Use the kmcp controller to automatically spin up your MCP server in a Kubernetes
2123

2224
## Deploy the MCP server
2325

24-
1. Build a Docker image for your MCP server and load it to your kind cluster. The following command assumes that your kind cluster is named `kind`.
25-
```sh
26-
kmcp build --project-dir my-mcp-server -t my-mcp-server:latest --kind-load-cluster kind
27-
```
26+
Learn how you can deploy an MCP server in a Kubernetes cluster. Choose between the following options:
2827

29-
2. Deploy your MCP server. Choose between the following options:
30-
31-
* **Option 1: Use the kmcp deploy command**
32-
33-
The `kmcp deploy` command automatically creates an MCPServer resource in your cluster that contains the MCP server configuration that is defined in the `kmcp.yaml` file in your MCP project. The kmcp controller then uses this resource to spin up and manage the lifecycle of your MCP server. After the MCP server is deployed, the command automatically starts the MCP inspector tool so that you can test your server.
34-
35-
**Tip**: If you do not want to start the MCP inspector tool, add the `--no-inspector` flag to the command.
36-
28+
* [Option 1: Deploy an MCP server with `npx` or `uvx`](#option-1-deploy-an-mcp-server-with-npx-or-uvx): Use an existing npm package to spin up an MCP server instance with `npx` or `uvx`.
29+
* [Option 2: Build and deploy an MCP server](#option-2-build-and-deploy-an-mcp-server): Build a Docker image for your MCP server project. Then, load this image to your Kubernetes cluster and deploy an MCP server from it.
30+
31+
32+
### Option 1: Deploy an MCP server with `npx` or `uvx`
33+
34+
Deploy an instance of the [`server-everything`](https://github.com/modelcontextprotocol/servers/tree/main/src/everything) MCP server by using the `npx` or `uvx` command. This server provides simple tools, such as an echo tool, that you can use for testing.
35+
Choose between using the kmcp CLI or creating the MCPServer resource yourself.
36+
37+
<Tabs tabs={[
38+
{ id: 'cli2', label: 'kmcp CLI' },
39+
{ id: 'mcpserver2', label: 'MCPServer resource' }
40+
]} />
41+
42+
<div id="cli2-tab">
43+
44+
1. Deploy the MCP server.
3745
```sh
38-
kmcp deploy --file my-mcp-server/kmcp.yaml --image my-mcp-server:latest
46+
kmcp deploy package --deployment-name my-mcp-server \
47+
--manager npx --args @modelcontextprotocol/server-everything
48+
```
49+
2. Verify that the MCP server is up and running.
50+
```sh
51+
kubectl get pods
3952
```
4053

41-
* **Option 2: Create an MCPServer resource**
42-
43-
You can manually create an MCPServer resource yourself as shown in the following examples.
44-
45-
* FastMCP example
54+
Example output:
55+
```sh
56+
NAME READY STATUS RESTARTS AGE
57+
my-mcp-server-669bcb5d6f-zv5dn 1/1 Running 0 27h
58+
```
59+
</div>
60+
<div id="mcpserver2-tab">
61+
1. Create the MCPServer resource.
4662
```yaml
47-
kubectl apply -f- <<EOF
48-
apiVersion: kagent.dev/v1alpha2
63+
kubectl apply -f- <<EOF
64+
apiVersion: kagent.dev/v1alpha1
4965
kind: MCPServer
5066
metadata:
5167
name: my-mcp-server
68+
namespace: default
5269
spec:
5370
deployment:
54-
image: "my-mcp-server:latest"
71+
args:
72+
- '@modelcontextprotocol/server-everything'
73+
cmd: npx
5574
port: 3000
56-
cmd: "python"
57-
args: ["src/main.py"]
58-
transportType: "stdio"
75+
stdioTransport: {}
76+
transportType: stdio
5977
EOF
6078
```
79+
80+
2. Verify that the MCP server is up and running.
81+
```sh
82+
kubectl get pods
83+
```
6184

62-
* MCP Go example:
63-
```yaml
64-
kubectl apply -f- <<EOF
65-
apiVersion: kagent.dev/v1alpha2
66-
kind: MCPServer
67-
metadata:
68-
name: my-mcp-server
69-
spec:
70-
deployment:
71-
image: "my-mcp-server:latest"
72-
port: 3000
73-
cmd: "./server"
74-
transportType: "stdio"
75-
EOF
85+
Example output:
86+
```sh
87+
NAME READY STATUS RESTARTS AGE
88+
my-mcp-server-669bcb5d6f-zv5dn 1/1 Running 0 27h
7689
```
90+
</div>
91+
92+
### Option 2: Build and deploy an MCP server
93+
94+
Learn how to use the kmcp CLI to build an image for your MCP server and to deploy the server to your Kubernetes cluster.
95+
The following example assumes that you created a [FastMCP](/docs/kmcp/develop/fastmcp-python) or [MCP Go](/docs/kmcp/develop/mcp-go) project with a sample MCP server and tool, and that your kind cluster is named `kind`.
96+
97+
1. Build a Docker image for your MCP server and load it to your kind cluster.
98+
```sh
99+
kmcp build --project-dir my-mcp-server -t my-mcp-server:latest --kind-load-cluster kind
100+
```
101+
102+
2. Deploy your MCP server. Choose between the kmcp CLI or manually creating an MCPServer resource.
103+
104+
<Tabs tabs={[
105+
{ id: 'cli', label: 'kmcp CLI' },
106+
{ id: 'mcpserver', label: 'MCPServer resource' }
107+
]} />
108+
109+
<div id="cli-tab">
110+
111+
The `kmcp deploy` command automatically creates an MCPServer resource in your cluster that contains the MCP server configuration that is defined in the `kmcp.yaml` file in your MCP project. The kmcp controller then uses this resource to spin up and manage the lifecycle of your MCP server. After the MCP server is deployed, the command automatically starts the MCP inspector tool so that you can test your server.
112+
113+
**Tip**: If you do not want to start the MCP inspector tool, add the `--no-inspector` flag to the command.
114+
115+
```sh
116+
kmcp deploy --file my-mcp-server/kmcp.yaml --image my-mcp-server:latest
117+
```
118+
119+
</div>
120+
<div id="mcpserver-tab">
121+
122+
You can manually create an MCPServer resource yourself as shown in the following examples.
123+
124+
* FastMCP example
125+
```yaml
126+
kubectl apply -f- <<EOF
127+
apiVersion: kagent.dev/v1alpha1
128+
kind: MCPServer
129+
metadata:
130+
name: my-mcp-server
131+
spec:
132+
deployment:
133+
image: "my-mcp-server:latest"
134+
port: 3000
135+
cmd: "python"
136+
args: ["src/main.py"]
137+
transportType: "stdio"
138+
EOF
139+
```
140+
141+
* MCP Go example:
142+
```yaml
143+
kubectl apply -f- <<EOF
144+
apiVersion: kagent.dev/v1alpha1
145+
kind: MCPServer
146+
metadata:
147+
name: my-mcp-server
148+
spec:
149+
deployment:
150+
image: "my-mcp-server:latest"
151+
port: 3000
152+
cmd: "./server"
153+
transportType: "stdio"
154+
EOF
155+
```
156+
</div>
77157

78158
3. Verify that the MCP server is up and running.
79159
```sh
@@ -86,6 +166,7 @@ Use the kmcp controller to automatically spin up your MCP server in a Kubernetes
86166
my-mcp-server-669bcb5d6f-zv5dn 1/1 Running 0 27h
87167
```
88168

169+
89170
## Test access to the MCP server
90171

91172
1. Run the MCP inspector tool. Note that if you used the `kmcp deploy` command to spin up your MCP server, the MCP inspector tool is already running. You can skip to the next step.

src/app/docs/kmcp/reference/kmcp-deploy/page.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ Deploy an MCP server to Kubernetes by generating the MCPServer CRDs. The command
1212
kmcp deploy [name] [flags]
1313
```
1414

15+
**Subcommands**:
16+
17+
* `package [flags]` - Deploys an MCP server instance from an existing npm package.
18+
19+
**Package flags**:
20+
- `--args` - Arguments to pass to the package manager, such as package names (required)
21+
- `--deployment-name` - Name of the MCP server deployment
22+
- `--manager` - Package manager to use (`npx` or `uvx`) (required)
23+
1524
**Flags:**
1625
- `--args` - Command arguments
1726
- `--command` - Command to run (overrides project config)

0 commit comments

Comments
 (0)