Skip to main content
Glama

scp_discover

Discover SCP endpoints for merchant domains using DNS lookup to enable secure access to e-commerce data and personalized shopping assistance.

Instructions

Discover SCP endpoint for a merchant domain via DNS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesMerchant domain

Implementation Reference

  • The main handler function for the 'scp_discover' tool. It invokes discoverWithCapabilities and formats the response as MCP tool content.
    async function handleDiscover(domain: string) {
      const discovery = await discoverWithCapabilities(domain);
    
      if (!discovery) {
        throw new Error(`Could not discover Shopper Context Protocol endpoint for ${domain}`);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              domain,
              scp_endpoint: discovery.endpoint,
              discovery_method: 'dns_txt',
              capabilities: discovery.capabilities
            }, null, 2)
          }
        ]
      };
    }
  • Core helper function that discovers the SCP endpoint using DNS TXT records, caching, or fallbacks, and fetches endpoint capabilities.
    export async function discoverWithCapabilities(domain: string): Promise<{
      endpoint: string;
      capabilities: SCPCapabilities;
    } | null> {
      const endpoint = await discoverSCPEndpoint(domain);
    
      if (!endpoint) {
        return null;
      }
    
      try {
        const capabilities = await fetchCapabilities(endpoint);
    
        // Update cache with capabilities
        await cacheEndpoint({
          domain,
          endpoint,
          capabilities,
          discovered_at: Date.now(),
          ttl: 86400
        });
    
        return { endpoint, capabilities };
      } catch (error) {
        // Capabilities fetch failed, but we have endpoint
        return { endpoint, capabilities: null as any };
      }
    }
  • Input schema definition for the scp_discover tool, requiring a 'domain' parameter.
    name: 'scp_discover',
    description: 'Discover SCP endpoint for a merchant domain via DNS',
    inputSchema: {
      type: 'object',
      properties: {
        domain: {
          type: 'string',
          description: 'Merchant domain'
        }
      },
      required: ['domain']
    }
  • src/server.ts:558-559 (registration)
    Tool registration in the central CallToolRequestSchema switch statement, routing calls to the handleDiscover function.
    case 'scp_discover':
      return await handleDiscover(args.domain as string);
  • Supporting helper that performs the actual endpoint discovery via test override, demo mode, cache, DNS TXT (_scp._tcp.domain), or fallback HTTP methods.
    export async function discoverSCPEndpoint(domain: string): Promise<string | null> {
      // Check for test endpoint override first
      const testEndpoint = checkTestEndpoint(domain);
      if (testEndpoint) {
        return testEndpoint;
      }
    
      // Check for demo mode
      const config = loadConfig();
      if (config.demo_mode) {
        const demoEndpoint = config.demo_endpoint || 'https://demo.shoppercontextprotocol.io/v1';
        console.error(`[SCP] Demo mode enabled - using ${demoEndpoint} for all domains`);
        return demoEndpoint;
      }
    
      // Check cache first
      const cached = await getCachedEndpoint(domain);
      if (cached) {
        return cached.endpoint;
      }
    
      // Try DNS TXT record
      const dnsEndpoint = await tryDNSDiscovery(domain);
      if (dnsEndpoint) {
        // Cache the result
        await cacheEndpoint({
          domain,
          endpoint: dnsEndpoint,
          capabilities: null,
          discovered_at: Date.now(),
          ttl: 86400 // 24 hours
        });
        return dnsEndpoint;
      }
    
      // Try fallback methods
      const fallbackEndpoint = await tryFallbackDiscovery(domain);
      if (fallbackEndpoint) {
        // Cache the result
        await cacheEndpoint({
          domain,
          endpoint: fallbackEndpoint,
          capabilities: null,
          discovered_at: Date.now(),
          ttl: 86400 // 24 hours
        });
        return fallbackEndpoint;
      }
    
      return null;
    }
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 mentions DNS-based discovery but doesn't disclose behavioral traits like whether this is a read-only operation, what happens on failure, if there are rate limits, or what format the discovered endpoint information takes. For a discovery tool with zero annotation coverage, this leaves critical operational context unspecified.

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?

The description is a single, efficient sentence that communicates the core functionality without unnecessary words. It's appropriately sized for a simple discovery tool and front-loads the essential information. Every word earns its place.

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?

Given the tool's role in an SCP ecosystem with multiple sibling tools, the description is insufficiently complete. It doesn't explain how the discovered endpoint integrates with other tools (like scp_authorize), what the output contains, or why discovery is needed. With no annotations and no output schema, the description should provide more operational context for effective agent use.

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% with one parameter ('domain' described as 'Merchant domain'), so the schema already documents the parameter adequately. The description doesn't add meaningful semantic context beyond what the schema provides, such as domain format requirements or DNS lookup specifics. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the action ('Discover') and target ('SCP endpoint for a merchant domain via DNS'), making the purpose understandable. It distinguishes from siblings by focusing on endpoint discovery rather than authorization, intent management, or data retrieval operations. However, it doesn't explicitly contrast with specific sibling tools.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a merchant domain before other operations), when discovery is necessary, or what to do with the discovered endpoint. With multiple sibling tools for authorization and data operations, this lack of contextual guidance is a significant gap.

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/shopper-context-protocol/scp-mcp-wrapper'

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