@cronicorn/mcp-server 1.5.7 → 1.5.9

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.
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: Troubleshooting Authentication
3
+ description: How to resolve authentication issues with the Cronicorn MCP Server
4
+ mcp:
5
+ uri: "cronicorn://troubleshooting/authentication"
6
+ priority: 10
7
+ tags: [user, assistant]
8
+ ---
9
+
10
+ # Troubleshooting Authentication
11
+
12
+ ## Authentication Failed (401 Unauthorized)
13
+
14
+ If you see this error:
15
+ ```
16
+ Authentication failed. Invalid or expired token. Please restart the MCP server to re-authenticate.
17
+ ```
18
+
19
+ **What happened:**
20
+ - Your authentication token is no longer valid
21
+ - The MCP server has automatically cleared the invalid credentials
22
+
23
+ **How to fix:**
24
+
25
+ 1. **Restart your editor/IDE:**
26
+ - **VS Code**: Reload the window (`Cmd+Shift+P` → "Developer: Reload Window")
27
+ - **Other editors**: Restart the application
28
+
29
+ 2. **Complete the device flow:**
30
+ - A browser window will automatically open
31
+ - Sign in with your GitHub account
32
+ - Approve the device authorization request
33
+ - The MCP server will save the new credentials
34
+
35
+ 3. **Try your operation again**
36
+
37
+ ## Token Expired
38
+
39
+ If you see messages about an expired token during startup, don't worry! The MCP server automatically:
40
+ 1. Detects the expired token
41
+ 2. Deletes the invalid credentials
42
+ 3. Starts a new device authorization flow
43
+
44
+ Just complete the browser-based approval and you're good to go.
45
+
46
+ ## Manual Credential Reset
47
+
48
+ If you need to manually reset your credentials:
49
+
50
+ ```bash
51
+ # Delete the credentials file
52
+ rm ~/.cronicorn/credentials.json
53
+
54
+ # Restart your editor/IDE
55
+ ```
56
+
57
+ ## Where Are Credentials Stored?
58
+
59
+ Credentials are stored in: `~/.cronicorn/credentials.json`
60
+
61
+ This file contains:
62
+ - `access_token`: Your authentication token
63
+ - `refresh_token`: Token for refreshing (currently not used)
64
+ - `expires_at`: Unix timestamp when the token expires
65
+
66
+ The file has restricted permissions (0600) so only you can read it.
67
+
68
+ ## Common Issues
69
+
70
+ ### Browser Doesn't Open Automatically
71
+ - Manually navigate to the verification URL shown in the server logs
72
+ - Enter the user code displayed
73
+
74
+ ### Device Code Expired
75
+ - You have 30 minutes to approve the device
76
+ - If it expires, just restart the MCP server to get a new code
77
+
78
+ ### Still Having Issues?
79
+ - Check that the Cronicorn API is accessible
80
+ - Verify your internet connection
81
+ - Look for error messages in the MCP server logs (stderr)
82
+ - Report issues on [GitHub Discussions](https://github.com/weskerllc/cronicorn/discussions)
package/dist/index.js CHANGED
@@ -545,6 +545,17 @@ async function saveCredentials(credentials) {
545
545
  throw new Error(`Failed to save credentials: ${message}`);
546
546
  }
547
547
  }
548
+ async function deleteCredentials() {
549
+ try {
550
+ await fs6.unlink(CREDENTIALS_FILE);
551
+ console.error("\u2705 Credentials deleted");
552
+ } catch (error) {
553
+ if (error && typeof error === "object" && "code" in error && error.code !== "ENOENT") {
554
+ const message = error instanceof Error ? error.message : String(error);
555
+ throw new Error(`Failed to delete credentials: ${message}`);
556
+ }
557
+ }
558
+ }
548
559
  function isTokenExpired(credentials) {
549
560
  const BUFFER_MS = 5 * 60 * 1e3;
550
561
  return Date.now() + BUFFER_MS >= credentials.expires_at;
@@ -4828,6 +4839,14 @@ function createHttpApiClient(config) {
4828
4839
  const response = await fetch(url, { ...options, headers });
4829
4840
  if (!response.ok) {
4830
4841
  const errorText = await response.text();
4842
+ if (response.status === 401) {
4843
+ console.error("\u26A0\uFE0F Token is invalid (401 Unauthorized). Clearing credentials...");
4844
+ await deleteCredentials();
4845
+ throw new ApiError(
4846
+ 401,
4847
+ `Authentication failed. Invalid or expired token. Please restart the MCP server to re-authenticate.`
4848
+ );
4849
+ }
4831
4850
  throw new ApiError(
4832
4851
  response.status,
4833
4852
  `API Error (${response.status}): ${errorText}`
@@ -5696,7 +5715,8 @@ async function main() {
5696
5715
  if (credentials && isTokenExpired(credentials)) {
5697
5716
  const expiresAtDate = new Date(credentials.expires_at);
5698
5717
  console.error(`\u26A0\uFE0F Token expired at ${expiresAtDate.toISOString()}`);
5699
- console.error("Starting re-authentication...");
5718
+ console.error("Clearing expired credentials and starting re-authentication...");
5719
+ await deleteCredentials();
5700
5720
  } else {
5701
5721
  console.error("No credentials found. Starting OAuth device authorization...");
5702
5722
  }