Skip to main content
Model Context Protocol (MCP) Server for QWED Verification PyPI version Tests License QWED-MCP brings deterministic computation to Claude Desktop, VS Code, and any MCP-compatible AI assistant. Instead of trusting LLMs to compute correctly, QWED-MCP runs Python scripts written by the assistant. From v0.3.0, a script runs only when every module, builtin and attribute it uses is on an allowlist of computation-only standard-library features. All execution is local. Use QWED-MCP when you want an MCP-compatible assistant to check a calculation or an argument with a script instead of computing the answer itself.
execute_python_code runs admitted code in a subprocess with the server’s privileges. It is not a sandbox. The subprocess gets a restricted set of environment variables, and calls pass through the RiskBasedExecutionGateway, but only enable code execution where you trust the inputs.

Why QWED-MCP?

The problem

LLMs are unreliable for:
  • Mathematical calculations - They approximate, don’t compute
  • Logical reasoning - They guess patterns, don’t prove
  • Code security - They miss edge cases, don’t analyze
  • SQL queries - They don’t validate, just generate

The solution

QWED-MCP gives AI assistants a single execute_python_code tool. The LLM writes a Python script, the server admits it only if it stays within the allowlist, and then runs it in a subprocess with restricted environment variables and the server’s privileges. From v0.3.0, scripts can’t import third-party packages, so SymPy, Z3 and the QWED SDK packages are not available to them. Executing a script is not itself verification: what a run checks depends entirely on the script the assistant wrote, so review it. See qwedai.tech/limits.

How it works


Available tools

All tool calls pass through the RiskBasedExecutionGateway before dispatch. The gateway validates arguments, runs the allowlist admission check, and enforces admin policy. The gateway blocks unknown tools by default.
In v0.1.x, QWED-MCP exposed individual tools like verify_math, verify_logic, verify_code, and verify_sql. These were consolidated into execute_python_code in v0.2.1 to solve context bloat (RFC-9728 compatibility). See migration guide.

Installation

qwed-mcp 0.2.3 and later require Python 3.10 or later and the MCP Python SDK mcp>=1.30.0,<2. MCP SDK 2.x removed the server API that qwed-mcp uses, so pip keeps the SDK on 1.x. From v0.3.0, qwed-mcp no longer installs qwed-finance or qwed-ucp, and no longer declares httpx directly (mcp still installs it). If your own code imports any of them, add them to your own project’s dependencies.

From source

Verify installation

The qwed-mcp command starts the server over stdio and has no --version flag.

Quick start

Claude Desktop setup

  1. Find your config file:
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add QWED-MCP server:
  1. Restart Claude Desktop
  2. Test it! Ask Claude:
    “Write a Python script that verifies a $10,000 investment at 7.5% for 5 years using the compound interest formula, and run it using execute_python_code.”

VS Code setup

  1. Install MCP extension (if not already)
  2. Add to settings.json:
  1. Restart VS Code

Python client

You can also use QWED-MCP programmatically:

Configuration

Environment variables

Set QWED_MCP_TRUSTED_CODE_EXECUTION to true to enable code execution. The executed code runs with server privileges — ensure inputs are from trusted sources.

Example with environment variables

Windows (PowerShell):
macOS/Linux:

Use cases

1. Financial calculations

Verify that AI-generated financial calculations are correct:

2. Research validation

Check that a conclusion follows from its premises:

3. Refused code

Code that reaches outside the allowlist is refused before it runs: