fsalviati/MCP-server
3.1
If you are the rightful owner of MCP-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This repository provides a simple setup for a Model Context Protocol (MCP) server and client, demonstrating tool registration and interaction using TypeScript and OpenAI's API.
MCP Server & Client Example
This repository demonstrates a simple Model Context Protocol (MCP) setup with:
- a TypeScript–based MCP server that registers tools (e.g.
create-user) - a companion client that launches the server via stdio, lists available tools/prompts/resources, and lets you interact with them
- integration with OpenAI’s Chat Completions API for natural‑language handling
ℹ️ By default this example uses OpenAI (GPT‑3.5‑turbo). You can swap in any other AI provider—just update the import/provider call in
src/client.ts.
Features
- Server (
src/server.ts)- Registers one or more “tools” via
server.registerTool(...) - Exposes them over JSON‑RPC (stdio transport) for clients to call
- Registers one or more “tools” via
- Client (
src/client.ts)- Spawns your TypeScript server via
npx tsx src/server.ts - Lists tools, resources, prompts from the server
- Lets you “Query” with free text: automatically calls OpenAI + MCP tools
- Handles tool calls and prints back results in your terminal
- Spawns your TypeScript server via
Getting Started
Prerequisites
- Node.js ≥ 18
- npm or yarn
Installation
git clone https://github.com/your‑username/mcp-server-and-client.git
cd mcp-server-and-client
npm install
# or
yarn install