MCP Server

Estimated reading time: 2 minutes 预计阅读时间: 2 分钟

Full Chinese version: /guide/core/mcp.

summer-mcp is an embedded MCP server based on rmcp. It exposes the project's database schema, CRUD tools, code generators, and menu/dict business tools to AI assistants.

Two run modes

ModePathUse case
embeddedhttp://localhost:8080/api/mcpCo-deployed with main app
standalonehttp://127.0.0.1:9090/mcpDedicated AI tooling

Config

[mcp]
enabled = true
transport = "http"          # http | stdio
http_mode = "embedded"      # embedded | standalone
path = "/mcp"
binding = "127.0.0.1"
port = 9090
server_name = "summerrs-admin-mcp"
server_version = "0.0.1"
title = "Summerrs Admin MCP"
stateful_mode = true
sse_keep_alive = 15
sse_retry = 3
session_channel_capacity = 16

Standalone

cargo run -p summer-mcp --features standalone --bin summerrs-mcp -- \
  --database-url 'postgres://admin:123456@localhost/summerrs-admin'

Capabilities

Resources

URIContent
schema://tablesAll tables (runtime-discovered)
schema://table/{table}Columns / types / comments / indexes / FKs

Tools — generic table

ToolUse
table_get / table_query / table_insert / table_update / table_deleteGeneric CRUD over any table

Tools — SQL escape hatches

ToolUse
sql_query_readonlyComplex read-only SQL
sql_execExplicit DDL/DML (use with care)

Tools — code generators

ToolOutput
generate_entity_from_tableSeaORM entity (auto-detects enums)
upgrade_entity_enums_from_tablePreview enum upgrade plan
generate_admin_module_from_tableBackend CRUD module (router + service + dto + vo)
generate_frontend_bundle_from_tableFrontend api / types / page bundle (Art Design Pro preset)

Tools — business

ToolUse
menu_toolPlan / export / apply menu changes safely
dict_toolPlan / export / apply dictionary changes

Prompts

  • discover_table_workflow
  • generate_crud_bundle_workflow
  • rollout_menu_dict_workflow

Claude Desktop

{
  "mcpServers": {
    "summerrs-admin": {
      "type": "http",
      "url": "http://localhost:8080/api/mcp"
    }
  }
}

Cursor

{
  "mcpServers": {
    "summerrs-admin": {
      "url": "http://localhost:8080/api/mcp"
    }
  }
}

Security

  • sql_exec is powerful — keep it on trusted networks only
  • Standalone binding is 127.0.0.1 by default — do not expose to 0.0.0.0
  • MCP can be disabled in production via [mcp].enabled = false

Source files

  • crates/summer-mcp/src/{plugin,server,runtime,prompts}.rs
  • crates/summer-mcp/src/config.rs
  • crates/summer-mcp/src/table_tools/
  • crates/summer-mcp/src/tools/