Integrations
Manages environment configuration for the MCP server through .env files
Handles HTTP endpoints for server-sent events (SSE) and message communication in the MCP server
Used for version control and cloning the repository to set up the MCP server
Hello World MCP Server
Welcome to the Hello World MCP Server! This project demonstrates how to set up a server using the Model Context Protocol (MCP) SDK. It includes tools, prompts, and endpoints for handling server-sent events (SSE) and messages.
This project is part of the blog post: Building a TypeScript MCP Server: A Guide for Integrating Existing Services. Visit the blog to learn more about the concepts and implementation details behind this project.
Features
- MCP Integration: Uses the MCP SDK to create a server with tools and prompts.
- Express Framework: Handles HTTP endpoints for SSE and message communication.
- Environment Configuration: Uses
.env
files for easy configuration. - TypeScript Support: Fully typed codebase for better developer experience.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher) - Download here
- npm (comes with Node.js) or yarn
Getting Started
Follow these steps to set up and run the project:
1. Clone the Repository
If you haven't already, clone the repository to your local machine:
2. Install Dependencies
Install the required dependencies using npm or yarn:
or
3. Configure Environment Variables
The project uses a .env
file to configure the server's port. A sample .env.example
file is provided.
- Copy the
.env.example
file to.env
:Copy - Open the
.env
file and update thePORT
variable if needed. The default is4000
.Copy
4. Build the Project
Compile the TypeScript code into JavaScript:
This will generate the compiled files in the dist
directory.
5. Run the Server
Start the server in production mode:
Alternatively, for development mode with live reloading, use:
Testing the Server
1. Using the MCP Inspector
The MCP Inspector is a tool to test and inspect your MCP server. You can use it to verify that your tools and prompts are registered correctly.
Run the following command to inspect your server:
This will open an interactive interface where you can test the tools and prompts registered in your server like below.
Project Structure
Here’s an overview of the project structure:
Troubleshooting
Common Issues
- Port Already in Use: If you see an error about the port being in use, update the
PORT
variable in the.env
file. - TypeScript Errors: Ensure you’ve installed all dependencies and are using the correct Node.js version.
Debugging
Use the following command to debug the server:
This will start the server with live reloading and detailed logs.
Related Projects
- Ollama Pydantic Project: A counter project implementing an LLM agent that utilizes the tools developed in this project. Learn more about it in the blog post: Integrating MCP Server with a Local LLM Chatbot.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License. See the LICENSE file for details.
This server cannot be installed
A demonstration server that implements the Model Context Protocol (MCP) SDK, providing tools and endpoints for server-sent events and message handling.
Related MCP Servers
- AsecurityAlicenseAqualityA beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.Last updated -3936JavaScriptApache 2.0
- -securityAlicense-qualityMCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.Last updated -43TypeScriptMIT License
- -securityAlicense-qualityMCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.Last updated -132TypeScriptMIT License
- -security-license-qualityA specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.Last updated -1TypeScript