mcp-hello-world-ts

snoopdave/mcp-hello-world-ts

3.3

If you are the rightful owner of mcp-hello-world-ts 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 minimal Model Context Protocol (MCP) server written in TypeScript, demonstrating MCP-compliant resources and tools for LLMs and MCP-enabled clients.

Hello World MCP Server

A minimal Model Context Protocol (MCP) server written in TypeScript. This project demonstrates how to create MCP-compliant resources and tools for use with LLMs and MCP-enabled clients like Claude Desktop.

Features

  • MCP Resources:
    Provides simple resources at hello://greeting, hello://info, and a resource list at hello://list.

  • MCP Tool:
    A helloTool that echoes messages or returns a default greeting.

  • Stdio Transport:
    Communicates via standard input/output, making it easy to integrate with MCP clients.


Getting Started

Prerequisites

  • Node.js (v18+ recommended)
  • npm (comes with Node.js)

Install Dependencies

npm install

Build the Project

Compile TypeScript source files to JavaScript in the dist/ directory:

npm run build

Run the Server (Standalone)

npm start

This will start the MCP server via Node.js using the built output.


Run Tests

Integration tests are provided to verify the MCP server works end-to-end:

npm test

This runs the tests in src/integration.test.ts using Jest.


Using with Claude Desktop

You can configure Claude Desktop or any MCP client to use this server as a plugin/tool by specifying the command to launch the MCP server.

Example Configuration Snippet

Add the following to your Claude Desktop settings (replace the path with your actual project path):

"hello-world-mcp": {
  "command": "node",
  "args": [
    "/path/to/mcp-hello-world-ts/dist/index.js"
  ]
}
  • Replace /path/to/mcp-hello-world-ts/ with the full path to where you cloned this repo.
  • Make sure you have built the project (npm run build) before starting Claude Desktop.

Project Structure

.
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.ts                # Main MCP server entry point
│   ā”œā”€ā”€ resources/helloResource.ts  # MCP resource definitions
│   └── tools/helloTool.ts      # MCP tool definition
ā”œā”€ā”€ dist/                       # Compiled JS output
ā”œā”€ā”€ package.json
ā”œā”€ā”€ tsconfig.json
ā”œā”€ā”€ README.md
└── ...

Customization

  • To add new tools or resources, create new files in src/resources/ or src/tools/ and register them in src/index.ts.
  • Modify helloResource.ts or helloTool.ts to change the greeting or add additional functionality.

License

MIT License


Author