@@ -13,6 +13,7 @@ import {
1313 Service ,
1414} from '../src/services/core/base.js' ;
1515import { GOOGLE_GMAIL } from '../src/services/google/gmail.js' ;
16+ import { NOTION_MCP } from '../src/services/notion-mcp.js' ;
1617import { RegisteredService } from '../src/services/core/registered.js' ;
1718import { ServiceRegistry } from '../src/serviceRegistry.js' ;
1819import { Config } from '../src/config.js' ;
@@ -443,5 +444,51 @@ describe('operations', () => {
443444 )
444445 ) . toThrow ( PrepareInputInvalidError ) ;
445446 } ) ;
447+
448+ it ( 'stores a token-less OAuth client id for notion-mcp (public client, no secret)' , ( ) => {
449+ const registry = new ServiceRegistry ( [ NOTION_MCP ] ) ;
450+ const store = createApiCredentialStore ( ) ;
451+
452+ const result = prepareService (
453+ registry ,
454+ store ,
455+ 'notion-mcp' ,
456+ JSON . stringify ( { clientId : 'notion-client-id' } )
457+ ) ;
458+
459+ expect ( result ) . toEqual ( { serviceName : 'notion-mcp' , credentialType : 'oauth' } ) ;
460+ const stored = store . get ( 'notion-mcp' ) ;
461+ expect ( stored ) . toBeInstanceOf ( OAuthCredentials ) ;
462+ const oauth = stored as OAuthCredentials ;
463+ expect ( oauth . clientId ) . toBe ( 'notion-client-id' ) ;
464+ expect ( oauth . clientSecret ) . toBe ( '' ) ;
465+ expect ( oauth . accessToken ) . toBeUndefined ( ) ;
466+ expect ( oauth . refreshToken ) . toBeUndefined ( ) ;
467+ } ) ;
468+
469+ it ( 'rejects a notion-mcp clientSecret (unknown key, strict schema)' , ( ) => {
470+ const registry = new ServiceRegistry ( [ NOTION_MCP ] ) ;
471+ const store = createApiCredentialStore ( ) ;
472+
473+ expect ( ( ) =>
474+ prepareService (
475+ registry ,
476+ store ,
477+ 'notion-mcp' ,
478+ JSON . stringify ( { clientId : 'a' , clientSecret : 'b' } )
479+ )
480+ ) . toThrow ( PrepareInputInvalidError ) ;
481+ expect ( store . get ( 'notion-mcp' ) ) . toBeNull ( ) ;
482+ } ) ;
483+
484+ it ( 'rejects notion-mcp input missing clientId' , ( ) => {
485+ const registry = new ServiceRegistry ( [ NOTION_MCP ] ) ;
486+ const store = createApiCredentialStore ( ) ;
487+
488+ expect ( ( ) => prepareService ( registry , store , 'notion-mcp' , '{}' ) ) . toThrow (
489+ PrepareInputInvalidError
490+ ) ;
491+ expect ( store . get ( 'notion-mcp' ) ) . toBeNull ( ) ;
492+ } ) ;
446493 } ) ;
447494} ) ;
0 commit comments