Skip to main content
Glama

mcp-toolkit

用于 AI 代理的通用 MCP 服务器。 基于 Python 3.13、FastMCP 和 Playwright 构建。

可用工具

工具

描述

web_search

使用 Playwright 在 DuckDuckGo 上搜索并提取网页内容

fetch_url

提取直接 URL 的主要内容

http_request

执行不带 Playwright 的通用 HTTP 请求

time_now

返回指定时区的当前日期和时间

date_utils

转换时区并计算日期/持续时间

memory_set

在 SQLite 中保存持久化值

memory_get

检索已保存的值

memory_delete

删除键

memory_list

列出所有键(可选前缀过滤)

memory_clear

清除所有内存(不可逆!)

memory_search

在已保存的键和值中搜索文本

run_python

在带超时的沙盒中执行 Python 代码

run_js

在带超时的沙盒中通过 Node.js 执行 JavaScript 代码


Related MCP server: MCP Server

安装

前置要求

  • 已安装 UV

  • Python 3.13(如果未安装,UV 会自动下载)

  • Node.js(可选,仅用于 run_js)

选项 A — 从本地文件夹安装

git clone https://github.com/YoshiLoL0526/mcp-toolkit
cd mcp-toolkit
uv tool install --python 3.13 .

选项 B — 直接从 GitHub 安装

uv tool install --python 3.13 git+https://github.com/YoshiLoL0526/mcp-toolkit

强制步骤:为 Playwright 安装 Chromium

安装包后,仅需执行一次此命令:

# Obtener la ruta del entorno virtual creado por uv tool
uv tool run --from mcp-toolkit python -m playwright install chromium

或者,如果你知道环境路径:

~/.local/share/uv/tools/mcp-toolkit/bin/python -m playwright install chromium

MCP 客户端配置

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json)

{
  "mcpServers": {
    "mcp-toolkit": {
      "command": "mcp-toolkit"
    }
  }
}

在 Windows 上,路径为 %APPDATA%\Claude\claude_desktop_config.json

Cursor / VS Code (.cursor/mcp.json 或 .vscode/mcp.json)

{
  "servers": {
    "mcp-toolkit": {
      "type": "stdio",
      "command": "mcp-toolkit"
    }
  }
}

HTTP 服务器(用于远程访问或多个客户端)

mcp-toolkit --transport http --host 0.0.0.0 --port 8080

服务器将在 http://<host>:<port>/mcp 上监听,使用 streamable-http 传输(当前 MCP 标准)。你可以使用 --path /otra-ruta 更改路径。

--transport sse 传输方式为了兼容旧客户端得以保留,但自 FastMCP 2.3 起已被弃用。


工具使用

Parámetros:
  query        (str)  — texto a buscar
  max_results  (int)  — resultados a devolver, default 5, máximo 10
  deep         (bool) — si True, extrae el contenido completo de cada página
  language     (str)  — idioma para las cabeceras HTTP, default "es-ES"

示例(代理):

Busca las últimas noticias sobre Python 3.13 con deep=True

fetch_url

Parámetros:
  url (str) — URL absoluta HTTP o HTTPS a leer

示例(代理):

Lee https://example.com/articulo con fetch_url

http_request

Parámetros:
  method  (str)  — método HTTP: GET, POST, PUT, PATCH, DELETE, HEAD u OPTIONS
  url     (str)  — URL absoluta HTTP o HTTPS
  headers (dict) — cabeceras opcionales
  body    (str)  — cuerpo opcional como texto
  timeout (int)  — segundos máximos, default 10, máximo 60

示例(代理):

Haz un POST a https://api.example.com/items con http_request

time_now / date_utils

time_now(timezone_name="UTC")

date_utils(
  action="convert_timezone",
  value="2026-04-21T12:00:00+00:00",
  target_timezone="America/New_York"
)

date_utils 支持的操作:parse、convert_timezone、add 和 diff。对于没有偏移量的日期,使用 timezone_name;时区必须是 IANA 名称,如 UTC、America/New_York 或 Europe/Madrid。

memory_set / memory_get

memory_set(key="usuario_nombre", value="Carlos", namespace="default")
memory_get(key="usuario_nombre", namespace="default")
memory_list(prefix="usuario_", namespace="default")
memory_search(query="Carlos", namespace="default")

数据保存在 ~/.local/share/mcp-toolkit/memory.db 中。 所有内存工具都接受 namespace 参数,以便按项目、客户端或对话隔离数据。如果未指定,则使用 default。

run_python

