Skip to main content
Glama
lamchantuong

modular-mcp

by lamchantuong

modular-mcp

模块化 MCP 服务器,采用 Odoo 风格插件(__manifest__.toml),并支持可选的 FastAPI Web 层。

设置

python -m venv .venv
.venv\Scripts\activate
pip install -e ".[dev]"
copy .env.example .env

配置主要在 config.toml 中。环境变量仍可覆盖 FastAPI 设置(支持 .env)。

来源

用途

config.toml

MCP 服务器、日志、插件路径、FastAPI 默认设置

.env / 环境变量

覆盖 FastAPI HOST、PORT、LOG_LEVEL 等

Related MCP server: mcp-app

运行

modular-mcp serve
modular-mcp mcp serve
modular-mcp get hello
  • FastAPI 界面:http://127.0.0.1:8000/

  • MCP 默认:streamable-http,地址为 http://127.0.0.1:5001(参见 config.toml)

插件

每个插件是 addons/ 下的一个文件夹,包含:

addons/my_addon/
  __manifest__.toml
  config.toml
  tools.py          # register_tools(mcp, config, logger)

示例插件:addons/key_value_store/ 提供 kv_get / kv_set。

插件内共享导入:

from app.mcp.utils import format_json, exception_to_error_response
from app.mcp.logging import monitor_performance
from helpers import my_helper  # local module in the same addon folder

从 dynamic-cp 移植工具

# Before
tools/requests_tools.py

# After
addons/requests/
  __manifest__.toml
  config.toml
  tools.py

将工具代码移入 tools.py,将 utils.* 导入改为 app.mcp.utils,并在 __manifest__.toml 中设置 log_。

*测试与代码检查

pytest
ruff check .
ruff format --check .
mypy
pyright

Pre-commit

pip install -e ".[dev]"
pre-commit install
pre-commit run --all-files

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables building and running MCP servers over streamable HTTP, exposing tools to AI assistants like Cursor, with examples of mounting multiple servers in FastAPI.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    Framework for building and running MCP servers as HTTP services. Define tools as pure Python functions, wire up with two lines, run with one command.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables managing multiple Odoo instances from a single panel and exposes MCP tools for interacting with them via a unified service.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    A modular MCP server built with FastAPI, exposing tools via HTTP endpoints with SSE streaming responses.
    -