Typescript Error while creating MCPServer with workflows

I have mcp server defined in server.ts then I'm registering everything in index.ts Everything seem to work fine but editor shows TS Error:
Type 'Workflow<DefaultEngineType, Step<string, any, any, any, any, DefaultEngineType>[], "to-uppercase", ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { ...; }, { ...; }>, ZodObject<...>, ZodObject<...>>' is not assignable to type 'Workflow<any, Step<string, any, any, any, any, any>[], string, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>, ZodType<...>>'.
Types of property 'then' are incompatible.
Type '<TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { string: string; }, { string: string; }>, TSchemaOut, any, any, DefaultEngineType>) => Workflow<...>' is not assignable to type '<TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, ZodType<any, ZodTypeDef, any>, TSchemaOut, any, any, any>) => Workflow<any, Step<string, ... 4 more ..., any>[], string, ZodType<...>, ZodType<...>, TSchemaOut>'.
Types of parameters 'step' and 'step' are incompatible.
Type 'Step<any, ZodType<any, ZodTypeDef, any>, any, any, any, any>' is not assignable to type 'Step<any, ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { string: string; }, { string: string; }>, any, any, any, DefaultEngineType>'.
Types of property 'inputSchema' are incompatible.
Type 'ZodType<any, ZodTypeDef, any>' is missing the following properties from type 'ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { string: string; }, { string: string; }>': _cached, _getCached, shape, strict, and 14 more.ts(2322)
Type 'Workflow<DefaultEngineType, Step<string, any, any, any, any, DefaultEngineType>[], "to-uppercase", ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { ...; }, { ...; }>, ZodObject<...>, ZodObject<...>>' is not assignable to type 'Workflow<any, Step<string, any, any, any, any, any>[], string, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>, ZodType<...>>'.
Types of property 'then' are incompatible.
Type '<TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { string: string; }, { string: string; }>, TSchemaOut, any, any, DefaultEngineType>) => Workflow<...>' is not assignable to type '<TStepId extends string, TSchemaOut extends z.ZodType<any>>(step: Step<TStepId, ZodType<any, ZodTypeDef, any>, TSchemaOut, any, any, any>) => Workflow<any, Step<string, ... 4 more ..., any>[], string, ZodType<...>, ZodType<...>, TSchemaOut>'.
Types of parameters 'step' and 'step' are incompatible.
Type 'Step<any, ZodType<any, ZodTypeDef, any>, any, any, any, any>' is not assignable to type 'Step<any, ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { string: string; }, { string: string; }>, any, any, any, DefaultEngineType>'.
Types of property 'inputSchema' are incompatible.
Type 'ZodType<any, ZodTypeDef, any>' is missing the following properties from type 'ZodObject<{ string: ZodString; }, "strip", ZodTypeAny, { string: string; }, { string: string; }>': _cached, _getCached, shape, strict, and 14 more.ts(2322)
anyone knows what I'm doing wrong here?
2 Replies
_roamin_
_roamin_5w ago
Hi, @Michał Świtoń ! I'm not able to reproduce, I pasted your code and I'm not getting any typing error. Which zod version are you using? Could you paste your dependencies versions? Thanks!
Michał Świtoń
Michał ŚwitońOP5w ago
sure, I was on regular versions after I created a new Mastra project but then I switched to alpha versions to check if anything changes. For me both Webstorm and VSCode displays the same error in the same line: server.ts:47

Did you find this page helpful?