命令行工具客户端

一个TypeScript命令行客户端,通过标准输入/输出连接到JavaScript或Python MCP服务器,发现工具,并让OpenAI模型交互式选择和调用这些工具。

  • by aihamjassar
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 AihamJassar/mcp-client

使用说明

MCP Client CLI

A TypeScript command-line client that connects to JavaScript or Python MCP servers over standard input/output, discovers tools, and lets an OpenAI model select and invoke those tools interactively.

Overview

This repository contains the source and supporting files for MCP Client CLI. The documentation below was prepared from the current repository structure and implementation files so that setup expectations, project boundaries, and implemented capabilities are explicit.

Technology

Area Implementation
Runtime Node.js with TypeScript
Protocol Model Context Protocol client over stdio
Model integration OpenAI chat completions with discovered tool schemas
Interaction Terminal-based query loop

Key capabilities

Area Current implementation
Tool discovery Lists server tools and converts their schemas for model tool calling.
Language-aware launching Starts JavaScript servers with Node.js and Python servers with Python 3.
Interactive querying Runs a terminal chat loop until the user enters quit.

Getting started

Use the following workflow to work with the project locally.

git clone https://github.com/aihamjassar/mcp-client.git
cd mcp-client
npm install
# Set OPENAI_API_KEY in a local .env file
npm run build
node build/index.js path/to/mcp-server.js
# Or provide a Python server script path instead

Project structure

Path Purpose
src/index.ts Server connection, tool discovery, model tool-calling loop, and terminal chat interface
package.json Build command and runtime dependencies
tsconfig.json TypeScript compiler configuration

Configuration notes

Set OPENAI_API_KEY through a local environment file or secure secret manager. Inspect and trust the MCP server command before connecting, because the client starts the server as a local process.

License

No license file is currently included. Confirm the intended licensing terms with the repository owner before reuse or distribution.

Maintainer

Maintained by Aiham Jassar. Contributions, issue reports, and improvement suggestions are welcome through the repository.