MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

M
MCP Server Deployment Example
作者 @piratewiz

MCP server by piratewiz

创建于 6/16/2026
更新于 1 day ago
Repository documentation and setup instructions

MCP Server — Deployment Example

A minimal Model Context Protocol (MCP) server built with Python and FastMCP. It exposes a single tool (add) that AI assistants can call to add two integers together.

What does this MCP do?

The server registers one tool:

| Tool | Description | Parameters | Returns | |------|-------------|------------|---------| | add | Adds two numbers | a: int, b: int | int |

When an AI client (Claude Desktop, VS Code, OpenCode, etc.) connects to this server, the model gains the ability to call add(a, b) and receive the result — demonstrating the full MCP request/response cycle.

Project structure

project_mcp/
├── src/
│   └── mcpserver/
│       ├── __init__.py
│       ├── __main__.py   # entry point: runs mcp.run()
│       └── deployment.py # tool definitions (FastMCP)
├── pyproject.toml
├── uv.lock
└── README.md

Requirements

  • Python 3.14+
  • uv — used as the package manager and runner
  • The mcp[cli] package (declared in pyproject.toml, installed automatically by uv)

Running locally

# Install dependencies
uv sync

# Start the MCP server (stdio transport)
uv run mcp-server

Installation in Claude Desktop

Open or create the Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the mcpServers block:

{
  "mcpServers": {
    "add-tool": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/piratewiz/mcp-server-deployment-example.git",
        "mcp-server"
      ]
    }
  }
}

Restart Claude Desktop. The add tool will be available automatically in every conversation.


Installation in VS Code (Claude Code extension)

Open your VS Code MCP settings file at .claude/settings.json (project-level) or the global Claude Code settings, and add:

{
  "mcpServers": {
    "add-tool": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/piratewiz/mcp-server-deployment-example.git",
        "mcp-server"
      ]
    }
  }
}

Alternatively, use the Claude Code CLI:

claude mcp add add-tool uvx -- --from git+https://github.com/piratewiz/mcp-server-deployment-example.git mcp-server

Reload the VS Code window (Ctrl+Shift+PDeveloper: Reload Window) for the server to connect.


Installation in OpenCode

Add the server to your OpenCode configuration file (~/.config/opencode/config.json or the project-local .opencode/config.json):

{
  "mcp": {
    "servers": {
      "add-tool": {
        "command": "uvx",
        "args": [
          "--from",
          "git+https://github.com/piratewiz/mcp-server-deployment-example.git",
          "mcp-server"
        ]
      }
    }
  }
}

Restart OpenCode to activate the connection.


How uvx works here

uvx (part of the uv toolchain) fetches the package directly from the GitHub repository, installs it in an isolated environment, and runs the declared mcp-server script — no manual pip install or virtual environment setup required.

Adding more tools

Edit src/mcpserver/deployment.py and decorate any Python function with @mcp.tool():

@mcp.tool()
def multiply(a: int, b: int) -> int:
    """Multiply two numbers"""
    return a * b

Push the changes to GitHub; clients that install via uvx --from git+... will pick up the new tool on next launch.

快速设置
此服务器的安装指南

安装包 (如果需要)

uvx mcp-server-deployment-example

Cursor 配置 (mcp.json)

{ "mcpServers": { "piratewiz-mcp-server-deployment-example": { "command": "uvx", "args": [ "mcp-server-deployment-example" ] } } }