MCP Typescript Client Sample
April 19, 2025 ยท View on GitHub
This is a TypeScript code sample for a client that utilizes multiple MCPs. Based on mcp-use, the MCP client portion is implemented in TypeScript. Multiple MCPs can be defined in a JSON file, enabling the tool name to determine the server name for invocation.
Quick Start
- Install required packages
npm install
- Create the MCP configuration file
Configure the MCPs in
mcp_config.json. For command execution:
{
"mcpServers": {
"tool_studio": {
"command": "tool_studio",
"args": ["arg1", "arg2"]
}
}
}
For SSE:
{
"mcpServers": {
"tool_sse": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}
You can also configure multiple servers.
- Run the sample code
npx tsx mcp_client_use_sample.ts