Skip to main content
Glama

pocketbase-mcp-server

SMITHERY_ERROR_FIX.md4.06 kB
# Smithery Error Fix Summary ## Problem Identified The Smithery deployment was failing with the error: ``` Failed to scan tools list from server: Error: Error POSTing to endpoint (HTTP 500): {"jsonrpc":"2.0","error":{"code":-32603,"message":"Error initializing server."},"id":null} ``` ## Root Cause 1. **Import Dependency Issue**: The original `smithery-entry.ts` was importing `ComprehensivePocketBaseMCPAgent` from `./agent-comprehensive.js` 2. **Missing Build Files**: The Smithery build process wasn't compiling all necessary files - the `build/` directory was missing `agent-comprehensive.js` 3. **Complex Dependency Chain**: The comprehensive agent had many service dependencies that weren't being resolved correctly in Smithery's runtime environment ## Solution Applied ### 1. Created Self-Contained Entry Point - Created `src/smithery-entry-fixed.ts` - a simplified, self-contained entry point - No external imports beyond core dependencies (`@modelcontextprotocol/sdk`, `zod`, `pocketbase`) - All functionality contained within a single file ### 2. Updated Package Configuration - Changed `package.json` module entry from `./src/smithery-entry.ts` to `./src/smithery-entry-fixed.ts` ### 3. Implemented Lazy Loading Pattern ```typescript export default function ({ config }: { config: z.infer<typeof configSchema> }) { const parseResult = configSchema.safeParse(config); const serverInstance = new SimplePocketBaseMCPServer(); // Only initialize with config if it's valid if (parseResult.success) { // Async initialization without blocking tool discovery serverInstance.init(validatedConfig).catch(error => { console.error('Server initialization error:', error); }); } // Return server immediately for tool discovery return serverInstance.server; } ``` ### 4. Essential Tools Included The fixed entry point includes 9 essential PocketBase tools: - `health_check` - Server health status - `pocketbase_list_collections` - List collections - `pocketbase_get_collection` - Get collection details - `pocketbase_create_record` - Create records - `pocketbase_get_record` - Get records - `pocketbase_update_record` - Update records - `pocketbase_delete_record` - Delete records - `pocketbase_list_records` - List records with filtering - `pocketbase_auth_with_password` - User authentication - `get_server_status` - Detailed server status ## Key Improvements 1. **No Dependency Issues**: Self-contained with minimal imports 2. **Lazy Configuration**: Handles both tool scanning and runtime configuration 3. **Error Resilience**: Graceful handling of missing/invalid configuration 4. **Smithery Compatible**: Follows Smithery's expected patterns for entry points ## Next Steps 1. **Redeploy to Smithery**: The fixed entry point should resolve the initialization error 2. **Tool Scanning**: Smithery should now be able to scan the 9 available tools 3. **Runtime Testing**: Test with actual PocketBase configuration ## Testing Commands After redeployment, test with: ```bash # Test tool scanning curl -X POST https://your-smithery-endpoint/mcp \ -H "Content-Type: application/json" \ -d '{"method":"tools/list","params":{}}' # Test health check curl -X POST https://your-smithery-endpoint/mcp \ -H "Content-Type: application/json" \ -d '{"method":"tools/call","params":{"name":"health_check","arguments":{}}}' ``` ## Configuration Format for Smithery The server expects configuration in this format: ```json { "pocketbaseUrl": "https://your-pb-instance.com", "adminEmail": "admin@example.com", "adminPassword": "your-admin-password", "debug": false } ``` ## Error Prevention The fix addresses the lazy loading requirement mentioned in the original error: > "Please ensure your server performs lazy loading of configurations" The new entry point: - Returns the server immediately for tool discovery - Performs configuration and initialization asynchronously - Doesn't block or throw errors during the tool scanning phase - Provides helpful debugging information when debug mode is enabled

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DynamicEndpoints/pocketbase-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server