kill-switch-mcp 1.2.11 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/server.js +40 -11
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -3855,13 +3855,19 @@ import {
3855
3855
  stringToHex,
3856
3856
  pad
3857
3857
  } from "viem";
3858
- import { Account } from "viem/tempo";
3858
+ import { Account, withFeePayer } from "viem/tempo";
3859
3859
  import { tempoModerato, tempo } from "viem/chains";
3860
3860
  var TEMPO_BIN = join2(homedir2(), ".tempo", "bin", "tempo");
3861
3861
  var TEMPO_CHAIN_ID = parseInt(process.env.TEMPO_CHAIN_ID || "4217");
3862
- var tempoChain = TEMPO_CHAIN_ID === 4217 ? tempo : tempoModerato;
3863
- var TEMPO_NETWORK = TEMPO_CHAIN_ID === 4217 ? "mainnet" : "testnet";
3864
- var USDC_ADDRESS = process.env.USDC_ADDRESS || "0x20c000000000000000000000b9537d11c60e8b50";
3862
+ var isMainnet = TEMPO_CHAIN_ID === 4217;
3863
+ var TEMPO_NETWORK = isMainnet ? "mainnet" : "testnet";
3864
+ var USDC_ADDRESS = process.env.USDC_ADDRESS || (isMainnet ? "0x20c000000000000000000000b9537d11c60e8b50" : "0x20c0000000000000000000000000000000000000");
3865
+ var feePayerUrl = null;
3866
+ function setFeePayerUrl(url) {
3867
+ feePayerUrl = url;
3868
+ }
3869
+ var baseChain = isMainnet ? tempo : tempoModerato;
3870
+ var tempoChain = { ...baseChain, feeToken: USDC_ADDRESS };
3865
3871
  function runTempo(...args) {
3866
3872
  return new Promise((resolve, reject) => {
3867
3873
  execFile(TEMPO_BIN, args, { timeout: 30000 }, (error, stdout, stderr) => {
@@ -3978,12 +3984,25 @@ async function tempoFund() {
3978
3984
  async function tempoRefresh() {
3979
3985
  await runTempoInteractive("wallet", "refresh", "-n", TEMPO_NETWORK);
3980
3986
  }
3987
+ function readKeyAuthorization() {
3988
+ const tomlPath = join2(homedir2(), ".tempo", "wallet", "keys.toml");
3989
+ if (!existsSync2(tomlPath))
3990
+ return null;
3991
+ try {
3992
+ const content = readFileSync(tomlPath, "utf-8");
3993
+ const match = content.match(/key_authorization\s*=\s*"(0x[0-9a-fA-F]+)"/);
3994
+ return match ? match[1] : null;
3995
+ } catch {
3996
+ return null;
3997
+ }
3998
+ }
3981
3999
  function getWalletClient(privateKey, parentAddress) {
3982
4000
  const account = Account.fromSecp256k1(privateKey, { access: parentAddress });
4001
+ const transport = feePayerUrl ? withFeePayer(http(), http(feePayerUrl), { policy: "sign-and-broadcast" }) : http();
3983
4002
  return createWalletClient({
3984
4003
  account,
3985
4004
  chain: tempoChain,
3986
- transport: http()
4005
+ transport
3987
4006
  });
3988
4007
  }
3989
4008
  function getPublicClient() {
@@ -4070,11 +4089,15 @@ async function joinTournament(tournamentAddress, username) {
4070
4089
  if (remaining < buyInUsd) {
4071
4090
  throw new Error(`Spending limit too low. Need $${buyInUsd.toFixed(2)}, limit remaining: $${remaining.toFixed(2)}. ` + "Run `tempo wallet refresh` to reset your spending limit.");
4072
4091
  }
4092
+ const keyAuth = readKeyAuthorization();
4093
+ const sponsorOpts = feePayerUrl ? { feePayer: true } : {};
4073
4094
  const approveHash = await walletClient.writeContract({
4074
4095
  address: USDC_ADDRESS,
4075
4096
  abi: ERC20_ABI,
4076
4097
  functionName: "approve",
4077
- args: [tournamentAddress, buyIn]
4098
+ args: [tournamentAddress, buyIn],
4099
+ ...keyAuth ? { keyAuthorization: keyAuth } : {},
4100
+ ...sponsorOpts
4078
4101
  });
4079
4102
  await pub.waitForTransactionReceipt({ hash: approveHash });
4080
4103
  const usernameBytes = pad(stringToHex(username), { size: 32 });
@@ -4082,7 +4105,9 @@ async function joinTournament(tournamentAddress, username) {
4082
4105
  address: tournamentAddress,
4083
4106
  abi: TOURNAMENT_ABI,
4084
4107
  functionName: "deposit",
4085
- args: [usernameBytes]
4108
+ args: [usernameBytes],
4109
+ ...keyAuth ? { keyAuthorization: keyAuth } : {},
4110
+ ...sponsorOpts
4086
4111
  });
4087
4112
  await pub.waitForTransactionReceipt({ hash: depositHash });
4088
4113
  return {
@@ -4099,6 +4124,10 @@ var SERVER_URL = (() => {
4099
4124
  return process.env.KILL_SWITCH_SERVER || "localhost";
4100
4125
  })();
4101
4126
  console.error(`[Kill Switch MCP] Server: ${SERVER_URL}`);
4127
+ var isLocal = SERVER_URL === "localhost" || SERVER_URL === "127.0.0.1";
4128
+ var FEE_PAYER_URL = `${isLocal ? "http://localhost:8888" : `https://${SERVER_URL}`}/api/fee-payer`;
4129
+ setFeePayerUrl(FEE_PAYER_URL);
4130
+ console.error(`[Kill Switch MCP] Fee payer relay: ${FEE_PAYER_URL}`);
4102
4131
  var KILLSWITCH_HOME = join3(homedir3(), ".killswitch");
4103
4132
  var BOTS_DIR = join3(KILLSWITCH_HOME, "bots");
4104
4133
  var GUIDE = `# Kill Switch — Player Guide
@@ -4784,8 +4813,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
4784
4813
  }
4785
4814
  }
4786
4815
  try {
4787
- const isLocal = SERVER_URL === "localhost" || SERVER_URL === "127.0.0.1";
4788
- const webBase = isLocal ? `http://localhost:8888` : `https://${SERVER_URL}`;
4816
+ const isLocal2 = SERVER_URL === "localhost" || SERVER_URL === "127.0.0.1";
4817
+ const webBase = isLocal2 ? `http://localhost:8888` : `https://${SERVER_URL}`;
4789
4818
  const aliveRes = await fetch(`${webBase}/api/agent-alive?username=${encodeURIComponent(username.toLowerCase())}`);
4790
4819
  const aliveData = await aliveRes.json();
4791
4820
  if (aliveData.alive === false) {
@@ -5031,8 +5060,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
5031
5060
  if (!connection) {
5032
5061
  return errorResponse("Not connected. Call login first.");
5033
5062
  }
5034
- const isLocal = SERVER_URL === "localhost" || SERVER_URL === "127.0.0.1";
5035
- const webBase = isLocal ? `http://localhost:8888` : `https://${SERVER_URL}`;
5063
+ const isLocal2 = SERVER_URL === "localhost" || SERVER_URL === "127.0.0.1";
5064
+ const webBase = isLocal2 ? `http://localhost:8888` : `https://${SERVER_URL}`;
5036
5065
  const availRes = await fetch(`${webBase}/api/game/available`);
5037
5066
  const available = await availRes.json();
5038
5067
  if (available.status === "active") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kill-switch-mcp",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "Kill Switch MCP Server — AI battle royale powered by Claude Code",
5
5
  "type": "module",
6
6
  "bin": {