Skip to main content
Glama
DynamicEndpoints

Document Extractor MCP Server

authenticate

Verify authentication credentials for PocketBase to enable document extraction and storage from Microsoft Learn and GitHub sources.

Instructions

Test authentication with PocketBase using provided credentials

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pocketbaseUrlYesPocketBase server URL (e.g., https://your-pb-instance.com)
emailYesPocketBase admin email for authentication
passwordYesPocketBase admin password

Implementation Reference

  • The 'authenticate' tool implementation, which tests PocketBase credentials and updates global server configuration if successful.
    const authenticateTool = server.tool(
      'authenticate',
      'Test authentication with PocketBase using provided credentials',
      {
        pocketbaseUrl: z.string().url('Invalid URL format').describe('PocketBase server URL (e.g., https://your-pb-instance.com)'),
        email: z.string().email('Invalid email format').describe('PocketBase admin email for authentication'),
        password: z.string().min(1, 'Password cannot be empty').describe('PocketBase admin password')
      },
      async ({ pocketbaseUrl, email, password }) => {
        try {
          // Create a temporary PocketBase instance for testing
          const testPb = new PocketBase(pocketbaseUrl);
          
          // Attempt authentication using the correct superuser collection
          const authData = await testPb.collection('_superusers').authWithPassword(email, password);
          
          // Test basic functionality by fetching collections
          const collections = await testPb.collections.getList(1, 10);
          
          // Get server health to verify connectivity
          const healthCheck = await testPb.health.check();
          
          // Update the global configuration if authentication succeeds
          process.env.POCKETBASE_URL = pocketbaseUrl;
          process.env.POCKETBASE_EMAIL = email;
          process.env.POCKETBASE_PASSWORD = password;
          
          // Reset configuration to force reload with new credentials
          configInitialized = false;
          pb = null;
          initializeConfig();
          
          return {
            content: [
              {
                type: 'text',
                text: `✅ **Authentication Successful!**\n\n` +
                      `**PocketBase Server:** ${pocketbaseUrl}\n` +
                      `**Admin Email:** ${email}\n` +
                      `**Admin ID:** ${authData.record.id}\n` +
                      `**Created:** ${new Date(authData.record.created).toLocaleString()}\n` +
                      `**Token Valid:** ${testPb.authStore.isValid}\n\n` +
                      `**Server Info:**\n` +
                      `- Server Status: ${healthCheck?.message || 'Healthy'}\n` +
                      `- Collections Available: ${collections.totalItems}\n` +
                      `- Sample Collections: ${collections.items.slice(0, 3).map(c => c.name).join(', ')}\n\n` +
                      `🔧 **Configuration Updated** - You can now use other tools that require PocketBase access.\n\n` +
                      `**Available Tools:**\n` +
                      `- \`extract_document\`: Extract and store documents\n` +
                      `- \`list_documents\`: List stored documents\n` +
                      `- \`search_documents\`: Search document content\n` +
                      `- \`get_document\`: Get specific document by ID\n` +
                      `- \`delete_document\`: Delete a document\n` +
                      `- \`ensure_collection\`: Create documents collection if needed\n` +
                      `- \`collection_info\`: Get collection statistics\n` +
                      `- \`connection_status\`: Check current connection status`
              }
            ]
          };
        } catch (error) {
          let errorMessage = error.message;
          let troubleshooting = '';
          let statusCode = error.status || 0;
          
          if (statusCode === 400) {
            errorMessage = 'Invalid credentials - please check your email and password';
            troubleshooting = '\n\n**Troubleshooting:**\n' +
                             '• Verify email and password are correct\n' +
                             '• Ensure the account has admin/superuser privileges\n' +
                             '• Check if the admin account exists in PocketBase';
          } else if (statusCode === 404) {
            errorMessage = 'Admin user not found - account may not exist';
            troubleshooting = '\n\n**Troubleshooting:**\n' +
                             '• Create an admin account in PocketBase\n' +
                             '• Ensure you\'re using the correct email address\n' +
                             '• Check PocketBase admin dashboard for existing accounts';
          } else if (error.message.includes('fetch') || error.message.includes('ECONNREFUSED')) {
            errorMessage = 'Cannot connect to PocketBase server - please check the URL';
            troubleshooting = '\n\n**Troubleshooting:**\n' +
                             '• Verify the PocketBase URL is correct\n' +
                             '• Ensure PocketBase is running and accessible\n' +
                             '• Check for network connectivity issues\n' +
                             '• Verify firewall settings allow connections';
          } else if (statusCode === 401) {
            errorMessage = 'Unauthorized - authentication rejected by server';
            troubleshooting = '\n\n**Troubleshooting:**\n' +
                             '• Check if admin authentication is enabled\n' +
                             '• Verify account credentials are correct\n' +
                             '• Ensure PocketBase server is properly configured';
          }
          
          return {
            content: [
              {
                type: 'text',
                text: `❌ **Authentication Failed**\n\n` +
                      `**Error:** ${errorMessage}\n` +
                      `**Server:** ${pocketbaseUrl}\n` +
                      `**Email:** ${email}\n` +
                      `**Status Code:** ${statusCode || 'Unknown'}${troubleshooting}\n\n` +
                      `**Common Solutions:**\n` +
                      `• Make sure PocketBase is running and accessible\n` +
                      `• Verify admin credentials in PocketBase dashboard\n` +
                      `• Check server URL format (include http:// or https://)\n` +
                      `• Ensure no trailing slash in the URL`
              }
            ],
            isError: true
          };
        }
      }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It fails to clarify whether 'Test' means validation-only (read-only) or if it establishes a persistent session/token for subsequent calls. No mention of return values, error conditions, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise at 7 words with no redundancy. Information density is appropriate for the length, though brevity contributes to other gaps.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

As an authentication tool with no output schema and no annotations, the description should explain success indicators, return format (token?), and relationship to subsequent operations. Current description is insufficient for a security-critical operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema documents all three parameters adequately. The description adds minimal semantic value beyond the schema, merely noting that email/password are 'credentials' and that PocketBase is the target system.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies the verb (Test authentication), resource (PocketBase), and mechanism (provided credentials). However, it does not explicitly differentiate from the sibling 'connection_status' tool, which also relates to server connectivity verification.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance provided on when to use this tool versus 'connection_status' or other prerequisites. It does not indicate whether this should be called before other operations or what indicates authentication success.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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/documentation-mcp-using-pocketbase'

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