File tree Expand file tree Collapse file tree
core/src/mcp/token-storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -552,8 +552,9 @@ export function loadEnvironment(
552552 continue ;
553553 }
554554
555- // Load variable only if it's not already set in the environment.
556- if ( ! Object . hasOwn ( process . env , key ) ) {
555+ // Load variable. In Termux, we allow overriding to ensure .env settings are respected.
556+ const isTermux = process . env [ 'TERMUX_VERSION' ] !== undefined ;
557+ if ( ! Object . hasOwn ( process . env , key ) || isTermux ) {
557558 process . env [ key ] = value ;
558559 }
559560 }
Original file line number Diff line number Diff line change @@ -257,6 +257,16 @@ export const copyToClipboard = async (text: string): Promise<void> => {
257257 }
258258
259259 // Local / non-TTY fallback
260+ const isTermux = process . env [ 'TERMUX_VERSION' ] !== undefined ;
261+ if ( isTermux ) {
262+ try {
263+ const { execSync } = await import ( 'node:child_process' ) ;
264+ execSync ( 'termux-clipboard-set' , { input : text } ) ;
265+ return ;
266+ } catch ( e ) {
267+ debugLogger . warn ( 'Failed to use termux-clipboard-set:' , e ) ;
268+ }
269+ }
260270 await clipboardy . write ( text ) ;
261271} ;
262272
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ export class HybridTokenStorage extends BaseTokenStorage {
2121 }
2222
2323 private async initializeStorage ( ) : Promise < TokenStorage > {
24- const forceFileStorage = process . env [ FORCE_FILE_STORAGE_ENV_VAR ] === 'true' ;
24+ const isTermux = process . env [ 'TERMUX_VERSION' ] !== undefined ;
25+ const forceFileStorage =
26+ process . env [ FORCE_FILE_STORAGE_ENV_VAR ] === 'true' || isTermux ;
2527
2628 if ( ! forceFileStorage ) {
2729 try {
You can’t perform that action at this time.
0 commit comments