MCP.so
登录

How to build an MCP server - Calculator Example

@simonberner

基本信息

分类

开发工具

许可证

MIT license

传输方式

stdio

作者

simonberner

关于 How to build an MCP server - Calculator Example

Example project showing how to build a simple MCP Server (and having it on Smithery!)

How to build an MCP server - Calculator Example 配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "mcp-server-calculator-simonberner": {
      "command": "npx",
      "args": [
        "-y",
        "@smithery/cli",
        "install",
        "@simonberner/mcp-server-calculator",
        "--client",
        "claude"
      ]
    }
  }
}

How to build an MCP server - Calculator Example 工具

工具列表暂未提供

当前收录暂时没有可展示的工具列表,不代表服务没有工具。请查阅项目文档了解支持的能力。

点击上方按钮,在临时沙箱中运行此服务器并实时获取工具列表。

概览

What is How to build an MCP server - Calculator Example?

This is a simple example MCP server that provides basic math operations (addition, subtraction, multiplication, division) to an MCP client. It demonstrates how to build an MCP server from scratch using Python and the MCP SDK, intended for developers learning the Model Context Protocol.

How to use How to build an MCP server - Calculator Example?

Install automatically via Smithery (npx -y @smithery/cli install @simonberner/mcp-server-calculator --client claude), or set up the development environment using Nix/direnv or manually with uv. Run locally with mcp dev src/mcp_server_calculator/calculator.py and test using MCP Inspector. Integrate with an MCP host by adding the server configuration to the host's mcp config file (e.g., for Claude Desktop).

Key features of How to build an MCP server - Calculator Example

  • Provides basic math operations: add, subtract, multiply, divide.
  • Built with Python 3 and the MCP SDK.
  • Supports installation via Smithery, Nix, or uv.
  • Testable via MCP Inspector web interface.
  • Includes unit tests with pytest.

Use cases of How to build an MCP server - Calculator Example

  • Learning how to build an MCP server from scratch.
  • Prototyping a simple math tool for AI agents.
  • Testing MCP client-server interactions locally.

常见问题

1

What is MCP?

Model Context Protocol (MCP) is a protocol that enables LLMs to access custom tools and services. An MCP client can make requests to MCP servers to access tools they provide.

2

How do I install this server?

You can install it via Smithery, use the Nix development environment with direnv, or set it up manually with `uv`. For hosts like Claude Desktop, add the server configuration to your mcp config.

3

What dependencies are required?

Python 3, the MCP SDK, the MCP CLI, and pytest. Optionally Nix (or Lix) for a reproducible environment.

4

How do I test the server locally without an LLM?

Run `mcp dev src/mcp_server_calculator/calculator.py` and open MCP Inspector at http://localhost:5173 to test the server via a GUI.

5

Where does server data live?

The server is stateless; all math operations are computed in memory and no data is persisted.

6

What transport does it use?

The server runs as a Python script over stdio, configured locally in the MCP host’s configuration file. It is not a remote server.

评论

开发工具 分类下的更多 MCP 服务器