Pieter1821/MCP-Server-and-Client
3.2
If you are the rightful owner of MCP-Server-and-Client and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Node.js project implementing a Model Context Protocol (MCP) server and client for resource and tool management, user data handling, and prompt-based operations.
MCP Server and Client
A Node.js project implementing a Model Context Protocol (MCP) server and client for resource and tool management, user data handling, and prompt-based operations.
Features
- Interactive CLI for Model Context Protocol (MCP) server
- Tool execution with dynamic input prompts
- Resource and resource template reading with parameter substitution
- Prompt selection and execution
- Integrated Google Gemini API for text generation
Prerequisites
Installation
-
Clone the repository:
git clone https://github.com/<your-username>/<your-repo-name>.git cd <your-repo-name>
-
Install dependencies:
npm install
The following packages will be installed:
- @inquirer/prompts
- @modelcontextprotocol/sdk
- dotenv
- zod
- @modelcontextprotocol/inspector (dev)
- @types/node (dev)
- ts-node (dev)
- tsx (dev)
- typescript (dev)
-
Build the server:
npm run server:build
Usage
- Install dependencies and set up your
.env
file withGEMINI_API_KEY
. - Run the client:
npm run build node build/client.js
- Follow the CLI prompts to interact with tools, resources, and prompts.
Run the server (development)
npm run server:dev
Run the client
- The client connects to the server using the built files.
- You can run the client code in
src/client/client.ts
(TypeScript) or use the built JS inbuild/client/client.js
.
Scripts
npm run server:build
ā Compile TypeScript to JavaScriptnpm run server:build:watch
ā Watch and compile on changesnpm run server:dev
ā Run the server in development modenpm run server:inspect
ā Run the server with MCP Inspector
Project Structure
āāā build/
ā āāā server.js
ā āāā client/
ā āāā client.js
ā āāā data/
ā āāā users.json
āāā src/
ā āāā server.ts
ā āāā client/
ā āāā client.ts
ā āāā data/
ā āāā users.json
āāā package.json
āāā tsconfig.json
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/my-feature
) - Create a new Pull Request
License
This project is licensed under the ISC License.
Contact
For questions or support, open an issue on GitHub.