@chrischall/warapp-mcp 0.2.0 → 0.3.0
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +22 -4
- package/dist/bundle.js +1052 -744
- package/dist/direct/link.js +9 -5
- package/dist/direct/session.js +60 -6
- package/dist/direct/sign-in.js +296 -0
- package/dist/direct/transport.js +59 -24
- package/dist/hosted.js +6 -4
- package/dist/tools/chat-read-mark.js +1 -1
- package/dist/tools/healthcheck.js +7 -1
- package/dist/tools/index.js +9 -3
- package/dist/tools/join-game.js +1 -1
- package/dist/tools/live-context.js +2 -0
- package/dist/tools/my-games.js +1 -1
- package/dist/tools/open-games.js +5 -2
- package/dist/tools/session.js +50 -18
- package/dist/tools/sign-in.js +56 -0
- package/dist/tools/team-brief.js +1 -1
- package/dist/tools/team.js +1 -1
- package/dist/tools/write-kit.js +10 -3
- package/dist/version.js +1 -1
- package/docs/examples/warapp-auth-flow.json +31 -0
- package/manifest.json +1 -1
- package/mint.yaml +30 -13
- package/package.json +3 -2
- package/server.json +2 -2
package/dist/tools/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import { pushWebSocketLeg } from '../push/websocket.js';
|
|
|
40
40
|
import { readSession } from '../direct/session.js';
|
|
41
41
|
import { createDirectFirstBridge } from '../direct/transport.js';
|
|
42
42
|
import { isHosted } from '../hosted.js';
|
|
43
|
+
import { registerSignInTool } from './sign-in.js';
|
|
43
44
|
import { createWarappBridge } from '../transport-bridge.js';
|
|
44
45
|
/** Every tool this server serves. index.ts and the tests share this list. */
|
|
45
46
|
export function registerAllTools(server, deps = {}) {
|
|
@@ -56,9 +57,10 @@ export function registerAllTools(server, deps = {}) {
|
|
|
56
57
|
// browser bridge otherwise (WARAPP_TRANSPORT: auto default | direct |
|
|
57
58
|
// fetchproxy). WarappRpc, the page fetches, the healthcheck and the push
|
|
58
59
|
// socket all take this one bridge, so they all gain direct mode at once.
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
60
|
+
// Hosted (src/hosted.ts) no session file is read or written and
|
|
61
|
+
// warapp_link_session is not registered: the direct leg serves only from the
|
|
62
|
+
// AuthToken mcp-host captured at sign-in (WARAPP_AUTH_TOKEN, in memory,
|
|
63
|
+
// #333), and without one the router is pinned to the browser bridge.
|
|
62
64
|
const hosted = isHosted(env ?? process.env);
|
|
63
65
|
const bridge = createDirectFirstBridge({
|
|
64
66
|
store: { read: () => readSession(deps.env) },
|
|
@@ -149,4 +151,8 @@ export function registerAllTools(server, deps = {}) {
|
|
|
149
151
|
...(env ? { env } : {}),
|
|
150
152
|
});
|
|
151
153
|
registerPushTools(server, live, push, deps.env ? { env: deps.env } : {});
|
|
154
|
+
// Hosted only: the war.app sign-in mcp-host's authFlow captures the AuthToken from (#333 part B).
|
|
155
|
+
// Locally warapp_link_session stays the way to the direct transport.
|
|
156
|
+
if (hosted)
|
|
157
|
+
registerSignInTool(server, deps.signIn ? { signIn: deps.signIn } : {});
|
|
152
158
|
}
|
package/dist/tools/join-game.js
CHANGED
|
@@ -225,7 +225,7 @@ export function registerJoinGameTool(server, ctx) {
|
|
|
225
225
|
// acts as the signed-in account, so it is refused when that cannot be read (#133).
|
|
226
226
|
const [html, me] = await Promise.all([openGamesPage(ctx), ctx.myIdentity({ fresh: true })]);
|
|
227
227
|
if (me === undefined)
|
|
228
|
-
throw accountUnknown(ctx
|
|
228
|
+
throw accountUnknown(ctx);
|
|
229
229
|
const { token, inGameId: myId } = me;
|
|
230
230
|
const bundle = await ctx.bundle();
|
|
231
231
|
const parsed = parseOpenGamesPage(html, bundle);
|
|
@@ -8,6 +8,7 @@ import { BUNDLE_FETCH_TIMEOUT_MS, BUNDLE_MAX_BYTES, BundleProvider } from '../pr
|
|
|
8
8
|
import { Method, readTerritoryPicks, writeGetLatestGameInfoParams, writeGetTerritoryPicksParams, } from '../protocol/methods.js';
|
|
9
9
|
import { WarappRpc } from '../protocol/rpc.js';
|
|
10
10
|
import { BRIDGE_DOMAINS } from '../transport-bridge.js';
|
|
11
|
+
import { hostedSession } from '../direct/session.js';
|
|
11
12
|
import { isHosted } from '../hosted.js';
|
|
12
13
|
/**
|
|
13
14
|
* The token from war.app's `/InviteToken` page ("Your invite token is N"), as text — the
|
|
@@ -220,6 +221,7 @@ export function createLiveContext(opts) {
|
|
|
220
221
|
fetchPage: fetchText,
|
|
221
222
|
dataDir: dir,
|
|
222
223
|
hosted: isHosted(opts.env ?? process.env),
|
|
224
|
+
hostSignIn: hostedSession(opts.env ?? process.env) !== null,
|
|
223
225
|
client: opts.client,
|
|
224
226
|
rpc,
|
|
225
227
|
decoderReport: () => lastBundle?.report?.(),
|
package/dist/tools/my-games.js
CHANGED
|
@@ -64,7 +64,7 @@ export async function listMyGames(read, windows = MY_GAMES_WINDOWS) {
|
|
|
64
64
|
async function myInGameId(ctx) {
|
|
65
65
|
const me = await ctx.myInGameId();
|
|
66
66
|
if (me === undefined) {
|
|
67
|
-
throw accountUnknown(ctx
|
|
67
|
+
throw accountUnknown(ctx, 'its games cannot be listed');
|
|
68
68
|
}
|
|
69
69
|
return me;
|
|
70
70
|
}
|
package/dist/tools/open-games.js
CHANGED
|
@@ -5,6 +5,7 @@ import { McpToolError } from '@chrischall/mcp-utils';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { filterOpenGames, joiningPolicy, lotteryOf, lotteryShape, markJoined, withLottery, OPEN_GAMES_URL, parseOpenGamesPage, } from '../open-games.js';
|
|
7
7
|
import { readAnnotations, respond, untrustedDescription } from './common.js';
|
|
8
|
+
import { HOST_SIGN_IN_ADVICE } from '../direct/transport.js';
|
|
8
9
|
import { noBrowserNote } from './session.js';
|
|
9
10
|
import { lookupMeta } from './hints.js';
|
|
10
11
|
/** The OpenGames page as text, or a tool error with a hint. */
|
|
@@ -15,8 +16,10 @@ export async function openGamesPage(ctx) {
|
|
|
15
16
|
catch (e) {
|
|
16
17
|
throw new McpToolError(`Could not read war.app's open games page: ${e instanceof Error ? e.message : String(e)}`, {
|
|
17
18
|
kind: 'unknown',
|
|
18
|
-
hint:
|
|
19
|
-
|
|
19
|
+
hint: ctx.hosted && ctx.hostSignIn
|
|
20
|
+
? `${HOST_SIGN_IN_ADVICE} Then retry.`
|
|
21
|
+
: (ctx.hosted ? 'Make sure' : 'Link a session with warapp_link_session to read it without a browser, or make sure') +
|
|
22
|
+
' a signed-in war.app tab is open and paired (reload or focus it if it is frozen), then retry.',
|
|
20
23
|
cause: e,
|
|
21
24
|
});
|
|
22
25
|
}
|
package/dist/tools/session.js
CHANGED
|
@@ -10,24 +10,35 @@
|
|
|
10
10
|
// last answer was a `SessionExpiredError`, it surfaces "session expired — run
|
|
11
11
|
// warapp_link_session" so the owner relinks; a relink clears it.
|
|
12
12
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
13
|
+
// Hosted (src/hosted.ts) `warapp_link_session` is never registered: a hosted
|
|
14
|
+
// child stores no session. Its session, when it has one, is the AuthToken
|
|
15
|
+
// mcp-host captured at sign-in (WARAPP_AUTH_TOKEN, #333): `warapp_session_status`
|
|
16
|
+
// then reports `hosted: true`, `linked: true`, `linkedBy: 'host'` and the active leg (no
|
|
17
|
+
// capture time, no age), and a signed-out one points at the connection's
|
|
18
|
+
// "Sign in". Without it the status reports the browser bridge, as before,
|
|
19
|
+
// without suggesting a link.
|
|
16
20
|
//
|
|
17
21
|
// SECURITY: the AuthToken is a full-account credential. Neither tool returns,
|
|
18
22
|
// logs, or previews it; the status output carries only `capturedAt`/`host`/age.
|
|
19
23
|
import { CONFIRM_INJECTION_RULE, toolAnnotations } from '@chrischall/mcp-utils';
|
|
20
24
|
import { z } from 'zod';
|
|
21
25
|
import { linkSession } from '../direct/link.js';
|
|
22
|
-
import { readSession, SESSION_HOST } from '../direct/session.js';
|
|
26
|
+
import { hostedTokenState, readSession, SESSION_HOST } from '../direct/session.js';
|
|
27
|
+
import { HOST_SIGN_IN_ADVICE } from '../direct/transport.js';
|
|
23
28
|
import { isHosted } from '../hosted.js';
|
|
24
29
|
import { lookupMeta, mintMeta } from './hints.js';
|
|
25
30
|
import { readAnnotations, respond, untrustedDescription } from './common.js';
|
|
26
31
|
import { defineGatedWrite } from './write-kit.js';
|
|
27
32
|
const HINT_NOT_LINKED = 'No war.app session is linked. Run warapp_link_session to use the direct (no-browser) transport; the browser ' +
|
|
28
33
|
'bridge is used until then.';
|
|
29
|
-
const NOTE_HOSTED = 'This server is hosted:
|
|
30
|
-
'bridge and your signed-in war.app tab.'
|
|
34
|
+
const NOTE_HOSTED = 'This server is hosted: it reaches war.app directly only from the session captured at sign-in, and this ' +
|
|
35
|
+
'connection has none, so war.app calls go through the browser bridge and your signed-in war.app tab. ' +
|
|
36
|
+
HOST_SIGN_IN_ADVICE;
|
|
37
|
+
const NOTE_HOSTED_DIRECT = 'This server is hosted and signed in to war.app by mcp-host: war.app calls go directly to war.app with the ' +
|
|
38
|
+
'session captured at sign-in, and fall back to the browser bridge only when that session stops working.';
|
|
39
|
+
const NOTE_HOSTED_MALFORMED = 'This server is hosted, and the war.app session mcp-host passed it is not usable, so war.app calls go through ' +
|
|
40
|
+
`the browser bridge and your signed-in war.app tab. ${HOST_SIGN_IN_ADVICE}`;
|
|
41
|
+
const HINT_HOST_EXPIRED = `The war.app session this connection signed in with is signed out. ${HOST_SIGN_IN_ADVICE}`;
|
|
31
42
|
const HINT_EXPIRED = 'The linked war.app session is signed out (war.app answered a direct call signed-out this run). Run ' +
|
|
32
43
|
'warapp_link_session to relink.';
|
|
33
44
|
/**
|
|
@@ -42,6 +53,7 @@ export function registerSessionTools(server, deps) {
|
|
|
42
53
|
const link = deps.link ?? ((opts) => linkSession({ ...(deps.env ? { env: deps.env } : {}), ...opts }));
|
|
43
54
|
const now = deps.now ?? Date.now;
|
|
44
55
|
const hosted = deps.hosted ?? isHosted(deps.env ?? process.env);
|
|
56
|
+
const hostToken = hosted ? (deps.hostToken ?? hostedTokenState(deps.env ?? process.env)) : 'none';
|
|
45
57
|
/** The board decoder, once a live tool has loaded the client bundle (#148). */
|
|
46
58
|
const decoderView = () => {
|
|
47
59
|
if (!deps.decoder)
|
|
@@ -66,21 +78,41 @@ export function registerSessionTools(server, deps) {
|
|
|
66
78
|
};
|
|
67
79
|
server.registerTool('warapp_session_status', {
|
|
68
80
|
title: 'war.app direct-transport session status',
|
|
69
|
-
description: untrustedDescription(hosted
|
|
70
|
-
? 'Report which transport serves war.app calls on this hosted server (
|
|
71
|
-
'
|
|
72
|
-
'rides (websocket or xhr-polling) once it has run, and, once
|
|
73
|
-
'bundle decodes boards (a cached stand-in or not) and which of
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'which transport
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
description: untrustedDescription(hosted && hostToken === 'ok'
|
|
82
|
+
? 'Report which transport serves war.app calls on this hosted server (direct to war.app with the session ' +
|
|
83
|
+
'mcp-host captured at sign-in, or the browser bridge after that session stops working) and which ' +
|
|
84
|
+
'transport the turn-notification push socket rides (websocket or xhr-polling) once it has run, and, once ' +
|
|
85
|
+
'a live board has been read, which client bundle decodes boards (a cached stand-in or not) and which of ' +
|
|
86
|
+
'its reader helpers were verified. Never shows the session cookie. Read-only.'
|
|
87
|
+
: hosted
|
|
88
|
+
? 'Report which transport serves war.app calls on this hosted server (the browser bridge: hosted, the ' +
|
|
89
|
+
'direct, no-browser transport runs only from the session captured at sign-in, and this connection ' +
|
|
90
|
+
'has none) and which transport the turn-notification push socket ' +
|
|
91
|
+
'rides (websocket or xhr-polling) once it has run, and, once a live board has been read, which client ' +
|
|
92
|
+
'bundle decodes boards (a cached stand-in or not) and which of its reader helpers were verified. Read-only.'
|
|
93
|
+
: 'Report whether a signed-in war.app session is linked for the direct (no-browser) transport, when it was ' +
|
|
94
|
+
'captured and how old it is, which transport is currently active (direct, or the browser bridge), and ' +
|
|
95
|
+
'which transport the turn-notification push socket rides (websocket or xhr-polling) once it has run, ' +
|
|
96
|
+
'and, once a live board has been read, which client bundle decodes boards (a cached stand-in or not) and ' +
|
|
97
|
+
'which of its reader helpers were verified. ' +
|
|
98
|
+
'Never shows the session cookie. Read-only; use warapp_link_session to link or relink.'),
|
|
80
99
|
_meta: lookupMeta(['war.app session', 'is war.app linked', 'direct transport status']),
|
|
81
100
|
annotations: readAnnotations('war.app session status'),
|
|
82
101
|
inputSchema: z.object({}),
|
|
83
102
|
}, async () => {
|
|
103
|
+
if (hosted && hostToken === 'ok') {
|
|
104
|
+
const pt = deps.pushTransport?.();
|
|
105
|
+
const base = {
|
|
106
|
+
hosted: true,
|
|
107
|
+
linked: true,
|
|
108
|
+
linkedBy: 'host',
|
|
109
|
+
activeTransport: deps.transport.activeLeg(),
|
|
110
|
+
...(pt ? { pushTransport: pt } : {}),
|
|
111
|
+
...decoderView(),
|
|
112
|
+
hostedNote: NOTE_HOSTED_DIRECT,
|
|
113
|
+
};
|
|
114
|
+
return respond(undefined, ['compact'], () => deps.transport.sessionStale() ? { ...base, sessionExpired: true, hint: HINT_HOST_EXPIRED } : base);
|
|
115
|
+
}
|
|
84
116
|
if (hosted) {
|
|
85
117
|
const pt = deps.pushTransport?.();
|
|
86
118
|
return respond(undefined, ['compact'], () => ({
|
|
@@ -89,7 +121,7 @@ export function registerSessionTools(server, deps) {
|
|
|
89
121
|
activeTransport: 'fetchproxy',
|
|
90
122
|
...(pt ? { pushTransport: pt } : {}),
|
|
91
123
|
...decoderView(),
|
|
92
|
-
hostedNote: NOTE_HOSTED,
|
|
124
|
+
hostedNote: hostToken === 'malformed' ? NOTE_HOSTED_MALFORMED : NOTE_HOSTED,
|
|
93
125
|
}));
|
|
94
126
|
}
|
|
95
127
|
const session = await read();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// `warapp_sign_in` — the war.app sign-in mcp-host's hosted authFlow calls as its
|
|
2
|
+
// `capture` (#333 part B, docs/examples/warapp-auth-flow.json).
|
|
3
|
+
//
|
|
4
|
+
// Registered ONLY on a hosted child (src/hosted.ts). Locally the way to the
|
|
5
|
+
// direct transport stays warapp_link_session, which takes the cookie off the
|
|
6
|
+
// signed-in tab and never returns it.
|
|
7
|
+
//
|
|
8
|
+
// THE ONE DOCUMENTED EXCEPTION to "the AuthToken is never in a tool result":
|
|
9
|
+
// this tool's result is `{ authToken }`, because mcp-host's `capture` reads the
|
|
10
|
+
// credential out of the capture tool's result (`path: authToken`) and seals it
|
|
11
|
+
// as the per-user secret WARAPP_AUTH_TOKEN. The caller already holds the
|
|
12
|
+
// account's email and password, so the result grants it nothing it did not
|
|
13
|
+
// have. Nothing else about the account is returned, and a refusal's text never
|
|
14
|
+
// holds the email, the password or a cookie value (src/direct/sign-in.ts).
|
|
15
|
+
// Hiding it from the connector's tool menu (mcp-host `enabledTools`) is the
|
|
16
|
+
// owner's choice, not a default: a flow's step and capture calls are never
|
|
17
|
+
// checked against that allowlist, so the sign-in would still run, but the gate
|
|
18
|
+
// is fail-closed — once set, the connection's resources (warapp://strategy) and
|
|
19
|
+
// prompts are gone, and every tool a later release adds stays hidden until the
|
|
20
|
+
// list is edited by hand (docs/PLAN-DIRECT.md, registration change step 3).
|
|
21
|
+
//
|
|
22
|
+
// Not confirm-gated: the flow calls it with exactly the arguments its document
|
|
23
|
+
// declares, and a gate would need another argument there. It is not read-only
|
|
24
|
+
// (it signs in, creating a war.app session), it reaches no player, and it is
|
|
25
|
+
// not idempotent (each call is a sign-in attempt war.app may count).
|
|
26
|
+
import { toolAnnotations } from '@chrischall/mcp-utils';
|
|
27
|
+
import { z } from 'zod';
|
|
28
|
+
import { signIn } from '../direct/sign-in.js';
|
|
29
|
+
import { mintMeta } from './hints.js';
|
|
30
|
+
export function registerSignInTool(server, deps = {}) {
|
|
31
|
+
const run = deps.signIn ?? signIn;
|
|
32
|
+
server.registerTool('warapp_sign_in', {
|
|
33
|
+
title: 'Sign in to war.app (host sign-in flow)',
|
|
34
|
+
description: "For the host's sign-in flow only, not for chat use: signs in to war.app once with the account's email " +
|
|
35
|
+
'and password and returns the session cookie war.app sets, as `authToken`, which the host keeps as this ' +
|
|
36
|
+
"connection's own secret so later calls reach war.app without a browser. The password is used for this one " +
|
|
37
|
+
'sign-in and never stored. A refusal (wrong email or password, a captcha or bot check, a network failure) ' +
|
|
38
|
+
'is an error that says which, and is never retried, because war.app may count failed sign-ins.',
|
|
39
|
+
_meta: mintMeta('other', ['sign in to war.app']),
|
|
40
|
+
annotations: toolAnnotations({
|
|
41
|
+
title: 'Sign in to war.app',
|
|
42
|
+
readOnly: false,
|
|
43
|
+
destructive: false,
|
|
44
|
+
idempotent: false,
|
|
45
|
+
openWorld: true,
|
|
46
|
+
}),
|
|
47
|
+
inputSchema: z.object({
|
|
48
|
+
email: z.string().min(1).max(320).describe("The war.app account's email."),
|
|
49
|
+
password: z.string().min(1).max(1024).describe("The war.app account's password, used once and never stored."),
|
|
50
|
+
}),
|
|
51
|
+
}, async ({ email, password }, ctx) => {
|
|
52
|
+
const { authToken } = await run({ email, password }, { signal: ctx.mcpReq.signal });
|
|
53
|
+
// The capture reads this top-level key; nothing else about the account is returned.
|
|
54
|
+
return { content: [{ type: 'text', text: JSON.stringify({ authToken }) }] };
|
|
55
|
+
});
|
|
56
|
+
}
|
package/dist/tools/team-brief.js
CHANGED
|
@@ -67,7 +67,7 @@ export function registerTeamBriefTool(server, ctx) {
|
|
|
67
67
|
const gameId = parseGameId(game_id);
|
|
68
68
|
const identity = await ctx.myIdentity().catch(() => undefined);
|
|
69
69
|
if (!identity)
|
|
70
|
-
throw accountUnknown(ctx
|
|
70
|
+
throw accountUnknown(ctx, 'your team brief cannot be read');
|
|
71
71
|
const feed = await ctx.client.getGame(gameId, { settings: true });
|
|
72
72
|
if (feed.state !== PLAYING && feed.state !== DISTRIBUTING) {
|
|
73
73
|
throw new McpToolError(`Game ${feed.id} is not being picked or played (game state: ${feed.state}), so there is nothing to brief.`, {
|
package/dist/tools/team.js
CHANGED
|
@@ -67,7 +67,7 @@ export function registerTeamTool(server, ctx) {
|
|
|
67
67
|
const gameId = parseGameId(game_id);
|
|
68
68
|
const identity = await ctx.myIdentity().catch(() => undefined);
|
|
69
69
|
if (!identity)
|
|
70
|
-
throw accountUnknown(ctx
|
|
70
|
+
throw accountUnknown(ctx, 'your team cannot be read');
|
|
71
71
|
const read = await ctx.client.getGame(gameId, { settings: true, chat: true });
|
|
72
72
|
const { game, source } = await resolveTeams(ctx, read);
|
|
73
73
|
const me = game.players.find((p) => p.id === identity.token);
|
package/dist/tools/write-kit.js
CHANGED
|
@@ -39,14 +39,21 @@ import { defineWrite, McpToolError, registerWrite, } from '@chrischall/mcp-utils
|
|
|
39
39
|
import { notSent, WarappServerError } from '../protocol/rpc.js';
|
|
40
40
|
import { respond, untrustedText } from './common.js';
|
|
41
41
|
import { withToolConfig } from './hints.js';
|
|
42
|
+
import { HOST_SIGN_IN_ADVICE } from '../direct/transport.js';
|
|
42
43
|
import { failureText } from './live-context.js';
|
|
43
44
|
import { resolvePlayer } from './resolve.js';
|
|
44
45
|
/** Refuse a write (or a read) before anything is sent. */
|
|
45
46
|
export function refuse(message, hint) {
|
|
46
47
|
throw new McpToolError(message, { kind: 'unknown', hint });
|
|
47
48
|
}
|
|
48
|
-
/**
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The hint when the signed-in account cannot be told: linking a session is suggested only locally, and a
|
|
51
|
+
* hosted connection mcp-host signed in to war.app is pointed at its "Sign in" (a paired tab meanwhile).
|
|
52
|
+
*/
|
|
53
|
+
function signedInHint(view) {
|
|
54
|
+
const { hosted, hostSignIn } = typeof view === 'object' ? view : { hosted: view, hostSignIn: false };
|
|
55
|
+
if (hosted && hostSignIn)
|
|
56
|
+
return `${HOST_SIGN_IN_ADVICE} Then retry.`;
|
|
50
57
|
return hosted
|
|
51
58
|
? 'Make sure a war.app tab signed in to your account is open and paired (reload or focus it if it is frozen), then retry.'
|
|
52
59
|
: 'Make sure a war.app tab signed in to your account is open and paired (reload or focus it if it is frozen), or link ' +
|
|
@@ -67,7 +74,7 @@ export function accountUnknown(hosted, consequence = 'nothing was sent') {
|
|
|
67
74
|
export async function requireMe(ctx, opts = {}) {
|
|
68
75
|
const token = await ctx.myInviteToken({ fresh: opts.fresh ?? true });
|
|
69
76
|
if (token === undefined)
|
|
70
|
-
throw accountUnknown(ctx
|
|
77
|
+
throw accountUnknown(ctx, opts.consequence);
|
|
71
78
|
return token;
|
|
72
79
|
}
|
|
73
80
|
/** The seat of account `token` in `game`; refused when it holds none. */
|
package/dist/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Single source of truth for the server version. release-please bumps the
|
|
2
2
|
// literal on the marked line (registered in release-please-config.json
|
|
3
3
|
// extra-files); every other module imports VERSION from here.
|
|
4
|
-
export const VERSION = '0.
|
|
4
|
+
export const VERSION = '0.3.0'; // x-release-please-version
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"steps": [
|
|
3
|
+
{
|
|
4
|
+
"tool": "warapp_session_status",
|
|
5
|
+
"args": {},
|
|
6
|
+
"prompt": [
|
|
7
|
+
{
|
|
8
|
+
"name": "password",
|
|
9
|
+
"label": "war.app password",
|
|
10
|
+
"type": "password",
|
|
11
|
+
"help": "Used once to sign in, never stored: it goes to war.app once, with the war.app email you gave above, and only the session war.app gives back is kept. If it stops working (a changed password, say), use Sign in on this connection again, or reconnect it."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"title": "Sign in to war.app",
|
|
15
|
+
"description": "This lets the connector reach war.app directly, without your browser. Connecting needs this sign-in to succeed: if war.app refuses it (a wrong password, a bot check, an outage, or an account that signs in only through Facebook), the connection is not made. Your password is sent to war.app once, with your war.app email, and then discarded; what is kept is the session war.app gives back, a full-account credential stored as your own secret on this connection. A refused sign-in is not retried for you, because war.app may count failed attempts."
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"capture": {
|
|
19
|
+
"tool": "warapp_sign_in",
|
|
20
|
+
"args": {
|
|
21
|
+
"email": {
|
|
22
|
+
"from": "WARAPP_EMAIL"
|
|
23
|
+
},
|
|
24
|
+
"password": {
|
|
25
|
+
"from": "password"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"path": "authToken",
|
|
29
|
+
"into": "WARAPP_AUTH_TOKEN"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"manifest_version": "0.3",
|
|
4
4
|
"name": "warapp-mcp",
|
|
5
5
|
"display_name": "war.app (Warzone)",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.3.0",
|
|
7
7
|
"description": "war.app (Warzone) game advisor for Claude — your games, maps, bonuses, board analysis and routes via the GameFeed API, plus your games list (waiting on you first), opponent scouting with your head-to-head, the live board, territory picks, cards, turn planning and submission, turn notifications, and chat through your signed-in war.app tab (ContextMint Bridge). Joining, leaving or surrendering a game, accepting another player's surrender, Begin on a speed first turn, picks, turn orders, withdrawing them, chat sends, marking notifications and chat read, deleting notifications and linking a session (local only) are confirm-gated.",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Chris Hall",
|
package/mint.yaml
CHANGED
|
@@ -10,14 +10,27 @@ slug: warapp
|
|
|
10
10
|
# `bridgePortEnv: WARAPP_WS_PORT` (with a runtime that supports a bridge) —
|
|
11
11
|
# registration fields this manifest has no schema for.
|
|
12
12
|
#
|
|
13
|
-
# Direct transport
|
|
14
|
-
#
|
|
15
|
-
# without a browser (WARAPP_TRANSPORT=auto/direct).
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
13
|
+
# Direct transport. A local install can link the signed-in war.app session
|
|
14
|
+
# (warapp_link_session, stored on that machine) and then talk to war.app
|
|
15
|
+
# directly without a browser (WARAPP_TRANSPORT=auto/direct). A hosted child
|
|
16
|
+
# never stores a session and never registers warapp_link_session (src/hosted.ts):
|
|
17
|
+
# it rides the direct leg only from the session captured at sign-in — the
|
|
18
|
+
# AuthToken mcp-host's authFlow (`auth.flow` below) captures into the per-user
|
|
19
|
+
# secret WARAPP_AUTH_TOKEN (#333: the war.app password is asked once and never
|
|
20
|
+
# stored; the token is held in memory) — with the bridge above as its fallback
|
|
21
|
+
# on the same registration. Without that token it is pinned to the bridge, as
|
|
22
|
+
# before. THE TRADE-OFF: once the registration carries the flow, every NEW
|
|
23
|
+
# connection needs one successful war.app password sign-in. mcp-host ends the
|
|
24
|
+
# login with no grant on any warapp_sign_in refusal — a captcha, an outage or
|
|
25
|
+
# a network fault as well as a wrong password — and may clear the fields
|
|
26
|
+
# already entered; an account with no war.app password (Facebook sign-in)
|
|
27
|
+
# cannot connect. The bridge is the fallback only for connections made before
|
|
28
|
+
# the flow was added and for a session that expires later. Adding the flow is
|
|
29
|
+
# the owner's decision (docs/PLAN-DIRECT.md, "Registration change", step 2). The flow is docs/examples/warapp-auth-flow.json (shipped in the npm
|
|
30
|
+
# package): one masked password prompt, then warapp_sign_in with WARAPP_EMAIL
|
|
31
|
+
# and that password as the capture, path authToken into WARAPP_AUTH_TOKEN.
|
|
32
|
+
# WARAPP_AUTH_TOKEN is deliberately not in `env`: a capture into a host-set
|
|
33
|
+
# variable is refused.
|
|
21
34
|
summary: >-
|
|
22
35
|
war.app (Warzone) advisor: games waiting on you, maps, scouting, chat and
|
|
23
36
|
turn plans in your war.app tab. Joining, leaving or surrendering games,
|
|
@@ -42,10 +55,11 @@ identity:
|
|
|
42
55
|
perUserChild: true
|
|
43
56
|
|
|
44
57
|
auth:
|
|
45
|
-
# Collected once on the connector's authorize page
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
58
|
+
# Collected once on the connector's authorize page: GameFeed takes the email
|
|
59
|
+
# + token on every request (form body), with no login exchange. Every auth
|
|
60
|
+
# field is stored as a per-user secret (the field schema has no separate
|
|
61
|
+
# `secret` flag). The `flow` then signs in to war.app once for the direct
|
|
62
|
+
# transport (see the header): a path inside the package, read at the pin.
|
|
49
63
|
fields:
|
|
50
64
|
- name: WARAPP_EMAIL
|
|
51
65
|
label: war.app email
|
|
@@ -60,6 +74,7 @@ auth:
|
|
|
60
74
|
Your API token, shown at https://war.app/API/GetAPIToken while signed
|
|
61
75
|
in to war.app. Stored as a per-user secret and never shown again.
|
|
62
76
|
Changing your war.app password rotates it — reconnect with the new one.
|
|
77
|
+
flow: docs/examples/warapp-auth-flow.json
|
|
63
78
|
|
|
64
79
|
# WARAPP_EMAIL / WARAPP_API_TOKEN are collected per user above, and an auth
|
|
65
80
|
# field may not name a host-set variable, so they are not in `env`. Set them in
|
|
@@ -82,7 +97,9 @@ env:
|
|
|
82
97
|
help: >-
|
|
83
98
|
How the live-game tools reach war.app on a LOCAL install: auto (default —
|
|
84
99
|
the chrome-less direct transport when a session is linked, else the
|
|
85
|
-
browser bridge), direct, or fetchproxy. A hosted child keeps the bridge
|
|
100
|
+
browser bridge), direct, or fetchproxy. A hosted child keeps the bridge
|
|
101
|
+
unless mcp-host captured a war.app session at sign-in (WARAPP_AUTH_TOKEN);
|
|
102
|
+
then it reads this as a local install does.
|
|
86
103
|
- name: WARAPP_PLAYER_RECORD
|
|
87
104
|
required: false
|
|
88
105
|
help: >-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrischall/warapp-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"mcpName": "io.github.chrischall/warapp-mcp",
|
|
5
5
|
"description": "war.app (Warzone) game advisor MCP server for Claude — games, maps, bonuses and board analysis via the GameFeed API, plus your games list, opponent scouting, the live board, territory picks, cards, turn planning and submission, turn notifications and chat through your signed-in war.app tab. Developed and maintained by AI (Claude Code).",
|
|
6
6
|
"author": "Claude Code (AI) <https://www.anthropic.com/claude>",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"server.json",
|
|
34
34
|
"manifest.json",
|
|
35
35
|
"skills",
|
|
36
|
-
"mint.yaml"
|
|
36
|
+
"mint.yaml",
|
|
37
|
+
"docs/examples/warapp-auth-flow.json"
|
|
37
38
|
],
|
|
38
39
|
"scripts": {
|
|
39
40
|
"build": "tsc && npm run bundle",
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/chrischall/warapp-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.3.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@chrischall/warapp-mcp",
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.3.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|