Skip to main content

Introduction

The Pricing Intelligence MCP Server is a Python-based implementation of the Model Context Protocol (MCP) that orchestrates A-MINT transformation APIs and the Analysis API to answer complex pricing questions. It exposes powerful tools for extracting, analyzing, and optimizing SaaS pricing models.

Architecture

The MCP Server acts as a middleware layer that:
  • Transforms unstructured pricing data from URLs into structured Pricing2Yaml format via A-MINT
  • Orchestrates pricing analysis workflows through the Analysis API
  • Caches pricing data and analysis results for improved performance
  • Exposes MCP-compliant tools for LLM agents like Harvey

MCP Compliance

This server follows the 2025-06-18 revision of the MCP specification and implements:

Tools

Five MCP tools for pricing operations: iPricing, summary, subscriptions, optimal, and validate

Resources

Static resource endpoint providing the Pricing2Yaml specification

Transport

stdio transport (default) with optional HTTP/WebSocket support

JSON Results

All tool results returned as JSON content blocks

Protocol Features

Implemented:
  • Server primitives (tools and resources)
  • Resource reading via resources/read
  • JSON-formatted tool responses
  • stdio transport for local execution
  • Structured error handling via JSON-RPC
Not Currently Implemented:
  • Resource subscriptions (optional per spec)
  • Resource template URIs (optional per spec)

Configuration

The MCP Server uses environment variables for configuration. Create a .env file based on .env.example:
AMINT_BASE_URL
string
required
Base URL for the A-MINT transformation API
AMINT_BASE_URL=http://localhost:8001
ANALYSIS_BASE_URL
string
required
Base URL for the Analysis API
ANALYSIS_BASE_URL=http://localhost:8002
CACHE_BACKEND
string
default:"memory"
Cache backend type. Options: memory, redis
CACHE_BACKEND=memory
REDIS_URL
string
Redis connection string (required if CACHE_BACKEND=redis)
REDIS_URL=redis://localhost:6379/0
CACHE_TTL_SECONDS
integer
default:"3600"
Time-to-live for cached pricing data in seconds
CACHE_TTL_SECONDS=3600
LOG_LEVEL
string
default:"INFO"
Logging level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
LOG_LEVEL=INFO
MCP_TRANSPORT
string
default:"stdio"
MCP transport protocol. Options: stdio, websocket, sse
MCP_TRANSPORT=stdio
HTTP_HOST
string
default:"0.0.0.0"
Host address for HTTP/WebSocket transport
HTTP_HOST=0.0.0.0
HTTP_PORT
integer
default:"8085"
Port for HTTP/WebSocket transport
HTTP_PORT=8085

Local Development

Set up the MCP server for local development:
1

Navigate to Directory

cd mcp_server
2

Create Virtual Environment

uv venv
source .venv/bin/activate
3

Install Dependencies

uv pip install -e .[dev]
4

Configure Environment

cp .env.example .env
# Edit .env with your service endpoints
5

Run Tests

pytest
6

Launch Server

python -m pricing_mcp

Docker Deployment

Run the MCP server with Docker Compose:
docker compose up --build mcp-server
The server will be available on the configured HTTP port (default: 8085).

Integration with Harvey

The Harvey API service launches this MCP server via stdio transport and communicates with it directly:
# Harvey connects to MCP server via stdio
mcp_client = MCPClient(transport="stdio")

# Call MCP tools
result = await mcp_client.call_tool(
    "optimal",
    pricing_url="https://buffer.com/pricing",
    filters={"usageLimits": [{"channels": 10}]},
    objective="minimize"
)
API keys for external services (OpenAI, A-MINT) are managed by the MCP server and Harvey API. They are never exposed to end users.

Error Handling

The MCP server provides structured error responses: Input Validation Errors:
{
  "error": {
    "code": -32602,
    "message": "Either pricing_url or pricing_yaml must be provided for summary."
  }
}
Service Errors:
{
  "error": {
    "code": -32603,
    "message": "Analysis job failed: Invalid pricing YAML syntax"
  }
}
Timeout Errors:
{
  "error": {
    "code": -32603,
    "message": "Timed out waiting for transformation result"
  }
}

Observability

The MCP server emits structured logs for key operations:
{
  "event": "mcp.tool.invoked",
  "tool": "optimal",
  "pricing_url": "https://buffer.com/pricing",
  "filters": {"usageLimits": [{"channels": 10}]},
  "solver": "minizinc",
  "objective": "minimize"
}

Next Steps

MCP Tools

Explore all available MCP tools and their parameters

MCP Resources

Learn about the Pricing2Yaml specification resource

Analysis API

Understand the underlying analysis capabilities

Harvey Agent

See how Harvey uses MCP tools

Build docs developers (and LLMs) love