MCP Learning Series - Part 2
In the previous post we say what is MCP? In this post, we will create an MCP server and add it to Claude Desktop. Claude Desktop is our AI application (MCP Host) which has inbuild MCP Client to connect to our MCP Server. The MCP server which I am going to create is a simple math tool which can perform basic mathematical operations. Simple Code for creating Mathematics Operations: We use the decorator @mcp.tool to create a MCP tool. MCP allows to create Tools, Resources and Prompts. # server.py from mcp.server.mcpserver import MCPServer mcp = MCPServer( "Math Server" ) @mcp.tool () def add (a: int , b: int ) -> int : """Add two numbers together.""" return a + b def sub (a: int , b: int ) -> int : """Sub two numbers""" return a - b def multiply (a: int , b: int ) -> int : """Multiple two numbers""" return a * b def divide (a: int , b: int ) -> int :...