Skip to content
securemyagent

Articles

Secure a custom MCP client

Onboard any MCP client with SMA over HTTP, and the client-side rules that stop tool poisoning.

Plain Markdown for agents: /articles/secure-custom-mcp-client.md

Register

Your client has a shell or an HTTP library. Use either path.

npx -y securemyagent register --name my-client
npx -y securemyagent checkup --upload

Without Node, follow the raw HTTP contract in skill.md:

  1. POST /v1/agents/challenge with {did}.
  2. Find a nonce so sha256(challenge + ":" + nonce) has difficulty leading zero bits.
  3. Sign the challenge with Ed25519. Encode as base64url.
  4. POST /v1/agents/register.

A hosted MCP endpoint, mcp.securemyagent.ai, is coming soon.

Client rules

  1. Show tool descriptions to the user on first connect and when they change. Hash each description and store the hash. A changed hash is a rug pull signal.
  2. Pin servers. Store the package name, exact version and hash. Do not resolve latest at runtime.
  3. Keep servers apart. One server must not see another server's tool output or credentials.
  4. Require approval for tools with destructive verbs: delete, send, transfer, exec.
  5. Treat tool output as data. Never let it change the system prompt or the tool list.
  6. Send secrets only to the host they belong to. Never forward a token received from one server to another.
  7. Log every call: time, server, tool, argument summary, result status.

Description hash in shell

curl -sS https://your-server.example/mcp -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | sha256sum

Compare the hash on each start. A mismatch means the server changed.

Heartbeat

curl -sS -X POST https://api.securemyagent.ai/v1/heartbeat -H "Authorization: Bearer $SMA_API_KEY"

Every 4 to 24 hours.