My first MCP (Model Context Protocol) server implementation.
Based on the video tutorial https://frontendmasters.com/courses/mcp/
This is a simple MCP server that provides an addition tool. It demonstrates how to create a basic MCP server using the @modelcontextprotocol/sdk.
- Addition Tool: Adds two numbers together and returns the result
npm installnpm run myFirstMcpnpm run myFirstMcp:listThis will return information about all available tools in the server.
npm run myFirstMcp:callThis will call the add tool with example arguments (5 + 3) and return the result.
Adds two numbers together.
Parameters:
a(number): First numberb(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
}
}
}@modelcontextprotocol/sdk: MCP SDK for building serverszod: TypeScript-first schema validation