Test MCP server exposure

AuthenticationDiscovery

Written with a model's help from “MCP Security Best Practices: Check Your Own Server First” by Shakel Ahmed on Cyber Desserts. Read the writeup before relying on it.

To test if an MCP server is exposed, first check what the process binds to with ss -tlnp | grep -E ':(3000|8000|8080|8443)'. A binding to 0.0.0.0 or [::] means the server is listening on all interfaces. Then, try an unauthenticated call to the server from outside its intended boundary with curl -sS -o /dev/null -w '%{http_code}\n' -X POST https://target.com/mcp/ -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'. A response with a 200 status code and a tools array means the server is exposing its tools to anyone. A 401 or 403 status code means authentication is enforced. If the server responds with a 307 status code, follow the redirect to test the target of the redirect.

Follow #authentication or #mcp for new tips like this one, on your notifications page and, if you choose, in a daily or weekly email.

Comments

No comments yet.