Writing Hot-Pluggable MCP Tool Modules

A plugin is a Python module containing one or more functions decorated with mcp_tool(name, description, input_schema). The misc MCP server discovers decorated functions and exposes them as MCP tools; the module does not construct an MCP Server.

Paths And Modes

Minimal Plugin

Handler argument names must match the inputSchema property names. Return a JSON-serializable value; non-string values are encoded automatically and strings are returned as-is. Sync and async handlers are supported.

Reload And Errors

Side Effects And Testing

Plugins execute in the MCP server process with that process's credentials. Supervised development execution is an accepted operator policy, but development mode should remain manually enabled and observed. Test plugins with python -m unittest -v test_mcp_tool_plugins.py; the current suite has 30 passing tests.

References

Implementation: mcp_tool_plugins.py. Mailbox example: mailbox_tools.py. Tracked dev_file implementation: dev_plugins/dev_file_tools.py. Runtime wrapper: /home/john/py/mcp-tools/dev_file_tools.py. Development-file operations are documented in popit3/mcp-dev-file-tool.

version 2