@@ -529,6 +529,59 @@ Body`);
529529 } ) ;
530530 } ) ;
531531
532+ it ( 'should convert mcp_servers with auth block in local agent (oauth with full fields)' , ( ) => {
533+ const markdown = {
534+ kind : 'local' as const ,
535+ name : 'oauth-test-agent' ,
536+ description : 'An agent to test OAuth MCP with full fields' ,
537+ mcp_servers : {
538+ 'test-server' : {
539+ url : 'https://api.example.com/mcp' ,
540+ type : 'http' as const ,
541+ auth : {
542+ type : 'oauth' as const ,
543+ client_id : 'my-client-id' ,
544+ client_secret : 'my-client-secret' ,
545+ scopes : [ 'read' , 'write' ] ,
546+ authorization_url : 'https://auth.example.com/authorize' ,
547+ token_url : 'https://auth.example.com/token' ,
548+ issuer : 'https://auth.example.com' ,
549+ audiences : [ 'audience1' ] ,
550+ redirect_uri : 'http://localhost:8080/callback' ,
551+ token_param_name : 'access_token' ,
552+ registration_url : 'https://auth.example.com/register' ,
553+ } ,
554+ timeout : 30000 ,
555+ } ,
556+ } ,
557+ system_prompt : 'You are a test agent.' ,
558+ } ;
559+
560+ const result = markdownToAgentDefinition (
561+ markdown ,
562+ ) as LocalAgentDefinition ;
563+ expect ( result . kind ) . toBe ( 'local' ) ;
564+ expect ( result . mcpServers ) . toBeDefined ( ) ;
565+ expect ( result . mcpServers ! [ 'test-server' ] ) . toMatchObject ( {
566+ url : 'https://api.example.com/mcp' ,
567+ type : 'http' ,
568+ oauth : {
569+ enabled : true ,
570+ clientId : 'my-client-id' ,
571+ clientSecret : 'my-client-secret' ,
572+ scopes : [ 'read' , 'write' ] ,
573+ authorizationUrl : 'https://auth.example.com/authorize' ,
574+ tokenUrl : 'https://auth.example.com/token' ,
575+ issuer : 'https://auth.example.com' ,
576+ audiences : [ 'audience1' ] ,
577+ redirectUri : 'http://localhost:8080/callback' ,
578+ tokenParamName : 'access_token' ,
579+ registrationUrl : 'https://auth.example.com/register' ,
580+ } ,
581+ timeout : 30000 ,
582+ } ) ;
583+ } ) ;
584+
532585 it ( 'should pass through unknown model names (e.g. auto)' , ( ) => {
533586 const markdown = {
534587 kind : 'local' as const ,
@@ -886,6 +939,12 @@ auth:
886939 - profile
887940 authorization_url: https://auth.example.com/authorize
888941 token_url: https://auth.example.com/token
942+ issuer: https://auth.example.com
943+ audiences:
944+ - audience1
945+ redirect_uri: http://localhost:8080/callback
946+ token_param_name: access_token
947+ registration_url: https://auth.example.com/register
889948---
890949` ) ;
891950 const result = await parseAgentMarkdown ( filePath ) ;
@@ -900,6 +959,11 @@ auth:
900959 scopes : [ 'openid' , 'profile' ] ,
901960 authorization_url : 'https://auth.example.com/authorize' ,
902961 token_url : 'https://auth.example.com/token' ,
962+ issuer : 'https://auth.example.com' ,
963+ audiences : [ 'audience1' ] ,
964+ redirect_uri : 'http://localhost:8080/callback' ,
965+ token_param_name : 'access_token' ,
966+ registration_url : 'https://auth.example.com/register' ,
903967 } ,
904968 } ) ;
905969 } ) ;
0 commit comments