Skip to content

MaxiGarcia13/my-first-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my-first-mcp

My first MCP (Model Context Protocol) server implementation.

Based on the video tutorial https://frontendmasters.com/courses/mcp/

Description

This is a simple MCP server that provides an addition tool. It demonstrates how to create a basic MCP server using the @modelcontextprotocol/sdk.

Features

  • Addition Tool: Adds two numbers together and returns the result

Installation

npm install

Usage

Running the server

npm run myFirstMcp

Testing the server

List available tools

npm run myFirstMcp:list

This will return information about all available tools in the server.

Call the add tool

npm run myFirstMcp:call

This will call the add tool with example arguments (5 + 3) and return the result.

API

Tools

add

Adds two numbers together.

Parameters:

  • a (number): First number
  • b (number): Second number

Returns:

  • A text response with the sum of the two numbers

Example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "add",
    "arguments": {
      "a": 5,
      "b": 3
    }
  }
}

Dependencies

  • @modelcontextprotocol/sdk: MCP SDK for building servers
  • zod: TypeScript-first schema validation

About

My first MCP

Resources

Stars

Watchers

Forks