init project
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
||||
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
|
||||
import { createServer } from '../server.js';
|
||||
|
||||
export async function createInMemoryClient(): Promise<Client> {
|
||||
const mcpServer = createServer();
|
||||
const [serverTransport, clientTransport] = InMemoryTransport.createLinkedPair();
|
||||
|
||||
const client = new Client({ name: 'test-client', version: '0.0.1' });
|
||||
|
||||
await Promise.all([mcpServer.connect(serverTransport), client.connect(clientTransport)]);
|
||||
|
||||
return client;
|
||||
}
|
||||
Reference in New Issue
Block a user