summaryrefslogtreecommitdiff
path: root/scripts/test-claude-mcp-without-builtin-tools.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test-claude-mcp-without-builtin-tools.sh')
-rwxr-xr-xscripts/test-claude-mcp-without-builtin-tools.sh100
1 files changed, 100 insertions, 0 deletions
diff --git a/scripts/test-claude-mcp-without-builtin-tools.sh b/scripts/test-claude-mcp-without-builtin-tools.sh
new file mode 100755
index 0000000..9affc3e
--- /dev/null
+++ b/scripts/test-claude-mcp-without-builtin-tools.sh
@@ -0,0 +1,100 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+tmp="$(mktemp -d)"
+trap 'rm -rf "$tmp"' EXIT
+cd "$tmp"
+
+cat > mcp.json <<'JSON'
+{
+ "mcpServers": {
+ "panto-test": {
+ "command": "node",
+ "args": ["server.js"]
+ }
+ }
+}
+JSON
+
+cat > server.js <<'JS'
+#!/usr/bin/env node
+const readline = require("readline");
+const rl = readline.createInterface({ input: process.stdin });
+
+function send(message) {
+ process.stdout.write(JSON.stringify(message) + "\n");
+}
+
+rl.on("line", (line) => {
+ let message;
+ try {
+ message = JSON.parse(line);
+ } catch {
+ return;
+ }
+
+ if (message.method === "initialize") {
+ send({
+ jsonrpc: "2.0",
+ id: message.id,
+ result: {
+ protocolVersion: "2024-11-05",
+ capabilities: { tools: {} },
+ serverInfo: { name: "panto-test", version: "0.0.1" }
+ }
+ });
+ } else if (message.method === "notifications/initialized") {
+ // No response for notifications.
+ } else if (message.method === "tools/list") {
+ send({
+ jsonrpc: "2.0",
+ id: message.id,
+ result: {
+ tools: [
+ {
+ name: "ping",
+ description: "Return pong-from-mcp",
+ inputSchema: {
+ type: "object",
+ properties: {},
+ additionalProperties: false
+ }
+ }
+ ]
+ }
+ });
+ } else if (message.method === "tools/call") {
+ send({
+ jsonrpc: "2.0",
+ id: message.id,
+ result: {
+ content: [{ type: "text", text: "pong-from-mcp" }]
+ }
+ });
+ } else if (message.id !== undefined) {
+ send({ jsonrpc: "2.0", id: message.id, result: {} });
+ }
+});
+JS
+chmod +x server.js
+
+cat >&2 <<'EOF'
+Starting Claude with built-in tools disabled and one MCP tool enabled.
+
+Manual test prompt:
+ call the ping MCP tool
+
+Expected useful result:
+ pong-from-mcp
+
+If Claude says no tools are available, --tools "" also disables MCP tools.
+EOF
+
+unset ANTHROPIC_API_KEY
+exec claude \
+ --tools "" \
+ --strict-mcp-config \
+ --mcp-config mcp.json \
+ --disable-slash-commands \
+ --no-chrome \
+ --system-prompt 'If tool mcp__panto-test__ping exists, call it when asked. Otherwise say unavailable.'