malloy-mcp-server
An MCP Server for interacting with Malloy data models through the Malloy Publisher
Documentation
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-serverUsage
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_serverExecuting 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-server2. Install dependencies:
uv pip install -e ".[dev]"Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=malloy_mcp_serverCode 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
Frequently asked questions
What is malloy-mcp-server?
malloy-mcp-server is An MCP Server for interacting with Malloy data models through the Malloy Publisher
How do I install malloy-mcp-server?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is malloy-mcp-server open source?
Yes — it is hosted on GitHub at https://github.com/namabile/malloy-mcp-server and has 2 stars.
Related MCP tools
🙌 OpenHands: Code Less, Make More for the Model Context Protocol. Enhance AI assistants with powerful integrations. Python-based implementation.
Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management. Python-based implementation.
基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择ChatGPT/Claude/DeepSeek/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
An LLM agent that conducts deep research (local and web) on any given topic and generates a long report with citations. Built for the Model Context Protocol to
🚀 The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.
🔥 MaxKB is an open-source platform for building enterprise-grade agents. MaxKB 是强大易用的开源企业级智能体平台。 for the Model Context Protocol. Enhance AI assistants with po
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP