litellm - 💡(How to fix) Fix [Bug]: impossible to add MCP Serverrs [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24345Fetched 2026-04-08 01:13:13
View on GitHub
Comments
4
Participants
3
Timeline
11
Reactions
1
Timeline (top)
commented ×4subscribed ×3mentioned ×2closed ×1

Error Message

prisma.errors.FieldNotFoundError: Could not find field at createOneLiteLLM_MCPServerTable.data.approval_status INFO: 172.18.0.1:50590 - "POST /v1/mcp/server HTTP/1.1" 500 Internal Server Error 07:22:52 - LiteLLM Proxy:ERROR: proxy_server.py:5017 - litellm.proxy.proxy_server.py::ProxyConfig:_init_guardrails_in_db - 1 validation error for LitellmParams on_violation Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/literal_error Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 5013, in _init_guardrails_in_db IN_MEMORY_GUARDRAIL_HANDLER.sync_guardrail_from_db( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ guardrail=cast(Guardrail, guardrail), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 687, in sync_guardrail_from_db return self.reinitialize_guardrail( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ guardrail=guardrail, config_file_path=config_file_path ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 666, in reinitialize_guardrail return self.initialize_guardrail( ~~~~~~~~~~~~~~~~~~~~~~~~~^ guardrail=guardrail, config_file_path=config_file_path ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 426, in initialize_guardrail litellm_params = LitellmParams(**litellm_params_data) File "/usr/lib/python3.13/site-packages/litellm/types/guardrails.py", line 781, in init super().init(**kwargs) ~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/pydantic/main.py", line 250, in init validated_self = self.pydantic_validator.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for LitellmParams on_violation Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/literal_error INFO: 172.18.0.1:57080 - "GET /v1/mcp/server/health HTTP/1.1" 200 OK

Code Example

prisma.errors.FieldNotFoundError: Could not find field at `createOneLiteLLM_MCPServerTable.data.approval_status`
INFO:     172.18.0.1:50590 - "POST /v1/mcp/server HTTP/1.1" 500 Internal Server Error
07:22:52 - LiteLLM Proxy:ERROR: proxy_server.py:5017 - litellm.proxy.proxy_server.py::ProxyConfig:_init_guardrails_in_db - 1 validation error for LitellmParams
on_violation
  Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 5013, in _init_guardrails_in_db
    IN_MEMORY_GUARDRAIL_HANDLER.sync_guardrail_from_db(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        guardrail=cast(Guardrail, guardrail),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 687, in sync_guardrail_from_db
    return self.reinitialize_guardrail(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        guardrail=guardrail, config_file_path=config_file_path
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 666, in reinitialize_guardrail
    return self.initialize_guardrail(
           ~~~~~~~~~~~~~~~~~~~~~~~~~^
        guardrail=guardrail, config_file_path=config_file_path
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 426, in initialize_guardrail
    litellm_params = LitellmParams(**litellm_params_data)
  File "/usr/lib/python3.13/site-packages/litellm/types/guardrails.py", line 781, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pydantic/main.py", line 250, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for LitellmParams
on_violation
  Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error
INFO:     172.18.0.1:57080 - "GET /v1/mcp/server/health HTTP/1.1" 200 OK
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Impossible to add MCP Server

Steps to Reproduce

  1. GO to MCP menu
  2. try to add a MCP serves as described in the doc like deepwiki
  3. display is good : tools ...
  4. try to save it

Relevant log output

prisma.errors.FieldNotFoundError: Could not find field at `createOneLiteLLM_MCPServerTable.data.approval_status`
INFO:     172.18.0.1:50590 - "POST /v1/mcp/server HTTP/1.1" 500 Internal Server Error
07:22:52 - LiteLLM Proxy:ERROR: proxy_server.py:5017 - litellm.proxy.proxy_server.py::ProxyConfig:_init_guardrails_in_db - 1 validation error for LitellmParams
on_violation
  Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 5013, in _init_guardrails_in_db
    IN_MEMORY_GUARDRAIL_HANDLER.sync_guardrail_from_db(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        guardrail=cast(Guardrail, guardrail),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 687, in sync_guardrail_from_db
    return self.reinitialize_guardrail(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        guardrail=guardrail, config_file_path=config_file_path
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 666, in reinitialize_guardrail
    return self.initialize_guardrail(
           ~~~~~~~~~~~~~~~~~~~~~~~~~^
        guardrail=guardrail, config_file_path=config_file_path
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_registry.py", line 426, in initialize_guardrail
    litellm_params = LitellmParams(**litellm_params_data)
  File "/usr/lib/python3.13/site-packages/litellm/types/guardrails.py", line 781, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pydantic/main.py", line 250, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for LitellmParams
on_violation
  Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error
INFO:     172.18.0.1:57080 - "GET /v1/mcp/server/health HTTP/1.1" 200 OK

What part of LiteLLM is this about?

No response

What LiteLLM version are you on ?

last main

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

The issue seems to be related to invalid input for on_violation in LitellmParams. To fix this, we need to update the on_violation value to either 'warn' or 'end_session'.

Here are the steps to fix the issue:

  • Update the LitellmParams model to use a valid on_violation value.
  • Modify the code that creates the LitellmParams instance to pass a valid on_violation value.

Example code:

from pydantic import BaseModel

class LitellmParams(BaseModel):
    on_violation: str  # Should be 'warn' or 'end_session'

# Create a LitellmParams instance with a valid on_violation value
litellm_params = LitellmParams(on_violation='warn')

Alternatively, you can update the litellm_params_data dictionary to contain a valid on_violation value before creating the LitellmParams instance:

litellm_params_data = {'on_violation': 'warn'}
litellm_params = LitellmParams(**litellm_params_data)

Verification

To verify that the fix worked, try adding a MCP server again and check the logs for any errors related to LitellmParams validation.

Extra Tips

  • Make sure to update the LitellmParams model and the code that creates the LitellmParams instance to use a valid on_violation value.
  • If you are using a configuration file to store the LitellmParams data, update the configuration file to contain a valid on_violation value.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING