- Explore MCP Servers
- malloy-mcp-server
Malloy Mcp Server
What is Malloy Mcp Server
malloy-mcp-server is an MCP Server implementation designed for executing Malloy queries and managing Malloy resources, enabling interaction with Malloy data models through the Malloy Publisher.
Use cases
Use cases include executing complex queries on user data, accessing metadata for projects and packages, and integrating with other systems that utilize Malloy data models.
How to use
To use malloy-mcp-server, install it via pip or uv, configure environment variables for the Malloy Publisher API, and run the server. You can execute queries using the provided MCP tool and access various resource endpoints.
Key features
Key features include the ability to execute Malloy queries via MCP, access to Malloy project, package, and model metadata, robust error handling with detailed context, comprehensive test coverage, and a type-safe implementation.
Where to use
malloy-mcp-server can be used in data analytics, business intelligence, and any application requiring interaction with Malloy data models for querying and resource management.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Malloy Mcp Server
malloy-mcp-server is an MCP Server implementation designed for executing Malloy queries and managing Malloy resources, enabling interaction with Malloy data models through the Malloy Publisher.
Use cases
Use cases include executing complex queries on user data, accessing metadata for projects and packages, and integrating with other systems that utilize Malloy data models.
How to use
To use malloy-mcp-server, install it via pip or uv, configure environment variables for the Malloy Publisher API, and run the server. You can execute queries using the provided MCP tool and access various resource endpoints.
Key features
Key features include the ability to execute Malloy queries via MCP, access to Malloy project, package, and model metadata, robust error handling with detailed context, comprehensive test coverage, and a type-safe implementation.
Where to use
malloy-mcp-server can be used in data analytics, business intelligence, and any application requiring interaction with Malloy data models for querying and resource management.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
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 metadatamalloy://project/home/package/{package_name}- Package metadatamalloy://project/home/model/{model_path}- Model metadata
Development
Setup
- Clone the repository:
git clone https://github.com/namabile/malloy-mcp-server.git
cd malloy-mcp-server
- 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:
blackfor code formattingmypyfor type checkingrufffor 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 implementationtools/query_executor.py- Query execution toolerrors.py- Error handling utilities
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
License
MIT License - see LICENSE file for details
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










