复合
mcp数据集scalyr是用于数据集scalyear日志的模型上下文协议(mcp)。
它是基于kmcp框架创建的。
项目结构
src/
├── tools/ # Tool implementations (one file per tool)
│ ├── echo.py # Example echo tool
│ └── __init__.py # Auto-generated tool registry
├── core/ # Dynamic loading framework
│ ├── server.py # Dynamic MCP server
│ └── utils.py # Shared utilities
└── main.py # Entry point
kmcp.yaml # Configuration file
tests/ # Generated tests快速开始
选项1:本地开发(使用Python/uv)
- 安装依赖项:
uv sync- 运行服务器:
# Stdio mode (default MCP transport)
uv run python src/main.py
# HTTP mode with WebSocket MCP endpoint
uv run python src/main.py --transport http
# HTTP mode with custom host/port
uv run python src/main.py --transport http --host 0.0.0.0 --port 8080- 使用uv脚本:
# Development mode (HTTP on port 3000)
uv run dev
# HTTP mode
uv run dev-http
# Stdio mode
uv run start- 添加新工具:
# Create a new tool (no tool types needed!)
kmcp add-tool weather
# The tool file will be created at src/tools/weather.py
# Edit it to implement your tool logic选项2:仅Docker开发(不需要本地Python/uv)
- 构建Docker镜像:
kmcp build --verbose- 在容器中运行:
docker run -i mcp-dataset-scalyr:latest- 部署到Kubernetes:
kmcp deploy mcp --apply- 添加新工具:
# Create a new tool
kmcp add-tool weather
# Edit the tool file, then rebuild
kmcp buildHTTP传输模式
出于开发和集成目的,服务器支持在HTTP模式下运行。
以HTTP模式启动
# Command line flag
python src/main.py --transport http
# Environment variable
MCP_TRANSPORT_MODE=http python src/main.py
# Custom host and port
python src/main.py --transport http --host localhost --port 8080