Parámetros:
  code     (str) — código Python a ejecutar
  timeout  (int) — segundos máximos, default 10, máximo 60
  stdin    (str) — entrada estándar opcional

安全限制:

  • 最小化环境:不继承宿主进程的密钥或任意变量

  • 每次执行使用临时工作目录

  • HTTP 代理被环境变量覆盖

  • 内存限制:256 MB (Linux/macOS)

  • 严格超时:超时后进程将被终止

  • 在 Windows 上,Python 不应用进程内存限制

  • 网络锁定不能保证强隔离;对于不可信代码,建议在具有网络策略的容器或虚拟机中运行服务器

run_js

参数与 run_python 相同。需要系统中安装 Node.js。


开发

git clone https://github.com/YoshiLoL0526/mcp-toolkit
cd mcp-toolkit
uv sync
uv run python -m playwright install chromium

# Ejecutar en modo desarrollo
uv run mcp-toolkit

# Tests
uv run pytest

添加新工具

  1. 创建 mcp_toolkit/tools/mi_tool.py,包含一个 async def mi_tool(...) -> str 函数

  2. 在 server.py 中导入并使用 mcp.tool()(mi_tool) 注册它

  3. 重新安装:uv tool install --python 3.13 . --reinstall


项目结构

mcp-toolkit/
├── pyproject.toml
├── README.md
├── mcp_toolkit/
│   ├── server.py              # FastMCP app + registro
│   ├── tools/
│   │   ├── web_search.py      # Playwright: buscar + extraer
│   │   ├── fetch_url.py       # Extraer una URL directa
│   │   ├── http_request.py    # Cliente HTTP genérico
│   │   ├── date_time.py       # Fechas, zonas horarias y duraciones
│   │   ├── memory.py          # SQLite KV store con namespaces
│   │   ├── run_python.py      # Sandbox Python
│   │   └── run_js.py          # Sandbox Node.js
│   └── utils/
│       ├── browser.py         # Singleton Playwright
│       └── sandbox.py         # Helpers de subprocess y timeout
└── tests/

许可证

MIT

Available Tools

8 tools
memory_clearA

Elimina TODAS las claves de la memoria persistente. Usar con precaución: esta acción no se puede deshacer.

Returns: Número de entradas eliminadas.

Inputs: no named parameters. Returns: result

memory_deleteB

Elimina una clave de la memoria persistente.

Inputs: key (required). Returns: result

memory_getB

Recupera el valor almacenado bajo una clave.

Inputs: key (required). Returns: result

memory_listA

Lista todas las claves almacenadas, con filtro opcional por prefijo.

Inputs: prefix. Returns: result

memory_setB

Guarda un valor en memoria persistente bajo una clave.

Inputs: key (required), value (required). Returns: result

run_jsA

Ejecuta un fragmento de código JavaScript con Node.js y devuelve su salida.

El código corre en un subproceso separado con:

  • Timeout configurable (por defecto 10 segundos).

  • Sin acceso a red (variables de entorno anuladas).

  • Node.js debe estar instalado en el sistema.

Inputs: code (required), timeout, stdin. Returns: result

run_pythonA

Ejecuta un fragmento de código Python y devuelve su salida.

El código corre en un subproceso separado con:

  • Timeout configurable (por defecto 10 segundos).

  • Sin acceso a red (variables de entorno anuladas).

  • Límite de memoria de 256 MB en Linux.

  • El módulo sys.exit() termina el proceso sin errores.

Inputs: code (required), timeout, stdin. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity. The five memory_* tools handle different CRUD operations for persistent storage, while run_js and run_python execute code in different languages, and web_search performs internet searches. There is no overlap in functionality between these categories.

    Naming Consistency5/5

    Tool names follow a consistent verb_noun pattern throughout. The memory tools use clear action verbs (clear, delete, get, list, set) paired with 'memory', while the execution tools use 'run_' followed by the language, and web_search follows the same convention. All names are in snake_case with no deviations.

    Tool Count4/5

    With 8 tools, the count is reasonable for a toolkit server. However, the scope feels slightly broad, combining memory management, code execution in two languages, and web search into one server, which might be better split. The tools earn their place, but the domain is not tightly focused.

    Completeness4/5

    For the memory domain, the tools provide complete CRUD coverage (set, get, delete, list, clear). For code execution, both JavaScript and Python are covered. The web_search tool adds internet capability. Minor gaps include no update operation for memory (though set can overwrite) and no tool for executing other languages, but agents can work around these.

    Related MCP Connectors

    Related MCP Servers