Skip to main content
Glama
mcp_example

mcp_example

by xdoni4

mcp_example

Минимальный канонический пример MCP: один сервер по Streamable HTTP и тонкий клиент, который к нему ходит.

Канонический endpoint

http://127.0.0.1:8000/mcp

Related MCP server: Echo MCP Server

Установка

Нужны uv и Python 3.10+.

cd mcp_example
uv sync

Запуск

Терминал A — сервер:

uv run mcp-example-server

Терминал B — клиент:

uv run mcp-example-client

Должны появиться список tools и успешные вызовы health, echo и reverse_text.

Опционально:

uv run mcp-example-server --host 127.0.0.1 --port 8000 --path /mcp
uv run mcp-example-client --url http://127.0.0.1:8000/mcp

Демо-tools

Tool

Назначение

health

Проверка, что сервер жив

echo

Проверка передачи аргументов

reverse_text

Пример простой обработки строки

Как добавить свой tool

В src/mcp_example/server.py:

@mcp.tool()
def my_tool(query: str) -> str:
    """Кратко опишите, что делает tool — это увидит модель."""
    # здесь вызов вашего API / БД
    return f"result for {query}"

Перезапустите сервер. Клиент (и любой MCP-host) увидит новый tool через tools/list.

Зачем так устроено

  • MCP SDK (mcp) реализует протокол (handshake, tools/list, tools/call).

  • Streamable HTTP — общий удалённый транспорт: один URL для скриптов, IDE и агентских runtime.

  • Клиент в этом репо только проверяет, что протокол работает — LLM не нужен.

Ссылки

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      Not graded
      maintenance
      A minimal reference implementation of an MCP server that responds with "Hello, World" via Streamable HTTP. Serves as a baseline for integration testing and MCP client development with production-ready features including health checks, metrics, and containerized deployment.
      3
      48,264 npm
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A simple demonstration MCP server that provides an echo tool and resource for learning how to build MCP servers. Serves as a starting point and template for creating custom MCP server implementations.
      1
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A minimal MCP server for homelab environments, providing demo tools like ping and echo over Streamable HTTP for testing client-server integration.
      -