Inspecting the MCP surface

~2 min read

Inspecting the MCP surface

There’s no dedicated lettuce mcp subcommand — the MCP server is the JSON-RPC endpoint that lettuce serve (or the app) exposes at POST /mcp. To inspect or test the tool surface from the shell, talk to that endpoint directly with curl. Everything an MCP client sees, you can see the same way.

First, start a server and grab the key it prints (see CLI cookbook/01 lettuce serve):

lettuce serve ~/Notes        # prints the API key in the banner
BASE=http://127.0.0.1:51234
AUTH="Authorization: Bearer $LETTUCE_API_KEY"

List the tools

tools/list returns every tool with its JSON input schema — the same thing an agent reads on connect:

curl -sH "$AUTH" -H 'Content-Type: application/json' -X POST "$BASE/mcp" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq '.result.tools[].name'

Pipe through jq '.result.tools[] | {name, description}' for the descriptions, or drop the jq to see the full schemas.

Call a tool

tools/call invokes a tool by name with an arguments object:

curl -sH "$AUTH" -H 'Content-Type: application/json' -X POST "$BASE/mcp" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
       "params":{"name":"list_notes","arguments":{"limit":5}}}' | jq .

A tool that fails returns a tools/call result with isError: true and a kind (see Agent reference/08 Errors and rate limits); a protocol error comes back in the JSON-RPC error shape.

Or use the REST mirror

Every tool is also reachable over plain HTTP at /api/v1 — often easier for a quick check than hand-rolling JSON-RPC. See Agent reference/10 REST API:

curl -sH "$AUTH" "$BASE/api/v1/notes?limit=5"