MCP OAuth Part 2 - MCP Client Integration (#4318)

Co-authored-by: Greg Shikhman <shikhman@google.com>
This commit is contained in:
Brian Ray
2025-07-22 09:34:56 -04:00
committed by GitHub
parent 138ff73821
commit 258c848909
7 changed files with 689 additions and 28 deletions

View File

@@ -20,6 +20,8 @@ import * as GenAiLib from '@google/genai';
vi.mock('@modelcontextprotocol/sdk/client/stdio.js');
vi.mock('@modelcontextprotocol/sdk/client/index.js');
vi.mock('@google/genai');
vi.mock('../mcp/oauth-provider.js');
vi.mock('../mcp/oauth-token-storage.js');
describe('mcp-client', () => {
afterEach(() => {
@@ -82,7 +84,7 @@ describe('mcp-client', () => {
describe('should connect via httpUrl', () => {
it('without headers', async () => {
const transport = createTransport(
const transport = await createTransport(
'test-server',
{
httpUrl: 'http://test-server',
@@ -96,7 +98,7 @@ describe('mcp-client', () => {
});
it('with headers', async () => {
const transport = createTransport(
const transport = await createTransport(
'test-server',
{
httpUrl: 'http://test-server',
@@ -117,7 +119,7 @@ describe('mcp-client', () => {
describe('should connect via url', () => {
it('without headers', async () => {
const transport = createTransport(
const transport = await createTransport(
'test-server',
{
url: 'http://test-server',
@@ -130,7 +132,7 @@ describe('mcp-client', () => {
});
it('with headers', async () => {
const transport = createTransport(
const transport = await createTransport(
'test-server',
{
url: 'http://test-server',
@@ -149,10 +151,10 @@ describe('mcp-client', () => {
});
});
it('should connect via command', () => {
it('should connect via command', async () => {
const mockedTransport = vi.mocked(SdkClientStdioLib.StdioClientTransport);
createTransport(
await createTransport(
'test-server',
{
command: 'test-command',