MCP cover image
See in Github
2025-04-06

用打字稿删除简单的MCP服务器。

1

Github Watches

0

Github Forks

0

Github Stars

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.


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:

  1. Node.js (v16 or higher) - Download here
  2. 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:

git clone https://github.com/your-username/hello-world-mcp-server.git
cd hello-world-mcp-server

2. Install Dependencies

Install the required dependencies using npm or yarn:

npm install

or

yarn install

3. Configure Environment Variables

The project uses a .env file to configure the server's port. A sample .env.example file is provided.

  1. Copy the .env.example file to .env:

    cp .env.example .env
    
  2. Open the .env file and update the PORT variable if needed. The default is 4000.

    PORT=4000
    

4. Build the Project

Compile the TypeScript code into JavaScript:

npm run build

This will generate the compiled files in the dist directory.

5. Run the Server

Start the server in production mode:

npm start

Alternatively, for development mode with live reloading, use:

npm run dev

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:

npx @modelcontextprotocol/inspector ./dist/server.js

This will open an interactive interface where you can test the tools and prompts registered in your server like below.

Hello World MCP Server


Project Structure

Here’s an overview of the project structure:

hello-world-mcp-server/
├── src/
│   ├── server.ts                     # Main server entry point
│   ├── modules/
│   │   ├── tools.ts                  # Registers MCP tools
│   │   ├── prompts.ts                # Registers MCP prompts
│   │   └── transports.ts             # Handles SSE and message endpoints
├── .env                              # Environment variables
├── .env.example                      # Example environment variables
├── package.json                      # Project metadata and scripts
├── tsconfig.json                     # TypeScript configuration
└── README.md                         # Project documentation

Troubleshooting

Common Issues

  1. Port Already in Use: If you see an error about the port being in use, update the PORT variable in the .env file.
  2. 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:

npm run dev

This will start the server with live reloading and detailed logs.


Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


License

This project is licensed under the ISC License. See the LICENSE file for details.

相关推荐

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • modelcontextprotocol
  • 模型上下文协议服务器

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

    Reviews

    5 (1)
    Avatar
    user_miH8PzvT
    2025-04-18

    As a dedicated user of MCP applications, I highly recommend the hello-world-mcp-server by jageenshukla. This server is incredibly user-friendly and serves as a great starting point for anyone new to MCP. It's clearly designed with simplicity and efficiency in mind. Check it out at https://github.com/jageenshukla/hello-world-mcp-server for a seamless introduction to MCP server setup.