| name | mfl-mcp-client |
| description | Using machin-mcp as a tool server from any MCP-compatible client (Claude Code, Claude Desktop) or directly via bash from pi or other agents. Covers registration, tool discovery, and direct protocol calls. |
Using machin-mcp as a Tool Server
machin-mcp is a 31 KB static binary MCP server. It exposes 6 tools over stdio using JSON-RPC 2.0.
Option 1: Claude Code (native MCP support)
claude mcp add machin-mcp -- /path/to/machin-mcp
claude mcp get machin-mcp
Once registered, Claude Code will automatically:
- Call
tools/list on startup to discover available tools
- Display them in the 🔌 MCP servers panel
- Call
tools/call when it decides a tool would help
- Pass the results back to the LLM
Option 2: Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"machin-mcp": {
"command": "/path/to/machin-mcp"
}
}
}
Option 3: Direct from any agent (pi, Claude Code CLI, etc.)
Call the MCP server directly via bash. Each request is one JSON line → one JSON line response.
Initialize session
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | ./mcp
Discover tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./mcp
Call a tool
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"now","arguments":{}}}' | ./mcp
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"read_file","arguments":{"path":"/etc/hostname"}}}' | ./mcp
Multi-request session (persistent)
For multiple requests, pipe them all to one server process:
{
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'
echo '{"jsonrpc":"2.0","method":"notifications/initialized"}'
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"now","arguments":{}}}'
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_dir","arguments":{"path":"."}}}'
} | ./mcp
Available tools
| Tool | What it does | When an agent should use it |
|---|
echo | Echoes back input | Testing MCP connectivity |
now | Returns current date/time | When the agent needs to know the current time |
read_file | Reads any file | Inspecting logs, configs, source files |
write_file | Writes content to a file | Creating/modifying files with structured content |
list_dir | Lists directory entries | Exploring directory structure |
sqlite_query | Runs SQL queries | Querying SQLite databases, inspecting data |
Protocol notes for agents
- JSON must be compact (single line) — the stdio transport reads one line per message
- Initialize first —
initialize must be the first call; notifications/initialized is optional
- Notifications (no
id field) get no response — send them but don't wait for a reply
- String arguments — use
json() in MFL or json.dumps() in Python to properly escape strings with newlines, quotes, etc.
- Error responses have
"isError":true in the result — check for this before using the content
- Unknown methods return error code
-32601 (MethodNotFound)
Example: pi using machin-mcp via bash
In a pi session, the agent can call machin-mcp tools using the bash tool:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | /path/to/machin-mcp | tail -1 | python3 -c "import json,sys; print(json.load(sys.stdin)['result']['serverInfo'])"
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"read_file","arguments":{"path":"/var/log/syslog"}}}' | /path/to/machin-mcp | tail -1