@mcteamster/white-mcp 2.3.1 → 2.3.2
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.
- package/dist/index.js +38 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66910,40 +66910,6 @@ function getServerForCreate(region) {
|
|
|
66910
66910
|
if (detected && SERVERS[detected]) return SERVERS[detected];
|
|
66911
66911
|
return SERVERS.NA;
|
|
66912
66912
|
}
|
|
66913
|
-
function sessionKey(matchID, playerID) {
|
|
66914
|
-
return `${matchID}:${playerID}`;
|
|
66915
|
-
}
|
|
66916
|
-
async function connectSession(matchID, playerID, credentials, server) {
|
|
66917
|
-
const key = sessionKey(matchID, playerID);
|
|
66918
|
-
const existing = sessions.get(key);
|
|
66919
|
-
if (existing) existing.client.stop?.();
|
|
66920
|
-
const client = Client({
|
|
66921
|
-
game: BlankWhiteCards,
|
|
66922
|
-
multiplayer: SocketIO({ server }),
|
|
66923
|
-
matchID,
|
|
66924
|
-
playerID,
|
|
66925
|
-
credentials
|
|
66926
|
-
});
|
|
66927
|
-
await new Promise((resolve, reject) => {
|
|
66928
|
-
const timeout = setTimeout(() => reject(new Error("Timed out connecting to match")), 1e4);
|
|
66929
|
-
const unsub = client.subscribe((state) => {
|
|
66930
|
-
if (state && state.G) {
|
|
66931
|
-
clearTimeout(timeout);
|
|
66932
|
-
unsub();
|
|
66933
|
-
resolve();
|
|
66934
|
-
}
|
|
66935
|
-
});
|
|
66936
|
-
client.start();
|
|
66937
|
-
});
|
|
66938
|
-
const session = { client, credentials };
|
|
66939
|
-
sessions.set(key, session);
|
|
66940
|
-
return session;
|
|
66941
|
-
}
|
|
66942
|
-
function requireSession(matchID, playerID) {
|
|
66943
|
-
const session = sessions.get(sessionKey(matchID, playerID));
|
|
66944
|
-
if (!session) throw new Error(`Not in match ${matchID} as player ${playerID} \u2014 call join_match first`);
|
|
66945
|
-
return session;
|
|
66946
|
-
}
|
|
66947
66913
|
function stripImage(card) {
|
|
66948
66914
|
const { image: _image, ...content } = card.content;
|
|
66949
66915
|
return { id: card.id, content, location: card.location, owner: card.owner, likes: card.likes };
|
|
@@ -67098,9 +67064,43 @@ Cards can optionally have images. If you can draw or generate an image to accomp
|
|
|
67098
67064
|
This server provides role prompts (autonomous_player, referee, spectator, deck_builder) that describe how to use these tools for specific purposes. List prompts to see available roles.
|
|
67099
67065
|
`.trim();
|
|
67100
67066
|
function createMcpServer() {
|
|
67101
|
-
const
|
|
67067
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
67068
|
+
function sessionKey(matchID, playerID) {
|
|
67069
|
+
return `${matchID}:${playerID}`;
|
|
67070
|
+
}
|
|
67071
|
+
async function connectSession(matchID, playerID, credentials, server) {
|
|
67072
|
+
const key = sessionKey(matchID, playerID);
|
|
67073
|
+
const existing = sessions.get(key);
|
|
67074
|
+
if (existing) existing.client.stop?.();
|
|
67075
|
+
const client = Client({
|
|
67076
|
+
game: BlankWhiteCards,
|
|
67077
|
+
multiplayer: SocketIO({ server }),
|
|
67078
|
+
matchID,
|
|
67079
|
+
playerID,
|
|
67080
|
+
credentials
|
|
67081
|
+
});
|
|
67082
|
+
await new Promise((resolve, reject) => {
|
|
67083
|
+
const timeout = setTimeout(() => reject(new Error("Timed out connecting to match")), 1e4);
|
|
67084
|
+
const unsub = client.subscribe((state) => {
|
|
67085
|
+
if (state && state.G) {
|
|
67086
|
+
clearTimeout(timeout);
|
|
67087
|
+
unsub();
|
|
67088
|
+
resolve();
|
|
67089
|
+
}
|
|
67090
|
+
});
|
|
67091
|
+
client.start();
|
|
67092
|
+
});
|
|
67093
|
+
const session = { client, credentials };
|
|
67094
|
+
sessions.set(key, session);
|
|
67095
|
+
return session;
|
|
67096
|
+
}
|
|
67097
|
+
function requireSession(matchID, playerID) {
|
|
67098
|
+
const session = sessions.get(sessionKey(matchID, playerID));
|
|
67099
|
+
if (!session) throw new Error(`Not in match ${matchID} as player ${playerID} \u2014 call join_match first`);
|
|
67100
|
+
return session;
|
|
67101
|
+
}
|
|
67102
67102
|
const mcp = new McpServer(
|
|
67103
|
-
{ name: "blank-white-cards", version: "2.3.
|
|
67103
|
+
{ name: "blank-white-cards", version: "2.3.2" },
|
|
67104
67104
|
{ instructions: INSTRUCTIONS }
|
|
67105
67105
|
);
|
|
67106
67106
|
mcp.registerTool(
|
|
@@ -67477,7 +67477,7 @@ function createMcpServer() {
|
|
|
67477
67477
|
},
|
|
67478
67478
|
async ({ matchID, playerID }) => {
|
|
67479
67479
|
const key = sessionKey(matchID, playerID);
|
|
67480
|
-
const session =
|
|
67480
|
+
const session = sessions.get(key);
|
|
67481
67481
|
if (!session) return text({ message: `Not in match ${matchID} as player ${playerID}` });
|
|
67482
67482
|
const lobby = new LobbyClient({ server: getServerForMatch(matchID) });
|
|
67483
67483
|
try {
|
|
@@ -67485,7 +67485,7 @@ function createMcpServer() {
|
|
|
67485
67485
|
} catch {
|
|
67486
67486
|
}
|
|
67487
67487
|
session.client.stop?.();
|
|
67488
|
-
|
|
67488
|
+
sessions.delete(key);
|
|
67489
67489
|
return text({ message: `Left match ${matchID}` });
|
|
67490
67490
|
}
|
|
67491
67491
|
);
|