@togglhq/mcp 1.6.10 → 1.6.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.
- package/build/cli.js +1 -1
- package/build/index.js +1 -1
- package/build/{src-BHKKOqzB.js → src-BIBoXw1l.js} +37 -19
- package/package.json +1 -1
package/build/cli.js
CHANGED
package/build/index.js
CHANGED
|
@@ -30738,7 +30738,7 @@ const PublicMeEntryRequestSchema = /* @__PURE__ */ object$2({
|
|
|
30738
30738
|
]))
|
|
30739
30739
|
});
|
|
30740
30740
|
//#endregion
|
|
30741
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30741
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/org/invitation/requests.mjs
|
|
30742
30742
|
async function getInvitations(httpClient, signal) {
|
|
30743
30743
|
return (await httpClient.get(`invitations`, { signal })).json();
|
|
30744
30744
|
}
|
|
@@ -30755,7 +30755,7 @@ async function resendInvitation(httpClient, organization_id, organization_user_i
|
|
|
30755
30755
|
return (await httpClient.post(`organizations/${organization_id}/invitations/${organization_user_id}/resend`, { signal })).json();
|
|
30756
30756
|
}
|
|
30757
30757
|
//#endregion
|
|
30758
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30758
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/org/utils/requests.mjs
|
|
30759
30759
|
function buildSearchParams$1(params, flattenArrays = false) {
|
|
30760
30760
|
const searchParams = new URLSearchParams();
|
|
30761
30761
|
Object.entries(params).forEach(([key, value]) => {
|
|
@@ -30767,7 +30767,7 @@ function buildSearchParams$1(params, flattenArrays = false) {
|
|
|
30767
30767
|
return searchParams;
|
|
30768
30768
|
}
|
|
30769
30769
|
//#endregion
|
|
30770
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30770
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/org/organization-user/requests.mjs
|
|
30771
30771
|
async function getOrganizationUser(httpClient, organization_id, organization_user_id, signal) {
|
|
30772
30772
|
return (await httpClient.get(`organizations/${organization_id}/users/${organization_user_id}`, { signal })).json();
|
|
30773
30773
|
}
|
|
@@ -30781,7 +30781,7 @@ async function patchOrganizationUserActive(httpClient, organization_id, organiza
|
|
|
30781
30781
|
return (await httpClient.patch(`organizations/${organization_id}/users/${organization_user_id}/active_status/${status}`, { signal })).json();
|
|
30782
30782
|
}
|
|
30783
30783
|
//#endregion
|
|
30784
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30784
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/org/workspace/requests.mjs
|
|
30785
30785
|
async function getWorkspaces(httpClient, organization_id, signal) {
|
|
30786
30786
|
return (await httpClient.get(`organizations/${organization_id}/workspaces`, { signal })).json();
|
|
30787
30787
|
}
|
|
@@ -30801,7 +30801,7 @@ const WorkingHoursUpdateInputSchema = /* @__PURE__ */ object$2({
|
|
|
30801
30801
|
});
|
|
30802
30802
|
const StatusOKSchema = /* @__PURE__ */ object$2({ status: /* @__PURE__ */ string$1() });
|
|
30803
30803
|
//#endregion
|
|
30804
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30804
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/shared-data/utils/requests.mjs
|
|
30805
30805
|
const META_SYMBOL = Symbol.for("querygen:response:meta");
|
|
30806
30806
|
function withResponseMeta(data, headers, status) {
|
|
30807
30807
|
if (!data) return data;
|
|
@@ -30828,7 +30828,7 @@ function buildSearchParams(params, flattenArrays = false) {
|
|
|
30828
30828
|
return searchParams;
|
|
30829
30829
|
}
|
|
30830
30830
|
//#endregion
|
|
30831
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30831
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/shared-data/public-holidays/requests.mjs
|
|
30832
30832
|
async function getPublicHolidays(httpClient, year, { country, organization_id } = {}, signal) {
|
|
30833
30833
|
const response = await httpClient.get(`shared_data/api/publicholidays/${year}`, {
|
|
30834
30834
|
signal,
|
|
@@ -30840,12 +30840,12 @@ async function getPublicHolidays(httpClient, year, { country, organization_id }
|
|
|
30840
30840
|
return withResponseMeta(await response.json(), response.headers, response.status);
|
|
30841
30841
|
}
|
|
30842
30842
|
//#endregion
|
|
30843
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30843
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/shared-data/status/requests.mjs
|
|
30844
30844
|
async function getStatus(httpClient, signal) {
|
|
30845
30845
|
return (await httpClient.get(`shared_data/api/status`, { signal })).json();
|
|
30846
30846
|
}
|
|
30847
30847
|
//#endregion
|
|
30848
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30848
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/org/timeoff/requests.mjs
|
|
30849
30849
|
async function timeoffListMyEntries(httpClient, organization_id, { from, to }, signal) {
|
|
30850
30850
|
return (await httpClient.get(`timeoff/organizations/${organization_id}/me`, {
|
|
30851
30851
|
signal,
|
|
@@ -30873,7 +30873,7 @@ async function timeoffDeleteMyEntry(httpClient, organization_id, id, signal) {
|
|
|
30873
30873
|
return response.json();
|
|
30874
30874
|
}
|
|
30875
30875
|
//#endregion
|
|
30876
|
-
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.
|
|
30876
|
+
//#region ../../node_modules/.pnpm/@toggl+queries@2.1.166_@tanstack+react-query@5.99.0_react@19.2.5__@toggl+sync@0.2.4_rea_b9ef901081a7cec6604674123c2e8f01/node_modules/@toggl/queries/dist/shared-data/working-hours/requests.mjs
|
|
30877
30877
|
async function getMyWorkingHours(httpClient, organization_id, signal) {
|
|
30878
30878
|
return (await httpClient.get(`shared_data/api/workinghours/${organization_id}/me`, { signal })).json();
|
|
30879
30879
|
}
|
|
@@ -31852,6 +31852,10 @@ function openAuthBrowser(url) {
|
|
|
31852
31852
|
});
|
|
31853
31853
|
}
|
|
31854
31854
|
const TOGGL_OAUTH_CLIENT_ID = "000000";
|
|
31855
|
+
/** Production accounts-be client for hosted `/focus/cli/auth-code` redirects. */
|
|
31856
|
+
const TOGGL_OAUTH_MANUAL_CLIENT_ID = "2ca88f39-18c5-4686-9101-3d3b7bd24470";
|
|
31857
|
+
/** Staging accounts-be client for hosted `/focus/cli/auth-code` redirects. */
|
|
31858
|
+
const TOGGL_OAUTH_MANUAL_STAGING_CLIENT_ID = "88972024-c0b3-46d1-8191-e48fb876434c";
|
|
31855
31859
|
const TOGGL_OAUTH_CALLBACK_PORT = 8716;
|
|
31856
31860
|
const TOGGL_OAUTH_LOGIN_TIMEOUT_MS = 12e4;
|
|
31857
31861
|
const TOGGL_OAUTH_MANUAL_CALLBACK_PATH = "/focus/cli/auth-code";
|
|
@@ -31865,6 +31869,16 @@ function togglOAuthRedirectUri(port = TOGGL_OAUTH_CALLBACK_PORT) {
|
|
|
31865
31869
|
function togglOAuthManualRedirectUri(accountsApiUrl) {
|
|
31866
31870
|
return `${accountsApiUrl.replace(/\/$/, "")}${TOGGL_OAUTH_MANUAL_CALLBACK_PATH}`;
|
|
31867
31871
|
}
|
|
31872
|
+
/**
|
|
31873
|
+
* Localhost CLI login keeps the test client (`000000`, domain `http://localhost`).
|
|
31874
|
+
* Manual/headless login uses dedicated first-party clients whose domain prefixes
|
|
31875
|
+
* match the hosted auth-code page. Do not send `000000` with a hosted redirect.
|
|
31876
|
+
*/
|
|
31877
|
+
function resolveTogglOAuthClientId(flowMode, accountsApiUrl) {
|
|
31878
|
+
if (flowMode !== "manual") return TOGGL_OAUTH_CLIENT_ID;
|
|
31879
|
+
if (accountsApiUrl.replace(/\/$/, "") === "https://accounts.toggl.space") return TOGGL_OAUTH_MANUAL_STAGING_CLIENT_ID;
|
|
31880
|
+
return TOGGL_OAUTH_MANUAL_CLIENT_ID;
|
|
31881
|
+
}
|
|
31868
31882
|
const BACKGROUND_DARK_SVG = `<svg width="1440" height="900" viewBox="0 0 1440 900" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
31869
31883
|
<g clip-path="url(#clip0_11555_363)">
|
|
31870
31884
|
<g clip-path="url(#clip1_11555_363)">
|
|
@@ -32213,12 +32227,12 @@ function waitForOAuthCallback(port = TOGGL_OAUTH_CALLBACK_PORT, timeoutMs = TOGG
|
|
|
32213
32227
|
});
|
|
32214
32228
|
});
|
|
32215
32229
|
}
|
|
32216
|
-
async function exchangeAuthorizationCode(accountsApiUrl, code, verifier, redirectUri = togglOAuthRedirectUri()) {
|
|
32230
|
+
async function exchangeAuthorizationCode(accountsApiUrl, code, verifier, redirectUri = togglOAuthRedirectUri(), clientId = TOGGL_OAUTH_CLIENT_ID) {
|
|
32217
32231
|
const params = new URLSearchParams({
|
|
32218
32232
|
grant_type: "authorization_code",
|
|
32219
32233
|
code,
|
|
32220
32234
|
code_verifier: verifier,
|
|
32221
|
-
client_id:
|
|
32235
|
+
client_id: clientId,
|
|
32222
32236
|
redirect_uri: redirectUri
|
|
32223
32237
|
});
|
|
32224
32238
|
const response = await fetch(`${accountsApiUrl}/api/oauth/token?${params}`, { method: "POST" });
|
|
@@ -32255,7 +32269,7 @@ function resolveTogglOAuthFlowMode(options) {
|
|
|
32255
32269
|
}
|
|
32256
32270
|
function buildTogglOAuthAuthorizationUrl(options) {
|
|
32257
32271
|
return `${options.accountsApiUrl.replace(/\/$/, "")}/focus/login/?${new URLSearchParams({
|
|
32258
|
-
client_id:
|
|
32272
|
+
client_id: resolveTogglOAuthClientId(options.flowMode, options.accountsApiUrl),
|
|
32259
32273
|
code_challenge: options.codeChallenge,
|
|
32260
32274
|
code_challenge_method: "S256",
|
|
32261
32275
|
redirect_uri: options.redirectUri,
|
|
@@ -32271,6 +32285,7 @@ async function obtainTogglOAuthAuthorizationCode(options) {
|
|
|
32271
32285
|
authorizationCode: options.authorizationCode
|
|
32272
32286
|
});
|
|
32273
32287
|
const redirectUri = resolveTogglOAuthRedirectUri(options.accountsApiUrl, flowMode);
|
|
32288
|
+
const clientId = resolveTogglOAuthClientId(flowMode, options.accountsApiUrl);
|
|
32274
32289
|
const { verifier, challenge } = generateOAuthPKCE();
|
|
32275
32290
|
const authUrl = buildTogglOAuthAuthorizationUrl({
|
|
32276
32291
|
accountsApiUrl: options.accountsApiUrl,
|
|
@@ -32308,6 +32323,7 @@ async function obtainTogglOAuthAuthorizationCode(options) {
|
|
|
32308
32323
|
code,
|
|
32309
32324
|
verifier,
|
|
32310
32325
|
redirectUri,
|
|
32326
|
+
clientId,
|
|
32311
32327
|
flowMode
|
|
32312
32328
|
};
|
|
32313
32329
|
}
|
|
@@ -32374,11 +32390,11 @@ const PUBLIC_MCP_PACKAGE_NAME = "@togglhq/mcp";
|
|
|
32374
32390
|
function npxMcpAuthCommand() {
|
|
32375
32391
|
return `npx ${PUBLIC_MCP_PACKAGE_NAME} auth`;
|
|
32376
32392
|
}
|
|
32377
|
-
async function refreshTokens(accountsApiUrl, refreshToken) {
|
|
32393
|
+
async function refreshTokens(accountsApiUrl, refreshToken, clientId = TOGGL_OAUTH_CLIENT_ID) {
|
|
32378
32394
|
const params = new URLSearchParams({
|
|
32379
32395
|
grant_type: "refresh_token",
|
|
32380
32396
|
refresh_token: refreshToken,
|
|
32381
|
-
client_id:
|
|
32397
|
+
client_id: clientId
|
|
32382
32398
|
});
|
|
32383
32399
|
const response = await fetch(`${accountsApiUrl}/api/oauth/token?${params}`, { method: "POST" });
|
|
32384
32400
|
if (!response.ok) {
|
|
@@ -32392,7 +32408,7 @@ async function getValidToken$1(scope = "cli", profile) {
|
|
|
32392
32408
|
if (!authConfig) throw new Error(scope === "cli" ? "Not authenticated. Run `toggl auth` to sign in." : `Not authenticated. Run \`${npxMcpAuthCommand()}\` to sign in.`);
|
|
32393
32409
|
const now = Date.now() / 1e3;
|
|
32394
32410
|
if (authConfig.expires_at > now + 60) return authConfig.access_token;
|
|
32395
|
-
const tokens = await refreshTokens(authConfig.accounts_api_url, authConfig.refresh_token);
|
|
32411
|
+
const tokens = await refreshTokens(authConfig.accounts_api_url, authConfig.refresh_token, authConfig.oauth_client_id ?? "000000");
|
|
32396
32412
|
authConfig.access_token = tokens.access_token;
|
|
32397
32413
|
authConfig.refresh_token = tokens.refresh_token;
|
|
32398
32414
|
authConfig.expires_at = now + tokens.expires_in;
|
|
@@ -32485,7 +32501,7 @@ async function runAuthFlow(accountsApiUrl = "https://accounts.toggl.com", focusA
|
|
|
32485
32501
|
log("Continuing MCP authentication with existing session...\n");
|
|
32486
32502
|
} else {
|
|
32487
32503
|
log("Toggl 2.0 MCP — Authentication\n");
|
|
32488
|
-
const { code, verifier, redirectUri } = await obtainTogglOAuthAuthorizationCode({
|
|
32504
|
+
const { code, verifier, redirectUri, clientId } = await obtainTogglOAuthAuthorizationCode({
|
|
32489
32505
|
accountsApiUrl,
|
|
32490
32506
|
flowMode: options.oauthFlowMode ?? (options.manualPrompt ? "manual" : "local"),
|
|
32491
32507
|
authorizationCode: options.authorizationCode,
|
|
@@ -32493,7 +32509,7 @@ async function runAuthFlow(accountsApiUrl = "https://accounts.toggl.com", focusA
|
|
|
32493
32509
|
log
|
|
32494
32510
|
});
|
|
32495
32511
|
log("Exchanging authorization code...");
|
|
32496
|
-
const tokens = await exchangeAuthorizationCode(accountsApiUrl, code, verifier, redirectUri);
|
|
32512
|
+
const tokens = await exchangeAuthorizationCode(accountsApiUrl, code, verifier, redirectUri, clientId);
|
|
32497
32513
|
log("Fetching account info...");
|
|
32498
32514
|
const user = await fetchAccountsApiMe(accountsApiUrl, tokens.access_token);
|
|
32499
32515
|
if (!user.user_account_id) throw new Error("Could not determine user ID from API response.");
|
|
@@ -32506,6 +32522,7 @@ async function runAuthFlow(accountsApiUrl = "https://accounts.toggl.com", focusA
|
|
|
32506
32522
|
accounts_api_url: accountsApiUrl,
|
|
32507
32523
|
focus_api_url: focusApiUrl,
|
|
32508
32524
|
authenticated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32525
|
+
oauth_client_id: clientId,
|
|
32509
32526
|
workspaces,
|
|
32510
32527
|
default_workspace_id: user.default_workspace_id
|
|
32511
32528
|
};
|
|
@@ -32534,6 +32551,7 @@ async function runAuthFlow(accountsApiUrl = "https://accounts.toggl.com", focusA
|
|
|
32534
32551
|
focus_api_url: pendingContext.focus_api_url,
|
|
32535
32552
|
accounts_api_url: pendingContext.accounts_api_url,
|
|
32536
32553
|
authenticated_at: pendingContext.authenticated_at,
|
|
32554
|
+
oauth_client_id: pendingContext.oauth_client_id,
|
|
32537
32555
|
workspaces
|
|
32538
32556
|
};
|
|
32539
32557
|
saveConfig(config);
|
|
@@ -44939,7 +44957,7 @@ import_main.default.config({
|
|
|
44939
44957
|
quiet: true,
|
|
44940
44958
|
ignore: ["MISSING_ENV_FILE"]
|
|
44941
44959
|
});
|
|
44942
|
-
const packageVersion = "1.6.
|
|
44960
|
+
const packageVersion = "1.6.12";
|
|
44943
44961
|
function resolvePublicUrls() {
|
|
44944
44962
|
return {
|
|
44945
44963
|
focusApiUrl: process.env.TOGGL_FOCUS_API_URL ?? "https://focus.toggl.com",
|
|
@@ -45004,4 +45022,4 @@ function bootstrapServer(options = {}) {
|
|
|
45004
45022
|
//#endregion
|
|
45005
45023
|
export { runMcpCli as n, bootstrapServer as t };
|
|
45006
45024
|
|
|
45007
|
-
//# sourceMappingURL=src-
|
|
45025
|
+
//# sourceMappingURL=src-BIBoXw1l.js.map
|