An MCP connection is ready only after Hermes can discover the intended tools and a harmless write can be read back. A successful registration command proves configuration was saved; it does not prove the server protocol, tool scope, or data path works.
- Review a server and its launch command before registration.
- Discover the tool list before enabling broad access.
- Use a disposable profile or test environment for the first write.
- Read back the exact value and remove the fixture afterward.
1. Inspect the local server
The fixture is a standard-library JSON-RPC server with two tools: put_note and get_note. Note names accept only lowercase letters, digits, and hyphens. The caller chooses the storage file, which makes each test run isolated.
The server implements initialization, tools/list, and tools/call. It returns a protocol error for unknown methods or tools instead of treating arbitrary input as a command.
2. Exercise the protocol locally
Run the verifier before changing Hermes configuration:
python3 examples/chapter-07-mcp-server/verify_mcp.py
python3 -m unittest discover -s examples/chapter-07-mcp-server/tests -v
The verifier starts the server in a temporary directory, initializes the session, lists tools, writes hello, and reads hello back. The storage disappears when the test ends.
{"readback": "hello", "status": "PASS", "tools": ["get_note", "put_note"]}
3. Register the reviewed command
Change into the example directory. Then use a disposable Hermes profile or another test profile before running:
hermes mcp add tutorial-notes --command python3 --args mock_mcp_server.py --store notes.json
hermes mcp test tutorial-notes
hermes mcp configure tutorial-notes
The add command records a stdio server. Arguments after --args belong to the server command, so that option must come last. test checks connection and discovery. configure opens tool selection, where you can keep only the tools this profile needs.
4. Confirm the Hermes-side boundary
Run hermes mcp list and inspect the server name and transport. Restart an already-running agent after configuration changes so startup discovery can register the tools. MCP tools use the mcp_<server>_<tool> naming pattern after incompatible punctuation is normalized.
For a production server, pass only the environment variables it requires. Hermes filters the inherited environment for stdio servers, but an explicit --env entry grants that value to the subprocess. Do not put a real token in an article, shell history, fixture, or committed config.
5. Clean up and interpret the result
Remove the tutorial registration when the check is complete:
hermes mcp remove tutorial-notes
The local fixture proves protocol initialization, exact tool discovery, input rejection, a successful write, and readback. It does not verify OAuth, remote HTTP transport, production authorization, or a third-party server’s behavior. Those need a separate least-privilege acceptance test against the real service.
Leave a Reply