DEV Community

Edison Flores
Edison Flores

Posted on

MCP servers have a trust problem. Here's how to fix it.

The MCP trust gap

The Model Context Protocol (MCP) lets AI agents discover and invoke tools. But when an agent loads an MCP server, there's no standard way to verify:

  • Who issued the server's credential?
  • Is it still valid or has it been revoked?
  • What scope does it have?
  • Can we trust the issuer?

This is a real security gap. An agent that loads any MCP server without verification is like a browser that accepts any TLS certificate.

The fix: verify before loading

import requests

def safe_load_mcp_server(server_card):
    # Verify the credential before loading
    result = requests.post(
        "https://www.marketnow.site/api/trust?action=verify",
        json={"payload": server_card}
    ).json()

    if not result.get("valid"):
        return {"safe": False, "issues": result.get("issues", [])}

    # Check trust score
    score = result.get("uts", {}).get("trust", {}).get("score", 0)
    if score < 3:
        return {"safe": False, "issues": ["Low trust score"]}

    return {"safe": True}
Enter fullscreen mode Exit fullscreen mode

What about the domain?

Before even loading the MCP server, check if the domain is legitimate:

// 100% client-side, no API needed
function checkDomain(domain) {
    const shorteners = ['bit.ly', 'tinyurl.com', 't.co'];
    const suspiciousTlds = ['.zip', '.xyz', '.top', '.click'];

    if (shorteners.some(s => domain.includes(s))) {
        return {safe: false, reason: 'URL shortener detected'};
    }
    if (suspiciousTlds.some(tld => domain.endsWith(tld))) {
        return {safe: false, reason: 'Suspicious TLD'};
    }
    return {safe: true};
}
Enter fullscreen mode Exit fullscreen mode

The full pipeline

  1. Check domain — is the URL suspicious? (client-side)
  2. Verify credential — is the MCP server's card valid? (UTA API)
  3. Check trust score — is the issuer reputable? (UTA UTS)
  4. Check revocation — has the card been revoked? (UTA lifecycle)
  5. Load or block — only load if all checks pass

Try it now

# Verify any credential
curl -X POST "https://www.marketnow.site/api/trust?action=verify" -H "Content-Type: application/json" -d '{"payload":{"@context":["https://www.w3.org/2018/credentials/v1"],"type":["VerifiableCredential"],"issuer":"did:web:alice.example","credentialSubject":{"id":"did:agent:bob"},"proof":{"type":"Ed25519Signature2020","verificationMethod":"did:web:alice.example#key-1","proofValue":"placeholder"}}}'
Enter fullscreen mode Exit fullscreen mode

Links


MCP is great. Trust verification makes it safe.

Top comments (0)