π¦
client
A typed TypeScript client for Model Context Protocol (MCP) servers
0 installs
Trust: 39 β Low
Devtools
Installation
npx @codelytv/mcp-clientAsk AI about client
Powered by Claude Β· Grounded in docs
I know everything about client. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Loading tools...
Reviews
Documentation
π MCP Client
A TypeScript test client for Model Context Protocol (MCP) servers that provides a convenient way to test MCP functionality in your test suites.
Take a look, play and have fun with this.
Stars are welcome π
β¬οΈ Installation
npm install --save-dev @codelytv/mcp-client
π» Usage
Basic Example
import { McpClient } from '@codelytv/mcp-client';
const mcpClient = new McpClient("stdio", [
"npx",
"ts-node",
"./src/app/mcp/server.ts",
]);
await mcpClient.connect();
// List available tools
const tools = await mcpClient.listTools();
console.log('Available tools:', tools.names());
// Call a tool
const response = await mcpClient.callTool('search-course-by-id', { id: 'course-123' });
// List resources
const resources = await mcpClient.listResources();
console.log('Available resources:', resources.uris());
// Read a resource
const resource = await mcpClient.readResource('courses://all');
await mcpClient.disconnect();
HTTP Transport
const mcpClient = new McpClient("http", ["http://localhost:3000/mcp"]);
π‘ API
McpClient
The main client class for interacting with MCP servers.
Constructor
new McpClient(transport: "stdio" | "http", args: string[])
Methods
connect()- Connect to the MCP serverdisconnect()- Disconnect from the MCP serverlistTools()- List available toolscallTool(name: string, args?: Record<string, unknown>)- Call a toollistResources()- List available resourcesreadResource(uri: string)- Read a resourcelistResourceTemplates()- List resource templatescompleteResourceTemplateParam(uri: string, paramName: string, textToComplete: string)- Complete resource template parameterslistPrompts()- List available promptsgetPrompt(name: string, args?: Record<string, unknown>)- Get a prompt
π Codely Code Quality Standards
Publishing this package we are committing ourselves to the following code quality standards:
- π€ Respect Semantic Versioning: No breaking changes in patch or minor versions
- π€Β No surprises in transitive dependencies: Use the bare minimum dependencies needed to meet the purpose
- π―Β One specific purpose to meet without having to carry a bunch of unnecessary other utilities
- β Β Tests as documentation and usage examples
- π Well documented ReadMe showing how to install and use
- βοΈ License favoring Open Source and collaboration
βοΈ License
See LICENSE
