-
Notifications
You must be signed in to change notification settings - Fork 786
Motia mcp server #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Motia mcp server #833
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
| @@ -0,0 +1,55 @@ | |||
| import { ApiRouteConfig, Handlers } from 'motia' | |||
| import { z } from 'zod' | |||
| import { motiaIntrospection } from '../../src/services/mcp/motia-introspection' | |||
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 21 days ago
To fix this issue, the unused import of motiaIntrospection from ../../src/services/mcp/motia-introspection should be removed from the top of the file playground/steps/mcp/init-introspection.step.ts. This change eliminates unnecessary code, improves readability, and may slightly improve startup performance by avoiding an unnecessary import. No other changes are needed as this import is not referenced elsewhere in the file.
| @@ -1,6 +1,5 @@ | ||
| import { ApiRouteConfig, Handlers } from 'motia' | ||
| import { z } from 'zod' | ||
| import { motiaIntrospection } from '../../src/services/mcp/motia-introspection' | ||
|
|
||
| /** | ||
| * Initialization endpoint for MCP introspection service |
E2E Test Results ✅All tests have completed. Tests passed. Matrix: 2 OS (Ubuntu, macOS) × 2 Templates (Node.js, Python) = 4 jobs This comment is automatically posted by the PR E2E Results workflow. |
This pull request adds a comprehensive error handling and introspection system for the Motia MCP Server, along with utilities and middleware for validating requests and origins. The changes introduce structured error classes, core and origin validation middleware, new MCP service modules for tools and resources, and helper functions for building JSON-RPC responses. These improvements enhance the reliability, security, and introspectability of the Motia API.
Testing state in MCP Inspector
Error Handling and Middleware
BaseErrorfor consistent API error handling, including status codes, error codes, and metadata, with atoJSONmethod for API responses.MCPOriginError,MCPMethodNotFoundError, etc.) for granular error reporting in MCP operations.coreMiddlewareto catch and log errors, handle validation and custom errors, and return standardized error responses.originValidationMiddlewareto enforce MCP specification by validating theOriginheader and preventing DNS rebinding attacks.Motia Introspection and MCP Services
motia-introspection.ts, a singleton service for introspecting Motia internals (steps, flows, topics, endpoints) for use by MCP tools and resources.tools,resources,prompts,motia-introspection) to centralize domain-driven MCP logic.MCP Tools and Resources
trigger_workflow,call_api,get_execution_logs, etc.) with input schemas for workflow automation and state management.JSON-RPC Response Utilities