MCP Inspector
- Helps troubleshooting a MCP server
- https://modelcontextprotocol.io/docs/tools/inspector
- https://github.com/modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector # connect later to a mcp server e.g., https://docs.langchain.com/mcp
npx @modelcontextprotocol/inspector <command> # start a server stdio
Exploring MCP with curl
- Remote MCP uses the
Streamable HTTPtransport: a single POST endpoint speaking JSON-RPC 2.0 - Responses come back as
text/event-stream(SSE-framed): each message arrives asevent: message\ndata: {...json...} - Required headers on every POST:
Content-Type: application/jsonAccept: application/json, text/event-stream- Some servers issue an
Mcp-Session-Idresponse header oninitializethat must be echoed back on subsequent requests - Handshake order:
initialize→notifications/initialized(HTTP 202, no body) → any operation (tools/list,tools/call, ...)
1. Initialize
curl -s -X POST https://docs.langchain.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {"name": "curl", "version": "0.1"}
}
}'
Server replies with its protocolVersion, advertised capabilities (tools/resources/prompts), and serverInfo.
2. Send the initialized notification
Notifications have no id; the server responds with HTTP 202 and an empty body.
curl -s -X POST https://docs.langchain.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"notifications/initialized"}'
3. List and call tools
# list tools
curl -s -X POST https://docs.langchain.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# call a tool
curl -s -X POST https://docs.langchain.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "search_docs_by_lang_chain",
"arguments": {"query": "what is langgraph"}
}
}'
Other useful methods: resources/list, resources/read, prompts/list, prompts/get, ping.