Skip to content

Use pyeconomics with an AI assistant

pyeconomics is an MCP server: an assistant that speaks the Model Context Protocol gets every model and every data series as tools, and answers with the same results this site shows, each with its sources.

Connect it

Most assistants read a JSON configuration file. Add this entry, and the assistant starts the server on your own computer when it needs it:

Client configuration
{
  "mcpServers": {
    "pyeconomics": {
      "command": "uvx",
      "args": [
        "--prerelease", "allow",
        "--from",
        "pyeconomics[mcp]",
        "pyeconomics", "mcp"
      ]
    }
  }
}

It runs uvx --prerelease allow --from "pyeconomics[mcp]" pyeconomics mcp, which needs uv installed. The server runs on your own computer and reads your own data keys, as the library does, so it reaches every source you can.

An assistant that connects to a URL can use this site's server instead, with nothing to install: https://pyeconomics.dev/mcp. It serves the same tools over the data this site may serve.

The documentation's MCP page has the command for each client and every option.

The tools

Five tools reach every model and every source:

search_models
finds models by a word, or lists a domain's
describe_model
gives a model's inputs and outputs with their units, and its model card
run_model
runs any model by its id, on the inputs given or on live data
get_series
reads a data series, with its source and the attribution it must be shown with
list_sources
lists every data source with its licence class and terms

16 models also have a tool of their own, which takes the model's inputs alone and gives the same result as run_model with the model's id:

Every model's page gives its tool under "Use it elsewhere", and its calculator writes the call for the inputs you typed.

What data reaches an assistant

Only data whose terms allow it. Each source declares whether its data may be given to a language model, and the server withholds a series whose source does not; list_sources tells the assistant which are which. The data sources lists every source and its terms.