mirror of
https://github.com/chaitin/SafeLine.git
synced 2026-01-31 22:04:02 +08:00
mcp_server - A SafeLine WAF mcp server
- Easy to use
- one command to run mcp_server
- Easy to develop
- add yoor own tools to
toolsdirctory without modify other files
- add yoor own tools to
quick start
docker compose -f docker-compose.yaml up -d
custom your own tool
Hello Tool Example
This tool used to say hello to someone
- create file
tools/hello.py
from pydantic import BaseModel, Field
from tools import register_tool, Tool
# Hello describe function paramters
class Hello(BaseModel):
name: str = Field(description="username to say hello")
# hello is tool logic
async def hello(arguments: dict) -> str:
"""
Say hello to someone
"""
return f"Hello {arguments['name']}"
# register tool to global variable
register_tool(
Tool(
name="hello",
description="say hello to someone",
inputSchema=Hello.model_json_schema()
),
hello
)
- import this tool in
tools/__init__.py
from . import hello