Skip to main content

Malloy MCP Server

An MCP server implementation for executing Malloy queries and managing Malloy resources.

Features

  • Execute Malloy queries via MCP
  • Access Malloy project, package, and model metadata
  • Robust error handling with detailed context
  • Comprehensive test coverage
  • Type-safe implementation

Installation

# Install using uv (recommended)
uv pip install malloy-mcp-server

# Or using pip
pip install malloy-mcp-server

Usage

Starting the Server

from malloy_mcp_server import mcp

# Run the server
if __name__ == "__main__":
    mcp.serve()

Configuration

The server can be configured using environment variables:

Variable Description Default
MALLOY_PUBLISHER_ROOT_URL URL of the Malloy Publisher API http://localhost:4000

Example:

# Set the publisher URL
export MALLOY_PUBLISHER_ROOT_URL="http://malloy-publisher:4000"

# Run with custom configuration
python -m malloy_mcp_server

Executing Queries

The server provides an MCP tool for executing Malloy queries:

from malloy_mcp_server import ExecuteMalloyQueryTool

# Example query execution
result = await ExecuteMalloyQueryTool(
    query="select * from users",
    model_path="my_package/users"
)

Accessing Resources

The server provides the following resource endpoints:

  • malloy://project/home/metadata - Project metadata
  • malloy://project/home/package/{package_name} - Package metadata
  • malloy://project/home/model/{model_path} - Model metadata

Development

Setup

  1. Clone the repository:
git clone https://github.com/namabile/malloy-mcp-server.git
cd malloy-mcp-server
  1. Install dependencies:
uv pip install -e ".[dev]"

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=malloy_mcp_server

Code Quality

The project uses:

  • black for code formatting
  • mypy for type checking
  • ruff for linting

Run quality checks:

black .
mypy .
ruff check .

Error Handling

The server provides detailed error handling with context:

from malloy_mcp_server.errors import QueryExecutionError

try:
    result = await ExecuteMalloyQueryTool(...)
except QueryExecutionError as e:
    print(f"Error: {e.message}")
    print("Context:", e.context)

Architecture

The server is built on:

  • FastMCP for the MCP server implementation
  • Malloy Publisher Client for Malloy interactions
  • Pydantic for data validation

Key components:

  • server.py - Core server implementation
  • tools/query_executor.py - Query execution tool
  • errors.py - Error handling utilities

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Metadata

Release files for malloy-mcp-server 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for malloy-mcp-server 0.1.1
File Size Uploaded Provenance
malloy_mcp_server-0.1.1.tar.gz 20.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for malloy-mcp-server 0.1.1
File Interpreter ABI Platform
malloy_mcp_server-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.7 kB

Release files / malloy_mcp_server-0.1.1.tar.gz

Download URL malloy_mcp_server-0.1.1.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c3385feaa0a0abbd7a65253372902e1dc940f44a5d1f7c67bd048e7f8933e2b
BLAKE2b-256 checksum
How to use checksums
03256dc15771c13cb11c4b753f0ea31442b753508097f9c946ea3bfeb2f4d82e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / malloy_mcp_server-0.1.1-py3-none-any.whl

Download URL malloy_mcp_server-0.1.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe9a7e32c1faf6fc6d1ce5ebf46172fa125eaea9b906b3fb792f1f8369a24a76
BLAKE2b-256 checksum
How to use checksums
ba15bca68f3a91ea29bb1fb45a272ad1e83f80ccbbb18e026f5843b1741b3e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for malloy-mcp-server 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page