Python MCP Toolkit Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Python MCP Toolkit Serversearch for MCP Python SDK documentation"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Python MCP Toolkit Server
一个基于 Python 编写的可扩展 MCP 工具服务器,使用官方 MCP Python SDK 的 FastMCP 作为服务入口,内置常用工具,并支持通过插件模块继续扩展工具集。
功能特性
web_search联网搜索:只保留 Bing 和 Tavily;provider=auto有TAVILY_API_KEY时优先使用 Tavily,否则使用 Bing;也可显式选择provider=bing或provider=tavilyfile_operation文件操作:在一个工具内完成列表、读取、查找、grep、写入、替换、复制、移动和删除agent轻量任务状态工具:记录任务目标、步骤、进展和完成结果插件式工具扩展,支持按模块加载自定义工具
支持
stdio、sse和streamable-http三种 MCP 传输方式支持
.env自动加载、命令行参数覆盖和远程请求头授权提供
/healthz健康检查端点,便于远程部署验证默认安全边界:文件访问限制在
MCP_WORKSPACE,写入、复制、移动和删除默认关闭
Related MCP server: MCP Server
文档
安装
本项目按系统级 Python 运行和安装。Termux 中系统 Python 通常是 /data/data/com.termux/files/usr/bin/python。先确认 python 指向系统 Python,然后安装到该 Python 环境:
python -c "import sys; print(sys.executable)"
python -m pip install -e .在 Termux 或 Android Python 环境中,如果 pydantic-core 等原生依赖从源码编译并出现 Text file busy,使用单线程 Cargo 构建重试:
CARGO_BUILD_JOBS=1 python -m pip install -e .离线环境可直接使用 mcp-toolkit-server-offline-pip.tar.gz:
mkdir -p mcp-toolkit-server-offline-pip
tar -xzf mcp-toolkit-server-offline-pip.tar.gz -C mcp-toolkit-server-offline-pip
cd mcp-toolkit-server-offline-pip
./install.sh也可以使用 wheelhouse 格式安装:
./install-wheelhouse-offline.sh mcp-toolkit-server==0.1.0在 Termux 中,如果希望脚本自动检查 Python、离线安装 pip 包、提示填写运行环境变量并启动服务,可以使用:
./termux-install.sh脚本会把输入的运行环境变量默认保存到 .termux-mcp.env,下次运行自动加载。只安装不运行时使用:
./termux-install.sh --no-run完整流程见 离线版构建与安装。
配置
不要把真实 API Key 写入源码。启动前通过环境变量配置工作区;TAVILY_API_KEY 可选,未设置时 web_search 的自动模式会使用 Bing;显式使用 provider=tavily 时必须设置该变量:
export TAVILY_API_KEY='your-tavily-key'
export MCP_WORKSPACE=/data/data/com.termux/files/home/mcp启动时会自动读取当前目录的 .env 文件;已有环境变量优先级更高,不会被 .env 覆盖。也可以通过 MCP_ENV_FILE=/path/to/.env 指定配置文件。
常用可选配置:
export MCP_ENV_FILE=.env
export MCP_SERVER_NAME=python-mcp-toolkit
export MCP_TRANSPORT=stdio
export MCP_HOST=127.0.0.1
export MCP_PORT=8000
export MCP_STATELESS_HTTP=true
export MCP_AUTH_TOKEN=
export MCP_AUTH_HEADER=X-MCP-Auth-Token
export MCP_ALLOW_WRITE=false
export MCP_MAX_FILE_BYTES=2097152
export MCP_REQUEST_TIMEOUT=20
export MCP_TOOLKIT_PLUGINS=examples.custom_tools关键环境变量说明:
变量名 | 默认值 | 说明 |
| 空 | Tavily API Key。为空时 |
|
| Tavily 搜索接口地址。 |
|
| 启动时自动读取的环境变量文件。设为空可禁用自动加载。 |
|
| MCP 传输方式: |
|
| HTTP/SSE 监听地址,远程访问通常设为 |
|
| HTTP/SSE 监听端口。 |
|
|
|
|
|
|
| 空 | HTTP/SSE 请求头授权码。为空时不启用请求头鉴权。 |
|
| 读取授权码的请求头名。设为 |
|
| 是否允许 |
|
| 单个可读取文件大小上限,默认 |
|
| HTTP 请求超时时间,单位秒。 |
| 空 | 逗号分隔的插件模块列表。 |
启动
安装后运行:
mcp-toolkit也可以通过系统 Python 模块入口启动:
python -m mcp_toolkit.server命令行参数会覆盖环境变量,常用示例:
mcp-toolkit \
--transport streamable-http \
--host 0.0.0.0 \
--port 8000 \
--workspace /data/data/com.termux/files/home/mcp查看当前解析后的非敏感配置:
mcp-toolkit --show-config常用命令行参数:
参数 | 说明 |
| 指定启动时读取的 |
`--transport stdio | sse |
| 覆盖 HTTP/SSE 监听地址。 |
| 覆盖 HTTP/SSE 监听端口。 |
| 覆盖 |
| 设置 HTTP/SSE 请求头授权码。 |
| 设置读取授权码的请求头名。 |
| 覆盖 |
| 加载插件模块,可重复使用,也可逗号分隔。 |
| 覆盖 |
| 打印非敏感配置后退出。 |
远程运行推荐使用 streamable-http。默认不需要请求头 token,也不要求客户端手动维护 mcp-session-id:
export MCP_TRANSPORT=streamable-http
export MCP_HOST=0.0.0.0
export MCP_PORT=8000
mcp-toolkit远程地址:
http://服务器IP:8000/mcp如需启用请求头鉴权,再额外设置:
export MCP_AUTH_TOKEN='change-this-token'客户端请求需要带上:
X-MCP-Auth-Token: change-this-token健康检查地址:
http://服务器IP:8000/healthz启用 MCP_AUTH_TOKEN 后,健康检查同样需要带授权请求头。
MCP 客户端配置示例
{
"mcpServers": {
"python-mcp-toolkit": {
"command": "/data/data/com.termux/files/usr/bin/python",
"args": ["-m", "mcp_toolkit.server"],
"env": {
"TAVILY_API_KEY": "your-tavily-key",
"MCP_WORKSPACE": "/data/data/com.termux/files/home/mcp",
"MCP_ALLOW_WRITE": "false"
}
}
}
}示例中的 command 使用 Termux 系统 Python 路径;其他系统请替换为对应的系统 Python 可执行文件。插件模块需要能被系统 Python 导入;推荐把插件作为包安装到系统 Python,或从插件父目录启动客户端。
远程 streamable-http 客户端示例:
{
"mcpServers": {
"python-mcp-toolkit-remote": {
"type": "streamable-http",
"url": "http://服务器IP:8000/mcp"
}
}
}内置工具
工具名 | 说明 |
| 联网搜索公开网页,只保留 Bing 和 Tavily; |
| 在 |
| 管理轻量 agent 任务状态,记录目标、步骤、进展和完成结果。 |
扩展工具
新增工具推荐使用插件模块。插件需要暴露 register(registry, settings) 函数:
from mcp_toolkit.core.config import Settings
from mcp_toolkit.core.registry import ToolRegistry
def register(registry: ToolRegistry, settings: Settings) -> None:
@registry.tool()
def echo(text: str) -> dict[str, str]:
"""Return the input text."""
return {"text": text}启用插件:
export MCP_TOOLKIT_PLUGINS=examples.custom_tools
mcp-toolkit多个插件用英文逗号分隔:
export MCP_TOOLKIT_PLUGINS=examples.custom_tools,examples.math_tools,examples.workspace_stats更多扩展示例见 examples/ 目录和 详细使用与扩展手册。
验证
编译检查:
python -m compileall src examples tests运行单元测试:
python -m unittest discover -s tests列出已注册工具:
python - <<'PY'
import asyncio
from mcp_toolkit.server import create_server
async def main():
server = create_server()
tools = await server.list_tools()
for tool in tools:
print(tool.name)
asyncio.run(main())
PY验证插件加载:
MCP_TOOLKIT_PLUGINS=examples.custom_tools python - <<'PY'
import asyncio
from mcp_toolkit.server import create_server
async def main():
server = create_server()
tools = await server.list_tools()
print(any(tool.name == "echo" for tool in tools))
asyncio.run(main())
PY安全说明
TAVILY_API_KEY只应通过环境变量传入,不应提交到仓库。远程 HTTP/SSE 模式建议设置
MCP_AUTH_TOKEN,并在公网环境前置 HTTPS 反向代理。file_operation只能访问MCP_WORKSPACE内路径。文件写入、替换、复制、移动和删除能力默认关闭,需要显式设置
MCP_ALLOW_WRITE=true。建议为不同项目配置不同的
MCP_WORKSPACE。
授权协议
本项目基于 GNU General Public License v3.0 or later(GPL-3.0-or-later)授权发布,详见 LICENSE。
Available Tools
3 toolsagentC
管理一个轻量 agent 任务状态,用于记录目标、步骤、进展和完成结果。
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | agent 动作:start/status/update/finish/reset。 | status |
| task | No | start 时设置的任务目标。 | |
| steps | No | start 时设置的执行步骤;为空时使用默认执行步骤。 | |
| note | No | update/finish 时追加的进展、观察或结论。 |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It does not mention side effects (e.g., state mutation), authentication requirements, rate limits, or lifecycle behavior of actions (start, update, finish, reset). This is insufficient for a tool managing task state.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, making it concise. It is front-loaded with the core purpose. However, it could be slightly more detailed without losing conciseness. Overall, it earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the moderate complexity (4 parameters, actions enum) and the presence of an output schema, the description is minimally adequate. It explains the high-level purpose but lacks details on action semantics, required states, and usage flow, making it incomplete for full guidance.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so each parameter already has a description. The tool description adds no additional meaning beyond the schema. Baseline is 3, and the description does not compensate with extra context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool manages agent task status and records goals, steps, progress, and results. This is clear and distinguishes it from sibling tools (file_operation, web_search) which have different domains. However, the verb 'manage' is somewhat broad; a more specific verb like 'track' would improve clarity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The description does not mention context, prerequisites, or exclusions. Sibling tools are quite different, but explicit when-to-use instructions are absent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
file_operationA
在 MCP_WORKSPACE 内执行文件操作;写入、复制、移动、删除需要 MCP_ALLOW_WRITE=true。
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 文件操作类型:list/info/read/read_lines/write/append/replace/mkdir/copy/move/delete/find/grep。 | |
| path | No | MCP_WORKSPACE 内的文件或目录路径。 | . |
| content | No | write/append 操作写入的文本内容;replace 操作中表示查找文本。 | |
| destination | No | copy/move 操作的目标路径,必须在 MCP_WORKSPACE 内。 | |
| replacement | No | replace 操作使用的替换文本。 | |
| query | No | grep 操作使用的正则表达式;也可作为 replace 的查找文本。 | |
| pattern | No | find/grep 使用的 glob 文件匹配模式。 | * |
| recursive | No | list/delete 操作是否递归处理目录。 | |
| overwrite | No | write/copy/move 目标已存在时是否覆盖。 | |
| include_hash | No | info 操作是否计算普通文件 SHA-256。 | |
| regex | No | replace 操作是否按正则表达式查找。 | |
| case_sensitive | No | grep 操作是否区分大小写。 | |
| start_line | No | read_lines 从第几行开始读取,行号从 1 开始。 | |
| max_lines | No | read_lines 最多返回行数,实际限制在 1 到 1000。 | |
| max_chars | No | read 最多返回字符数,实际限制在 1 到 MCP_MAX_FILE_BYTES。 | |
| max_entries | No | list/find/grep 最多返回条目数,实际限制在 1 到 1000。 | |
| count | No | replace 最多替换次数;0 表示全部替换。 |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It only mentions the write permission requirement, but fails to describe error handling, side effects, idempotency, or safety for other operations. This is insufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that conveys the essential purpose and a key behavioral constraint. It is efficiently front-loaded with the scope and permission condition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite the complexity (17 parameters, 13 actions), the description is minimal. It covers the workspace scope and write permission but lacks details on typical use cases, return values (though output schema exists), or guidance on action selection. The schema covers parameter details, but the context is sparse.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The tool description does not add extra meaning beyond the schema; it only mentions the write requirement which is already implied by the action enum.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the tool executes file operations within MCP_WORKSPACE, distinct from sibling tools (agent, web_search). The verb 'execute file operations' and resource 'MCP_WORKSPACE' are specific.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description indicates that write/copy/move/delete operations require MCP_ALLOW_WRITE=true, providing clear context. No explicit exclusions or alternatives are needed given sibling tools are unrelated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
web_searchB
联网搜索公开网页,返回标题、URL 和摘要。
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 要联网搜索的关键词或问题。 | |
| max_results | No | 最多返回的搜索结果数量,实际限制在 1 到 50;Bing 搜索会自动翻页。 | |
| provider | No | auto 优先使用 Tavily;未配置 Tavily Key 时使用 Bing;也可显式选择 tavily 或 bing。 | auto |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries the full burden. It only states the output format but does not disclose behavioral traits such as rate limits, authentication requirements, pagination behavior, or limitations. Parameter-level descriptions in the schema hint at pagination, but the main description lacks this context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is concise and front-loaded with the action. Every word earns its place with no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 3 parameters (100% schema coverage) and an output schema, the description is adequate but minimal. It could be enriched by mentioning provider options and result pagination, but the schema fills many gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds no parameter information beyond what the schema provides, but it is not required to.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'search', resource 'public web pages', and specifies the return fields (title, URL, summary). It effectively distinguishes from sibling tools 'agent' and 'file_operation'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'agent' or 'file_operation'. No when-to-use or when-not-to-use information is given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
agent - First observed
file_operation - First observed
web_search
TDQS
Scored across 3 tools
Each tool targets a clearly distinct domain: agent manages task state, file_operation handles files, and web_search performs internet searches. There is no overlap or ambiguity.
All tool names follow a consistent pattern of lowercase with underscores (agent, file_operation, web_search), making them predictable and easy to distinguish.
With 3 tools, the server is minimal but focused on essential utilities (task management, file ops, web search). It is slightly on the low end but appropriate for its stated purpose.
The set covers basic utility functions but lacks other common toolkit operations like code execution, data processing, or API calls, making it somewhat incomplete for a general 'Toolkit' server.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseBqualityDmaintenanceA config-driven, zero-dependency MCP server with plugin architecture that enables filesystem operations, shell commands, HTTP requests, and utilities through simple JSON configuration.31-
- AlicenseNot gradedqualityDmaintenanceA modular MCP server providing file operations, web search, URL scraping, and sandboxed command execution for LLM interactions.1MIT
- FlicenseNot gradedqualityDmaintenanceMCP server providing filesystem operations, shell execution, and web search capabilities.-
- FlicenseNot gradedqualityCmaintenanceA production-ready MCP server providing file, system, math, and text utilities through a simple CLI client.-