pyResToolbox MCP Server
Bring Reservoir Engineering Calculations to AI
Power your AI assistants with industry-standard petroleum engineering calculations
Quick Start • Features • Examples • Documentation • Contributing
47 Production-Ready Tools | Field Units | Zero Configuration
PVT Analysis • Well Performance • Simulation Support • Brine Properties • Heterogeneity Analysis
A production-ready Model Context Protocol (MCP) server that gives AI agents like Claude access to the comprehensive reservoir engineering library pyResToolbox. Now Claude can perform sophisticated PVT calculations, well performance analysis, and reservoir simulation tasks through natural conversation.
☕ Support This Project
If you find this project useful, consider buying me a coffee! Your support helps maintain and improve this open-source tool.
What is This?
This MCP server bridges the gap between AI assistants and petroleum engineering workflows. Instead of manually calculating reservoir properties or writing complex scripts, you can simply ask Claude:
"Calculate the bubble point pressure for API 35° oil at 180°F with solution GOR of 800 scf/stb and gas gravity 0.75 using the Valko-McCain correlation"
"Generate an IPR curve for my well with Pi=4000 psia, Pb=3500 psia, API 38°, 175°F, pay thickness 75 ft, permeability 150 mD"
"Create a black oil table for simulation with pressures from 500 to 5000 psia"
Claude will execute the calculations using industry-standard correlations and return accurate, formatted results.
Built On
pyResToolbox by Mark Burgoyne - Comprehensive Python library for reservoir engineering calculations
FastMCP - Modern Python framework for building MCP servers
Model Context Protocol by Anthropic - Standard for AI-application integration
Key Features
47 Production-Ready Tools - All tools tested and validated
Industry-Standard Correlations - Standing, Valko-McCain, Velarde, DAK, Beggs-Robinson, Corey, LET, and more
Field Units - Uses familiar oilfield units (psia, °F, STB/day, MSCF/day)
Array Support - Calculate properties at multiple pressures simultaneously
Zero Configuration - Works out of the box with Claude Desktop
GPL-3.0 Licensed - Free and open source
Quick Start
Installation
Prerequisites: Python 3.10+ (UV package manager recommended but optional)
Connect to Claude Desktop
Add this to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Replace /absolute/path/to/pyrestoolbox-mcp with your actual installation path.
Restart Claude Desktop and you're ready to go!
Your First Query
Open Claude Desktop and try:
"What's the bubble point pressure for a 35° API oil at 180°F with 800 scf/stb solution GOR and 0.75 gas gravity?"
Claude will use the oil_bubble_point tool and return results like:
What Can You Do?
Oil PVT Analysis
Calculate bubble point pressure (Standing, Valko-McCain, Velarde)
Solution GOR, formation volume factor, viscosity, density, compressibility
Generate comprehensive black oil tables for simulators
Gas PVT Analysis
Z-factor calculations (DAK, Hall-Yarborough, WYW, Burrows)
Critical properties with contaminants (CO₂, H₂S, N₂, H₂)
Gas viscosity, density, compressibility, pseudopressure
Formation volume factors
Well Performance & IPR
Oil and gas production rates (radial and linear flow)
IPR curve generation for vertical and horizontal wells
Vogel IPR for pressures below bubble point
Sensitivity analysis for permeability, skin, reservoir pressure
Reservoir Simulation Support
Relative permeability tables (SWOF, SGOF, SGWFN)
Corey and LET correlations
Van Everdingen & Hurst aquifer influence functions (AQUTAB)
Rachford-Rice flash calculations for phase behavior
Advanced Calculations
Brine properties (methane and CO₂ saturated)
CO₂ sequestration studies
Reservoir heterogeneity analysis (Lorenz coefficient, beta parameter)
Layer permeability distributions
Component library (critical properties for 100+ hydrocarbons)
Configuration & Help
Query available calculation methods and correlations
Access unit system documentation
Get physical constants
Comprehensive usage guides
Example Queries for Claude
Basic PVT Calculations
Well Performance Analysis
Simulation Preparation
Reservoir Heterogeneity
Multi-Step Workflows
Advanced Queries
Comprehensive PVT Workflows
Gas Analysis
Well Performance & IPR
Sensitivity Analysis
Brine & CO₂ Sequestration
Reservoir Heterogeneity
Phase Behavior & Flash Calculations
Component Library
Economic & Optimization
Comparison & Benchmarking
Educational Queries
Troubleshooting & Validation
Tips for Better Queries
Be Specific - Include all relevant parameters (API, temperature, pressure, etc.)
Specify Methods - Mention which correlation you want (VALMC, DAK, Corey, LET, etc.)
Include Units - Always specify units (psia, degF, mD, ft, etc.)
Ask for Comparisons - Request comparisons between methods or scenarios
Request Tables - Ask for tabulated results when you need multiple values
Follow-up Questions - Build on previous answers for complex workflows
Unit System
All calculations use Field Units (US Oilfield) per industry standard:
Property | Unit | Example |
Pressure | psia | 3000 psia |
Temperature | °F | 180°F |
Permeability | mD | 100 mD |
Pay Thickness | ft | 50 ft |
Viscosity | cP | 0.85 cP |
Oil Rate | STB/day | 542 STB/day |
Gas Rate | MSCF/day | 1250 MSCF/day |
Oil Gravity | API° or SG | 35° API |
Gas Gravity | SG (air=1) | 0.75 |
Solution GOR | scf/stb | 800 scf/stb |
Oil FVF | rb/stb | 1.25 rb/stb |
Gas FVF | rcf/scf | 0.0045 rcf/scf |
Compressibility | 1/psi | 1.2×10⁻⁵ 1/psi |
Density | lb/ft³ | 42.5 lb/ft³ |
Access complete unit documentation anytime by asking Claude: "What units does pyRestToolbox use?"
Architecture
Project Structure
How It Works
FastMCP Server - Handles MCP protocol communication (STDIO, HTTP, SSE)
Pydantic Models - Validate all inputs with descriptive error messages
Tool Layer - 47 functions wrapping pyrestoolbox calculations
pyRestToolbox - Performs actual reservoir engineering calculations
Type Conversion - Handles numpy/pandas/mpmath serialization for JSON
Tool Categories
Category | Count | Description |
Oil PVT | 17 | Bubble point, Rs, Bo, viscosity, density, compressibility, black oil tables |
Gas PVT | 11 | Z-factor, critical properties, Bg, viscosity, density, pseudopressure |
Inflow | 4 | Oil/gas rates for radial/linear flow, IPR generation |
Simulation | 3 | Relative permeability, aquifer functions, Rachford-Rice flash |
Brine | 2 | CH₄ and CO₂ saturated brine properties |
Heterogeneity | 5 | Lorenz coefficient, beta conversion, layer distributions |
Library | 1 | Critical properties for 100+ components |
Config | 4 | Units, methods, constants, help resources |
Development
Running Tests
See TEST_RESULTS.md for complete validation report.
Running Examples
Code Quality
Docker Deployment
See DOCKER.md for complete Docker documentation.
Adding New Tools
See CONTRIBUTING.md for detailed instructions. Quick overview:
Define Pydantic Model in
src/pyrestoolbox_mcp/models/Implement Tool Function in appropriate
src/pyrestoolbox_mcp/tools/fileRegister Tool in the module's
register_*_tools()functionAdd Tests to
test_tools.pyand appropriate pytest fileUpdate Documentation in README and examples
Available Calculation Methods
Oil Correlations
Bubble Point Pressure
VALMC - Valko & McCain (2003) - Recommended for most applications
STAN - Standing (1947) - Classic correlation
VELAR - Velarde (1997) - For specific regions
Solution GOR (Rs)
VELAR - Velarde (1997)
STAN - Standing (1947)
VALMC - Valko & McCain (2003)
Formation Volume Factor (Bo)
MCAIN - McCain et al. (1988) - Recommended
STAN - Standing (1947)
Viscosity
BR - Beggs & Robinson (1975)
Gas Correlations
Z-Factor
DAK - Dranchuk & Abou-Kassem (1975) - Recommended, most accurate
HY - Hall & Yarborough (1973) - Fast, good for most conditions
WYW - Wang, Ye & Wu (2021) - Latest, handles high pressure
BUR - Burrows (1981) - Special applications
Critical Properties
PMC - Piper, McCain & Corredor (1993) - Recommended
SUT - Sutton (1985)
BUR - Burrows (1981)
Viscosity
LGE - Lee, Gonzalez & Eakin (1966)
Relative Permeability
Curve Types
COR - Corey (1954) - Power law, simple
LET - Lomeland, Ebeltoft & Thomas (2005) - Flexible, complex shapes
Table Types
SWOF - Water-oil saturation functions
SGOF - Gas-oil saturation functions
SGWFN - Gas-water saturation functions (3-phase)
Programmatic Usage
While this server is designed for Claude Desktop integration, you can also use it programmatically:
Python Client
HTTP/SSE Transport
Then connect using any MCP client or HTTP client supporting the MCP protocol.
Troubleshooting
Installation Issues
"uv: command not found"
Close and reopen terminal after installing UV
Verify:
uv --versionAlternative: Use pip instead (
pip install -e .)
"make: command not found" (Windows)
Use manual commands from Makefile
Or install Make for Windows via Chocolatey:
choco install make
UV sync fails
Clear cache:
rm -rf .venv && make uv-installCheck Python version:
python --version(needs 3.10+)
Claude Desktop Integration
Claude doesn't see the tools
Verify absolute path in config (no
~, use full path)Completely restart Claude Desktop (Quit, not just close window)
Check Claude Desktop logs:
macOS:
~/Library/Logs/Claude/Windows:
%APPDATA%\Claude\logs\
Test server manually:
make uv-serverEnsure UV is in PATH (try
which uvorwhere uv)
Tools fail with errors
Verify all inputs use Field Units (psia, °F, ft, mD)
Check parameter names match exactly (case-sensitive)
Run validation:
uv run python test_tools.py
Runtime Issues
Import errors
Calculation errors
Check units (must be psia, °F, etc.)
Verify inputs are realistic (e.g., API 10-50, temperatures 60-300°F)
Some correlations have valid ranges - try different methods
Check pyResToolbox docs for correlation limits
Performance issues
Array calculations are optimized via numpy
For large datasets, consider batching requests
Docker deployment adds minimal overhead
Getting Help
Check INTERESTING_QUERIES.md for query examples
Review examples/ directory for working code
See CONTRIBUTING.md for development setup
Open an issue for bugs or feature requests
Contributing
Contributions are welcome! This project follows the GPL-3.0 license of the upstream pyResToolbox library.
How to Contribute
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes (follow code style guidelines)
Test thoroughly (
uv run python test_tools.py- all 47 must pass)Format code (
uv run black src/ tests/)Commit (
git commit -m 'Add amazing feature')Push (
git push origin feature/amazing-feature)Open a Pull Request
Development Setup
Guidelines
Use type hints for all function parameters and return values
Write Google-style docstrings
Add tests for all new tools
Follow existing code structure
Update documentation
See CONTRIBUTING.md for detailed guidelines.
License
GNU General Public License v3.0 (GPL-3.0)
This MCP server is built on pyResToolbox, which is licensed under GPL-3.0. This project maintains full compliance with GPL-3.0 license terms.
Key Points:
Free and open source software
You may use, modify, and distribute under GPL-3.0 terms
Any modifications must also be released under GPL-3.0
No warranty provided (see LICENSE for details)
Commercial use is permitted under GPL-3.0 terms
See LICENSE for complete license text.
Project Status
Aspect | Status | Details |
Tests | 100% tool coverage | |
Production | ✅ Ready | All tools validated |
Documentation | ✅ Complete | README, examples, guides |
License | GPL-3.0 | Matches upstream |
Python | 3.10+ | Type hints throughout |
Framework | FastMCP 2.0+ | Modern MCP implementation |
See PRODUCTION_READY.md for detailed verification results.
Version History
v1.0.0 (2024-11-15) - Initial production release
47 production-ready tools
100% test coverage
Docker deployment support
Comprehensive documentation
GPL-3.0 license compliance
See CHANGELOG.md for detailed version history.
Roadmap
Planned Features
Web UI for HTTP transport with interactive forms
Additional workflow examples for common tasks
Performance benchmarking suite
Extended simulation tools (grid processing, ECLIPSE utilities)
Jupyter notebook integration with examples
API documentation site (Sphinx/MkDocs)
Rate limiting and authentication for HTTP deployments
Prometheus metrics export
See open issues for full list of proposed features and known issues.
Upstream Integration
We're exploring opportunities to contribute improvements back to pyResToolbox, including:
Standalone
gas_grad2sgimplementation (bug fix)Enhanced type hints
Additional validation utilities
Related Projects
Core Dependencies
pyResToolbox - Reservoir engineering library by Mark Burgoyne
FastMCP - Python framework for MCP servers
Model Context Protocol - MCP specification by Anthropic
Similar MCP Servers
mcp-servers - Official MCP server examples
awesome-mcp-servers - Curated list of MCP servers
Petroleum Engineering Tools
Acknowledgments
This project wouldn't exist without:
Mark Burgoyne - Creator of pyResToolbox, the foundation of this MCP server
Marvin AI Team - Developers of FastMCP framework
Anthropic - For Claude and the Model Context Protocol specification
The reservoir engineering community - For developing and refining the correlations implemented in this project
Special thanks to all contributors who help improve this project!
Citation
If you use this MCP server in academic or commercial work, please cite the original pyResToolbox library:
For this MCP server:
Support
Getting Help
For MCP server issues:
Check Troubleshooting section
Review examples/ directory
Search existing issues
Open a new issue
For calculation accuracy or pyResToolbox features:
For FastMCP framework:
For Model Context Protocol:
Join MCP Discord (if available)
Community
Discussions: GitHub Discussions
Issues: GitHub Issues
Pull Requests: Contributing Guide
Support & Star
⭐ Star This Project
If you find this project useful, please give it a star on GitHub! Stars help others discover this project and motivate continued development.
☕ Buy Me a Coffee
Support the development and maintenance of this project:
Your support helps keep this project free and open source for the petroleum engineering community!
Built with ❤️ for the petroleum engineering community
Created by
Report Bug · Request Feature · Documentation · Examples