#!/usr/bin/env bash # C1K MCP endpoint with plain curl (MCP-01): one JSON-RPC message per POST, # JSON back, no session. Useful to see what an MCP client does under the hood. # export C1K_MCP_TOKEN='c1k_mcp_...' # Integrations page, a key "Used for: MCP" # export C1K_ORG_ID='org_...' set -euo pipefail : "${C1K_MCP_TOKEN:?set C1K_MCP_TOKEN}" "${C1K_ORG_ID:?set C1K_ORG_ID}" URL="https://c1k.me/mcp/$C1K_ORG_ID" HEADERS=(-H "Authorization: Bearer $C1K_MCP_TOKEN" -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream') # After initialize, every request names the negotiated protocol version. rpc() { curl -sS --fail-with-body "${HEADERS[@]}" -H 'MCP-Protocol-Version: 2025-11-25' -d "$1" "$URL"; echo; } # 1. Initialize. The answer names the protocol version, 2025-11-25. curl -sS --fail-with-body "${HEADERS[@]}" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl-example","version":"1.0.0"}}}' \ "$URL"; echo # 2. Confirm initialization (answers 202 without a body). rpc '{"jsonrpc":"2.0","method":"notifications/initialized"}' # 3. The tools this token's scopes allow. rpc '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' # 4. Create a link. Repeating the same idempotency_key returns the first result. rpc "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"tools/call\",\"params\":{\"name\":\"create_link\",\"arguments\":{\"destination_url\":\"https://venture.example/launch\",\"idempotency_key\":\"mcp-example-$(date -u +%Y%m%d%H%M%S)\"}}}" # 5. The ten newest links. rpc '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"list_links","arguments":{"limit":10}}}'