LocalAI/core/cli
LocalAI [bot] ab315f2725
feat: Add LOCALAI_DISABLE_MCP environment variable to disable MCP support (#8816)
* feat: Add LOCALAI_DISABLE_MCP environment variable to disable MCP support

- Added DisableMCP field to RunCMD struct in core/cli/run.go
- Added LOCALAI_DISABLE_MCP environment variable support
- Added DisableMCP field to ApplicationConfig struct
- Added DisableMCP AppOption function
- Updated MCP endpoint routing to check appConfig.DisableMCP
- When LOCALAI_DISABLE_MCP is set to true/1/yes, MCP endpoints are not registered

When set, all MCP functionality is disabled and appropriate error messages
are returned to users.

Use Cases:
- Security-conscious deployments where MCP is not needed
- Reducing attack surface
- Compliance requirements that prohibit certain protocol support

Environment variable: LOCALAI_DISABLE_MCP=true

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>

* docs: Add documentation for LOCALAI_DISABLE_MCP environment variable

- Add section explaining how to disable MCP support using environment variable
- Document use cases for disabling MCP
- Provide examples for CLI and Docker usage

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>

---------

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
Co-authored-by: localai-bot <localai-bot@users.noreply.github.com>
2026-03-06 20:44:03 +01:00
..
context chore: allow to set local-ai log format, default to custom one (#7679) 2025-12-21 21:21:59 +01:00
worker chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
backends.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
cli.go chore(cli): add backends CLI to manipulate and install backends (#5787) 2025-07-03 19:31:27 +02:00
explorer.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
federated.go chore: update cogito and simplify MCP logics (#6413) 2025-10-09 12:36:45 +02:00
models.go fix(cli): import via CLI needs system state (#7746) 2025-12-27 11:10:28 +01:00
run.go feat: Add LOCALAI_DISABLE_MCP environment variable to disable MCP support (#8816) 2026-03-06 20:44:03 +01:00
soundgeneration.go feat(musicgen): add ace-step and UI interface (#8396) 2026-02-05 12:04:53 +01:00
transcript.go fix: rename json_verbose to verbose_json (#8627) 2026-02-23 17:57:06 +00:00
tts.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
util.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00