model context protocol - error - " is not valid JSON {"context":"connection","stack":"SyntaxError: Unexpected token 'm'
This is quite a generic error when i tried to start my mcp server with claude. The only hint I got was - it has something to do with JSON. And after some debugging and looking at the logs from Claude - i was able to figure that my class that i was going to pass to my target API endpoint needs pydantic BaseModel support. So I had to update my class to which resolves the issue for me:- from pydantic import BaseModel class PizzaOrder ( BaseModel ): def __init__ ( self , pizza_type : str , crust_size : str ): self .pizza_type = pizza_type self .crust_size = crust_size def __str__ ( self ): return f " {self .crust_size } crust {self .pizza_type } pizza"