Knapcode.SampleMcpServer
mcpotherio.github.joelverhagen/Knapcode.SampleMcpServer · v0.7.0-beta
A sample MCP server using the MCP C# SDK. Generates random numbers and random weather.
run it
on your own machines, one way per deploy methodgenerated from the record, not tested yet
#!/usr/bin/env bash # samplemcpserver (io.github.joelverhagen/Knapcode.SampleMcpServer), recipe baremetal (generated). # Generated by Hub for toolset "my-agent"; started by mcp-my-agent-samplemcpserver.service. set -euo pipefail export HOST=127.0.0.1 PORT=8101 exec uvx mcp-proxy --host 127.0.0.1 --port 8101 --pass-environment -- dnx [email protected] --yes [Unit] Description=MCP server samplemcpserver (toolset my-agent), generated by Hub After=network-online.target Wants=network-online.target [Service] Type=simple User=mcp Group=mcp EnvironmentFile=/etc/mcp/my-agent.env Environment=HOME=/var/lib/mcp/samplemcpserver WorkingDirectory=/var/lib/mcp/samplemcpserver ExecStart=/opt/mcp/my-agent/bin/samplemcpserver.sh Restart=on-failure RestartSec=5 NoNewPrivileges=true ProtectSystem=strict ProtectHome=true PrivateTmp=true ReadWritePaths=/var/lib/mcp/samplemcpserver [Install] WantedBy=multi-user.target
connect to it
copy what your client needsdnx [email protected] --yes # env: WEATHER_CHOICES
{
"mcpServers": {
"samplemcpserver": {
"command": "dnx",
"args": [
"[email protected]",
"--yes"
],
"env": {
"WEATHER_CHOICES": "${WEATHER_CHOICES}"
}
}
}
}
#!/usr/bin/env bash
# Registers every server with Claude Code (run once; `claude mcp list` to check).
set -euo pipefail
set -a; [ -f .env ] && source .env; set +a
claude mcp add samplemcpserver -e "WEATHER_CHOICES=${WEATHER_CHOICES}" -- dnx [email protected] --yes
{
"mcpServers": {
"samplemcpserver": {
"command": "dnx",
"args": [
"[email protected]",
"--yes"
],
"env": {
"WEATHER_CHOICES": "${WEATHER_CHOICES}"
}
}
}
}
{
"servers": {
"samplemcpserver": {
"type": "stdio",
"command": "dnx",
"args": [
"[email protected]",
"--yes"
],
"env": {
"WEATHER_CHOICES": "${WEATHER_CHOICES}"
}
}
}
}
name: my-agent target: local servers: - hub: io.github.joelverhagen/Knapcode.SampleMcpServer
- not probed yet: tools unpinned, ingest lists them
tools
Not probed yetThe tools appear once the hub or its worker has listed this entry. Running it still works: your client lists them on first start.