Skip to main content
Glama

Claude Consultant

An MCP server that proxies technical questions to Claude Sonnet (claude-sonnet-4-6), acting as a senior network engineer / Linux / RouterOS 7 expert.

Before forwarding any request to the Claude API, the server automatically detects and masks sensitive data (IP addresses, MAC addresses, WireGuard keys, passwords, Bearer tokens, SSH private keys, hostnames, and secret file paths).


Quick start

cd /home/mgrigorov/claude-consultant
cp .env.example .env
# Edit .env — set ANTHROPIC_API_KEY and CONSULTANT_API_TOKEN
sudo bash install.sh

Related MCP server: pfSense MCP Server

Manual setup (without systemd)

python3.12 -m venv venv
source venv/bin/activate
pip install -e .
pip install pytest pytest-asyncio httpx   # for tests only

cp .env.example .env
# edit .env

# Run tests
pytest -v

# stdio MCP mode (for MCP clients like Claude Code)
source .env && claude-consultant

# HTTP mode (for testing with curl)
source .env && claude-consultant --http

Project structure

claude-consultant/
├── src/claude_consultant/
│   ├── config.py          # Env-var configuration
│   ├── sanitizer.py       # Sanitization pipeline (zero external deps)
│   ├── claude_client.py   # Anthropic SDK wrapper
│   └── server.py          # Entrypoint: MCP stdio + HTTP modes
├── tests/
│   ├── test_sanitizer.py  # Pattern tests + edge cases
│   ├── test_mcp_tool.py   # MCP tool tests (mocked API)
│   └── test_http_endpoint.py  # HTTP auth + request tests
├── logs/                  # Created at runtime
├── .env.example
├── claude-consultant.service
├── install.sh
└── pyproject.toml

Configuration

Variable

Required

Default

Description

ANTHROPIC_API_KEY

Yes

—

Anthropic API key

CONSULTANT_API_TOKEN

HTTP mode

—

Bearer token for HTTP endpoint

LOG_DIR

No

./logs

Directory for log files

MAX_TOKENS

No

2048

Max tokens in Claude response

LOG_LEVEL

No

INFO

Logging level


MCP tool: consult_claude

Input

Field

Type

Description

problem

string (required)

Description of the problem

context

string (optional)

Config snippets, error output, logs

Output — Claude's response as plain text.

Example (Claude Code)

Use the consult_claude tool with problem="BGP session drops every 30 minutes" and context="<router logs here>"

HTTP API

POST /consult

Requires Authorization: Bearer <CONSULTANT_API_TOKEN> header.

curl -s -X POST http://localhost:8765/consult \
     -H "Authorization: Bearer $CONSULTANT_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"problem": "OSPF neighbour not forming", "context": "interface ether1 is up"}'

Response

{
  "answer": "Check that ...",
  "sanitized_fields": 0
}

GET /health

No auth required. Returns {"status": "ok"}.


Sanitization pipeline

The following patterns are detected and replaced before any data leaves the host:

Pattern

Token

IPv4 addresses

<IPv4_ADDR_N>

IPv6 addresses

<IPv6_ADDR_N>

MAC addresses

<MAC_ADDR_N>

WireGuard keys (44-char base64)

<WG_KEY_N>

SSH/PEM private key blocks

<SSH_PRIVATE_KEY_N>

Generic private keys (base64 40+)

<PRIVATE_KEY_N>

Passwords (password=X, passwd: X, …)

<PASSWORD_N>

Bearer / API tokens

<API_TOKEN_N>

/etc/ssl/, /etc/wireguard/, … paths

<SECRET_PATH_N>

FQDNs (3+ labels with alpha TLD)

<HOSTNAME_N>

Preserved: VLAN IDs, port numbers, protocol names, CIDR masks (/24), RFC 1918 example ranges (192.168.x.x/24), RouterOS commands, error messages.

Every substitution is logged to logs/sanitization.log with pattern type and character position. The internal reverse mapping is never serialised or transmitted.


Running tests

source venv/bin/activate
pytest -v

systemd management

sudo systemctl status claude-consultant
sudo systemctl restart claude-consultant
sudo journalctl -u claude-consultant -f

Security notes

  • Secrets are loaded exclusively from environment variables / .env file.

  • The .env file is read by systemd's EnvironmentFile= directive; never committed to git.

  • HTTP mode enforces Bearer token authentication on every request.

  • systemd unit runs with NoNewPrivileges=yes, PrivateTmp=yes, ProtectSystem=strict.

  • The sanitization reverse mapping exists only in process memory and is discarded after each request — it is never logged, returned, or persisted.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP-compatible clients such as Claude Desktop to interact with Juniper Junos network devices, exposing tools for running operational commands, applying and committing configuration changes with guardrails, and managing device connections over stdio or streamable-http transports. Supports password and SSH key authentication, connection pooling, and token-based access control for the HTTP transport.
      Apache 2.0
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables natural-language management of firewall rules, NAT, VPNs, DNS, DHCP, routing, certificates, services, and diagnostics from Claude Desktop, Claude Code, or any MCP client, with safety guardrails, rate limits, audit logging, and config backup/rollback.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to drive switches, servers, and consoles over SSH or serial Console through 28 MCP tools, auto-detecting vendors, paging through long output, and cleaning raw byte streams into readable text. Provides structured diagnostics (interfaces, ARP/MAC/routing tables, ping, logs, health checks) plus a three-tier safety model with audit logging, credential redaction, and dry-run config changes.
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables Claude and other MCP-compatible AI assistants to monitor and configure RouterOS routers and switches over the REST API for v7 or the binary API for v6/v7. Supports status checks, interfaces, routes, firewall rules, DHCP leases, Wi-Fi clients, logs, diagnostics, backups, and configuration changes with read-only and per-device safety controls.
      22
      1
      MIT