Skip to content

Instantly share code, notes, and snippets.

@jherr
Last active June 12, 2025 14:10
Show Gist options
  • Save jherr/3535c82ef14db4120481951f71c8df89 to your computer and use it in GitHub Desktop.
Save jherr/3535c82ef14db4120481951f71c8df89 to your computer and use it in GitHub Desktop.
Interacting With An MCP Server In The Terminal

Step 1. Start a server up in the terminal

uvx mcp-server-fetch

Step 2. Initialize it by copy and pasting this JSON-RPC invocation (and hit return)

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"sampling":{},"roots":{"listChanged":true}},"clientInfo":{"name":"mcp-inspector","version":"0.12.0"}}}

Step 3. Notify the server that it's now initialized

{"jsonrpc":"2.0","method":"notifications/initialized"}

Step 4. Ask the server for its tools (if you want to, this is optional)

{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"progressToken":1}}}

Step 5. Invoke a tool (in this case fetch)

{"jsonrpc": "2.0", "method": "tools/call", "params": { "name": "fetch", "arguments": { "url": "https://jsonplaceholder.typicode.com/todos/1", "raw": true }, "_meta": { "progressToken": 1 } }, "id": 1}

Note: Do not format these lines of JSON-RPC to cover multiple lines. A new line signifies the end of a message. So the entire JSON payload needs to be on a single line. Use "\n" to indicate new lines if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment