MCP ExplorerExplorer

Tutorial Mcp

@softchrison 9 months ago
1 MIT
FreeCommunity
AI Systems
simplest possible server and client in JavaScript that could possibly work

Overview

What is Tutorial Mcp

tutorial-mcp is the simplest possible server and client implementation in JavaScript that demonstrates the basic functionalities of the MCP framework.

Use cases

Use cases for tutorial-mcp include teaching programming concepts, developing simple web applications, and experimenting with MCP functionalities in a controlled environment.

How to use

To use tutorial-mcp, first install the server by running ‘npm install’ and then build it with ‘npm build’. After that, you can test the server using the inspector tool with ‘npm run inspect’. For the client, navigate to the client folder, install it with ‘npm install’, and start it using ‘npm start’.

Key features

Key features of tutorial-mcp include a basic server that can perform addition with the ‘add’ tool and provide greetings through the ‘greeting/{name}’ resource template. It also supports an inspector tool for testing and interacting with the server.

Where to use

tutorial-mcp can be used in educational contexts for learning JavaScript and understanding client-server interactions, as well as in small-scale projects that require basic server functionalities.

Content

🚀 MCP Sample for JavaScript 🌟

Welcome to the smallest possible example of a JavaScript project using the MCP! This repo is your starting point for building amazing projects with MCP. 🛠️✨

[!NOTE]
The client should ideally integrate with an LLM to negotiate with the server on what tools to call and what resources to access. 🤖💬. That’s not the case here and the client explicitly call the server and asks about its tools and resources and more.

[!IMPORTANT]
Install and build the server before running the client. 🏗️🚀

🌐 Server

The server uses StdioServerTransport and includes the following:

  • 🧮 add: A tool that takes two numbers, a and b, and returns their sum.
  • 👋 greeting/{name}: A resource template that takes a name and returns a friendly greeting.

📦 Install Server

Build the server with this command:

npm install

▶️ Run Server

Start the server with this command:

npm build

🕵️‍♂️ Test the Server with the Inspector Tool

Use the inspector tool to test the server! 🛠️ Open it with:

npm run inspect

This will connect to the server and launch a user interface in your browser. 🌐 Use the inspector tool to call tools, access resources, view logs, and more! 🎉

💻 Client

The client is located in the client folder. 📂

📦 Install Client

Change directory to the client folder with this command:

cd client

Install the client with this command:

npm install

▶️ Run Client

Start the client with this command:

npm start

Enjoy building your MCP-powered JavaScript projects! 🚀✨

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers