Skip to main content
Glama
JWT_TOKEN_ENCODING_ISSUE.mdโ€ข5.4 kB
# JWT Token Encoding Issue - Troubleshooting Guide **Issue ID**: JWT-ENCODING-001 **Date Identified**: June 10, 2025 **Severity**: High (Blocks Browser Automation) **Status**: Resolved ## ๐Ÿ› Problem Description ### Symptoms - Browser automation fails with authentication errors - MCP server generates URLs that don't work with Composer - JWT token authentication rejected by EuConquisto Composer ### Root Cause Character encoding corruption in JWT token at position 660: - **Incorrect**: `_8xsw2oLD` - **Correct**: `_xsw2oLD` The extra "8" character in the JWT token breaks authentication with the EuConquisto Composer API. ## ๐Ÿ” Technical Analysis ### Affected Files 1. `src/index.ts` - Line ~93 (get-composer-url tool) 2. `src/lib/composition-lifecycle.ts` - Line ~26 (ComposerClient class) ### Impact - โŒ Browser automation fails to authenticate - โŒ `complete-composition-workflow` tool non-functional - โŒ All composition lifecycle tools blocked - โœ… Basic MCP tools (test-connection, get-widget-info) still work ### Detection Method Compare working URL with MCP-generated URL: ``` Working URL: .../_xsw2oLD/... MCP URL: .../_8xsw2oLD/... ^ Extra "8" character ``` ## ๐Ÿ›  Applied Fix ### Step 1: Identify Source vs Compiled Issue **Critical Discovery**: Previous fixes were applied to source files but compilation wasn't rebuilding properly. **Verification Commands**: ```bash # Check source file (should have correct token) grep "_xsw2oLD" src/index.ts grep "_xsw2oLD" src/lib/composition-lifecycle.ts # Check compiled file (may have old incorrect token) grep "_8xsw2oLD" dist/index.js grep "_8xsw2oLD" dist/lib/composition-lifecycle.js ``` ### Step 2: Root Cause Analysis 1. โœ… Source files contained correct fix 2. โŒ Compiled `dist/` files still had incorrect token 3. โŒ Build process wasn't picking up source changes 4. โŒ Claude Desktop was running old compiled code ### Step 3: Complete Fix Process ```bash # 1. Verify source files have correct token cd /Users/ricardokawasaki/Desktop/euconquisto-composer-mcp-poc # 2. Rebuild project to update dist/ files npm run build # 3. Verify compiled files now have correct token grep "_xsw2oLD" dist/index.js grep "_xsw2oLD" dist/lib/composition-lifecycle.js # 4. Restart Claude Desktop to reload MCP server # (Manual step via GUI) ``` ## ๐Ÿ”„ Why Previous Fix Failed ### Failed Approach 1: Source-Only Fix - โœ… Applied correct token to `src/index.ts` and `src/lib/composition-lifecycle.ts` - โŒ Forgot to rebuild project (`npm run build`) - โŒ Claude Desktop continued using old `dist/index.js` with incorrect token ### Failed Approach 2: Assumed Build Was Current - โŒ Assumed TypeScript compilation was automatic - โŒ Didn't verify `dist/` files were updated - โŒ Didn't check file modification timestamps ### Successful Approach 3: Complete Workflow - โœ… Verified source files have correct token - โœ… Forced rebuild with `npm run build` - โœ… Verified compiled files now have correct token - โœ… Documented requirement for Claude Desktop restart ## ๐Ÿ“‹ Prevention Checklist ### For JWT Token Updates - [ ] Update source files (`src/index.ts` and `src/lib/composition-lifecycle.ts`) - [ ] Rebuild project (`npm run build`) - [ ] Verify compiled files in `dist/` directory - [ ] Check file modification timestamps - [ ] Restart Claude Desktop to reload MCP server - [ ] Test authentication with actual Composer URL ### For All MCP Server Changes ```bash # Development workflow npm run build # Compile TypeScript npm run mcp:validate # Test MCP functionality # Restart Claude Desktop # Reload server # Test via Claude chat # Verify integration ``` ## ๐Ÿงช Verification Tests ### Test 1: URL Generation ```javascript // Call get-composer-url tool // Verify response contains "_xsw2oLD" not "_8xsw2oLD" ``` ### Test 2: Browser Authentication ```javascript // Call complete-composition-workflow tool // Should authenticate successfully, not fail with auth error ``` ### Test 3: Token Consistency ```bash # Verify both source and compiled files have same token diff <(grep "jwtToken" src/index.ts) <(grep "jwtToken" dist/index.js) diff <(grep "jwtToken" src/lib/composition-lifecycle.ts) <(grep "jwtToken" dist/lib/composition-lifecycle.js) ``` ## ๐Ÿ“ Lessons Learned 1. **Always rebuild after source changes**: TypeScript compilation is not automatic 2. **Verify compiled output**: Source fixes don't matter if `dist/` files aren't updated 3. **Check file timestamps**: Confirm build actually regenerated files 4. **Test end-to-end**: Source code correctness โ‰  runtime functionality 5. **Document build dependencies**: MCP server changes require full rebuild + restart cycle ## ๐Ÿ”— Related Documentation - [Build Process](../development/BUILD_PROCESS.md) - [Claude Desktop Integration](../integration/claude-desktop-setup.md) - [MCP Server Development](../development/MCP_SERVER_DEVELOPMENT.md) - [Browser Automation Troubleshooting](./BROWSER_AUTOMATION_TROUBLESHOOTING.md) ## ๐Ÿ“ž Contact For questions about this issue or similar JWT authentication problems: - **Project**: EuConquisto Composer MCP Server - **Version**: 0.1.6 - **Team**: EuConquisto Development Team --- **Issue Resolution**: โœ… RESOLVED **Last Updated**: June 10, 2025 **Verified By**: MCP Testing Session **Status**: Production Ready

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rkm097git/euconquisto-composer-mcp-poc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server