# General spring parameters
server:
address: "${HTTP_BIND_ADDRESS:127.0.0.1}"
port: "${HTTP_BIND_PORT:8000}"
# Servlet async timeout for SSE connections (5 minutes default)
servlet:
session:
timeout: "${SERVER_SERVLET_SESSION_TIMEOUT:5m}"
spring:
main:
banner-mode: off
web-application-type: "${SPRING_WEB_APPLICATION_TYPE:none}"
mvc:
async:
request-timeout: "${SPRING_MVC_ASYNC_REQUEST_TIMEOUT:300000}" # 5 minutes in milliseconds
ai:
mcp:
server:
enabled: true
name: thingsboard-mcp-server
version: 2.1.0
# The WebMVC starter autoconfigures WebMVC SSE transport
# Also enables STDIO so the same binary can be launched in either mode
stdio: "${SPRING_AI_MCP_SERVER_STDIO:true}" # true to use STDIO mode
sse-endpoint: "${SPRING_AI_MCP_SERVER_SSE_ENDPOINT:/sse}"
sse-message-endpoint: "${SPRING_AI_MCP_SERVER_SSE_MESSAGE_ENDPOINT:/mcp/message}"
# Type of server to use for MCP communication (SYNC for WebMVC, ASYNC for WebFlux)
type: sync
# Request timeout - how long to wait for tool execution responses
request-timeout: "${SPRING_AI_MCP_SERVER_REQUEST_TIMEOUT:60s}"
# SSE keep-alive interval - CRITICAL for Ollama MCP client compatibility
# Sends periodic heartbeat to prevent connection timeout
keep-alive-interval: "${SPRING_AI_MCP_SERVER_KEEP_ALIVE_INTERVAL:30s}"
# Change notifications
tool-change-notification: true
resource-change-notification: false
prompt-change-notification: false
# Capabilities
capabilities:
tool: true
resource: true
prompt: true
completion: false
cors:
allowed-origins: "${SPRING_AI_MCP_CORS_ALLOWED_ORIGINS:*}" # comma-separated list
logging:
level:
root: info
io.modelcontextprotocol.server.McpAsyncServer: "${LOG_LEVEL_MCP_ASYNC:error}"
io.modelcontextprotocol.server.McpSyncServer: "${LOG_LEVEL_MCP_SYNC:info}"
io.modelcontextprotocol.spec: "${LOG_LEVEL_MCP_SPEC:info}"
io.modelcontextprotocol.util.KeepAliveScheduler: "${LOG_LEVEL_KEEP_ALIVE:error}"
org.springframework.ai.mcp: "${LOG_LEVEL_SPRING_AI_MCP:info}"
org.thingsboard.ai.mcp.server: "${LOG_LEVEL_APP:info}"
org.thingsboard.ai.mcp.server.tools: "${LOG_LEVEL_TOOLS:info}"
org.thingsboard.ai.mcp.server.util.ToolResponse: "${LOG_LEVEL_TOOL_RESPONSE:info}"
pattern:
console: "${LOGGING_PATTERN_CONSOLE:%d{yyyy-MM-dd HH:mm:ss} | %-5level | %logger{1} | %msg%n}" # Do NOT set to empty string — Logback will fail. Use LOG_LEVEL_APP=error to suppress logs in STDIO mode.
# ThingsBoard auth parameters
thingsboard:
url: "${THINGSBOARD_URL:}"
api-key: "${THINGSBOARD_API_KEY:}"
username: "${THINGSBOARD_USERNAME:}" # leave for backward compatibility, but since 4.3, use an API key instead
password: "${THINGSBOARD_PASSWORD:}" # leave for backward compatibility, but since 4.3, use an API key instead
login-interval-seconds: "${THINGSBOARD_LOGIN_INTERVAL_SECONDS:1800}"
connection:
max-retries: "${THINGSBOARD_CONNECTION_MAX_RETRIES:3}"
retry-delay-seconds: "${THINGSBOARD_CONNECTION_RETRY_DELAY_SECONDS:5}"
# HTTP client timeouts for ThingsBoard API requests
connect-timeout-seconds: "${THINGSBOARD_CONNECTION_CONNECT_TIMEOUT_SECONDS:10}"
read-timeout-seconds: "${THINGSBOARD_CONNECTION_READ_TIMEOUT_SECONDS:60}"
# Tool groups configuration - set false to disable entire tool categories
# This helps reduce context size for clients with limited capacity (e.g., Claude Desktop)
# Available groups: edq, telemetry, device, asset, alarm, ota, relation, customer, user, group
tools:
groups:
edq: "${THINGSBOARD_TOOLS_EDQ:true}" # EntityQueryTools + GuideTools (40 tools) - entity data queries & docs
telemetry: "${THINGSBOARD_TOOLS_TELEMETRY:true}" # TelemetryTools (12 tools) - attributes & timeseries
device: "${THINGSBOARD_TOOLS_DEVICE:true}" # DeviceTools + DeviceCreateTools (11 tools)
asset: "${THINGSBOARD_TOOLS_ASSET:true}" # AssetTools (8 tools)
alarm: "${THINGSBOARD_TOOLS_ALARM:true}" # AlarmTools (10 tools)
ota: "${THINGSBOARD_TOOLS_OTA:true}" # OtaTools (11 tools) - firmware updates
relation: "${THINGSBOARD_TOOLS_RELATION:true}" # RelationTools (10 tools)
customer: "${THINGSBOARD_TOOLS_CUSTOMER:true}" # CustomerTools (7 tools)
user: "${THINGSBOARD_TOOLS_USER:true}" # UserTools (9 tools)
group: "${THINGSBOARD_TOOLS_GROUP:true}" # EntityGroupTools (10 tools) - PE only