Example MCP Server + Client Implementation
LocalAbout Example MCP Server + Client Implementation
This is a demo implementation of an MCP server and a basic client, showing how a backend API can be exposed to AI applications through MCP. It has three parts: a service, an MCP server and a simple OpenAI-based chatbot client. It suits developers who want to learn the basic structure of an MCP setup.
Key features
- 01Three parts: service, MCP server and client
- 02MCP server wrapping an example API
- 03Simple AI chatbot client included
- 04Runs TypeScript directly on Node.js
Use cases
- 01Learning how MCP servers and clients are structured
- 02Storing and retrieving custom information through the chatbot
- 03Using the project as a reference for building an MCP setup
MCP support
The project includes an MCP server that exposes an example backend API to MCP clients, along with an example client that connects to it.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEExample MCP Server + Client Implementation
I wrote an article and created a video about MCPs and why they're useful in my opinion.
This demo project contains a backend service / API that's consumed by a MCP server which exposes it in a standardized way to MCP clients - like the example MCP client (a very simple AI chatbot) that's also part of this project.
Important: All three parts (service, server, client) rely on Node.js being able to execute TypeScript without a compilation step. Yes, modern Node.js can do that! Make sure you have Node.js 23.x or higher installed!
Configuration
Add a .env file inside the client folder (next to the package.json file there) and add the following content to it:
OPENAI_API_KEY=<your-open-ai-key>
In each folder (service, server, client) run npm install to install required dependencies.
Running Service, MCP Server & MCP Client
For each part, navigate into the respective folder (service, server and client) and run npm run dev (with Node.js 23+). Keep each process running.
The "client" process is a simply AI chatbot using OpenAI behind the scenes. This chatbot has the custom MCP server "installed" - therefore, this AI chat application is able to store and retrieve custom information via the backend service created in the "service" folder.
Bugs are possible - it's just a basic demo implementation :-)
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.