Skip to content

Commit 25cc5af

Browse files
authored
docs: update ToolHive instructions in README (#129)
Signed-off-by: Dan Barr <[email protected]> Co-authored-by: Dan Barr <[email protected]>
1 parent 4d42d03 commit 25cc5af

File tree

1 file changed

+34
-102
lines changed

1 file changed

+34
-102
lines changed

README.md

Lines changed: 34 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ To run the server on a specific port:
110110
MCP_PORT=9091 task run
111111
```
112112

113+
## Running with ToolHive
114+
115+
MKP can be run as a Model Context Protocol (MCP) server using
116+
[ToolHive](https://github.com/stacklok/toolhive), which simplifies the
117+
deployment and management of MCP servers.
118+
119+
See the
120+
[ToolHive documentation](https://docs.stacklok.com/toolhive/guides-mcp/k8s) for
121+
detailed instructions on how to set up MKP with the ToolHive UI, CLI, or
122+
Kubernetes operator.
123+
113124
### MCP Tools
114125

115126
The MKP server provides the following MCP tools:
@@ -200,13 +211,18 @@ Parameters:
200211
- `resource` (required): Resource name (e.g., deployments, services)
201212
- `namespace`: Namespace (required for namespaced resources)
202213
- `label_selector`: Kubernetes label selector for filtering resources (optional)
203-
- `include_annotations`: Whether to include annotations in the output (default: true)
204-
- `exclude_annotation_keys`: List of annotation keys to exclude from output (supports wildcards with *)
205-
- `include_annotation_keys`: List of annotation keys to include in output (if specified, only these are included)
214+
- `include_annotations`: Whether to include annotations in the output (default:
215+
true)
216+
- `exclude_annotation_keys`: List of annotation keys to exclude from output
217+
(supports wildcards with \*)
218+
- `include_annotation_keys`: List of annotation keys to include in output (if
219+
specified, only these are included)
206220

207221
##### Annotation Filtering
208222

209-
The `list_resources` tool provides powerful annotation filtering capabilities to control metadata output size and prevent truncation issues with large annotations (such as GPU node annotations).
223+
The `list_resources` tool provides powerful annotation filtering capabilities to
224+
control metadata output size and prevent truncation issues with large
225+
annotations (such as GPU node annotations).
210226

211227
**Basic Usage:**
212228

@@ -275,11 +291,16 @@ The `list_resources` tool provides powerful annotation filtering capabilities to
275291

276292
**Annotation Filtering Rules:**
277293

278-
- By default, `kubectl.kubernetes.io/last-applied-configuration` is excluded to prevent large configuration data
279-
- `exclude_annotation_keys` supports wildcard patterns using `*` (e.g., `nvidia.com/*` excludes all NVIDIA annotations)
280-
- When `include_annotation_keys` is specified, it takes precedence and only those annotations are included
281-
- Setting `include_annotations: false` completely removes all annotations from the output
282-
- Wildcard patterns only support `*` at the end of the key (e.g., `nvidia.com/*`)
294+
- By default, `kubectl.kubernetes.io/last-applied-configuration` is excluded to
295+
prevent large configuration data
296+
- `exclude_annotation_keys` supports wildcard patterns using `*` (e.g.,
297+
`nvidia.com/*` excludes all NVIDIA annotations)
298+
- When `include_annotation_keys` is specified, it takes precedence and only
299+
those annotations are included
300+
- Setting `include_annotations: false` completely removes all annotations from
301+
the output
302+
- Wildcard patterns only support `*` at the end of the key (e.g.,
303+
`nvidia.com/*`)
283304

284305
#### apply_resource
285306

@@ -440,7 +461,8 @@ MKP supports two transport protocols for the MCP server:
440461
- **Streamable HTTP**: The default transport protocol, suitable for most use cases
441462
- **SSE (Server-Sent Events)**: Legacy transport protocol, primarily for compatibility with older clients
442463

443-
You can configure the transport protocol using either a CLI flag or an environment variable:
464+
You can configure the transport protocol using either a CLI flag or an
465+
environment variable:
444466

445467
```bash
446468
# Using CLI flag
@@ -453,7 +475,8 @@ MCP_TRANSPORT=sse ./build/mkp-server
453475
./build/mkp-server
454476
```
455477

456-
The `MCP_TRANSPORT` environment variable is automatically set by ToolHive when running MKP in that environment.
478+
The `MCP_TRANSPORT` environment variable is automatically set by ToolHive when
479+
running MKP in that environment.
457480

458481
#### Controlling Resource Discovery
459482

@@ -539,97 +562,6 @@ task lint
539562
task deps
540563
```
541564

542-
## Running as an MCP Server with ToolHive
543-
544-
MKP can be run as a Model Context Protocol (MCP) server using
545-
[ToolHive](https://github.com/stacklok/toolhive), which simplifies the
546-
deployment and management of MCP servers.
547-
548-
### Prerequisites
549-
550-
1. Install ToolHive by following the
551-
[installation instructions](https://docs.stacklok.com/toolhive/guides-cli/install).
552-
2. Ensure you have Docker or Podman installed on your system.
553-
3. Configure your Kubernetes credentials (kubeconfig) for the cluster you want
554-
to interact with.
555-
556-
### Running MKP with ToolHive (Recommended)
557-
558-
The easiest way to run MKP is using the packaged version available in ToolHive's
559-
registry:
560-
561-
```bash
562-
# Register a supported client so ToolHive can auto-configure your environment
563-
thv client setup
564-
565-
# Run the MKP server (packaged as 'k8s' in ToolHive)
566-
# Mount your kubeconfig so the server can access your Kubernetes cluster
567-
thv run --volume $HOME/.kube:/home/nonroot/.kube:ro k8s
568-
569-
# List running servers
570-
thv list
571-
572-
# Get detailed information about the server
573-
thv registry info k8s
574-
```
575-
576-
This will mount your Kubernetes credentials and make the server available to
577-
your MCP-compatible clients.
578-
579-
### Advanced Usage with Custom Configuration
580-
581-
For advanced users who need custom configuration, you can also run MKP using the
582-
container image directly:
583-
584-
```bash
585-
# Run the MKP server using the published container image
586-
thv run --name mkp --transport sse --target-port 8080 --volume $HOME/.kube:/home/nonroot/.kube:ro ghcr.io/stackloklabs/mkp/server:latest
587-
```
588-
589-
This command:
590-
591-
- Names the server instance "mkp"
592-
- Uses the SSE transport protocol
593-
- Mounts your local kubeconfig into the container (read-only)
594-
- Uses the latest published MKP image from GitHub Container Registry
595-
596-
To use a specific version instead of the latest:
597-
598-
```bash
599-
thv run --name mkp --transport sse --target-port 8080 --volume $HOME/.kube:/home/nonroot/.kube:ro ghcr.io/stackloklabs/mkp/server:v0.0.1
600-
```
601-
602-
### Managing the MKP Server
603-
604-
To verify that the MKP server is running:
605-
606-
```bash
607-
thv list
608-
```
609-
610-
This will show all running MCP servers managed by ToolHive, including the MKP
611-
server.
612-
613-
To stop the MKP server:
614-
615-
```bash
616-
# For packaged version
617-
thv stop k8s
618-
619-
# For custom named version
620-
thv stop mkp
621-
```
622-
623-
To remove the server instance completely:
624-
625-
```bash
626-
# For packaged version
627-
thv rm k8s
628-
629-
# For custom named version
630-
thv rm mkp
631-
```
632-
633565
## Contributing
634566

635567
We welcome contributions to this MCP server! If you'd like to contribute, please

0 commit comments

Comments
 (0)