d365fo-client v0.3.5: Intelligent Cross-Company Queries for D365 F&O
I'm excited to announce d365fo-client v0.3.5, bringing intelligent cross-company query support to Microsoft Dynamics 365 Finance & Operations integration!
This Python package provides a comprehensive toolkit for D365 F&O: OData Client Library, CLI Application, and MCP Server (Model Context Protocol) for AI assistant integration - all with the new smart cross-company capabilities that make working with multi-company data effortless.
The Problem with Cross-Company Queries
When querying data across companies in D365 F&O, you traditionally need to:
- Filter by
dataAreaIdto specify which company's data you want - Remember to add
cross-company=trueparameter to your OData query - Handle it differently for composite keys
Forgetting step 2 is incredibly common and leads to empty results or cryptic errors. It's one of those things that catches even experienced developers off guard.
Automatic Cross-Company Detection
Version 0.3.5 introduces automatic cross-company detection that eliminates this entire class of errors. The client now analyzes your query filters and automatically enables cross-company mode when needed.
Before (Manual Configuration):
# You had to remember to add cross-company parameter
records = await client.query_entities(
"SalesOrderHeaders",
filter="dataAreaId eq 'USMF'",
cross_company=True # ❌ Easy to forget!
)After (Automatic Detection):
# Client detects dataAreaId and enables cross-company automatically
records = await client.query_entities(
"SalesOrderHeaders",
filter="dataAreaId eq 'USMF'"
# ✅ cross-company=true added automatically!
)How It Works
The query builder analyzes your filter expressions:
- Detects
dataAreaIdpresence in filters - Automatically appends
cross-company=trueto the OData query - Handles both simple and composite keys intelligently
- Works with all CRUD operations (query, get, create, update, delete)
This enhancement works across all three interfaces:
- Python API: Direct programmatic access
- CLI Application: Terminal commands
- MCP Server: AI assistant integration (Claude, ChatGPT with plugins, etc.)
Perfect for AI Integration
The MCP (Model Context Protocol) Server support means AI assistants can now intelligently query multi-company D365 F&O data without special configuration or prompting. The cross-company detection works automatically through the MCP protocol!
🤖 AI Integration Bonus: AI assistants using the MCP server can query multi-company data naturally without needing special instructions about cross-company flags. They just filter by dataAreaId and everything works!
What Else is New in 0.3.5
Added:
- 🏢 Smart Cross-Company Support: Auto-detection for dataAreaId queries (works across Python API, CLI, and MCP server!)
- 🔑 Composite Key Handling: Cross-company support for complex keys
- ✨ Zero Configuration: Works out of the box in all interfaces
Improved:
- 🧪 Test Suite: Removed 618 lines of redundant tests
- 🎯 Code Quality: Comprehensive formatting and organization
- 📊 Integration Tests: Enhanced fixtures and consistency
Cleaned Up:
- 🧹 Removed ~7,000 lines of deprecated MCP server code
- 🗑️ 15 obsolete test files deleted
- 📚 Updated documentation to reflect FastMCP architecture
Fixed:
- ⚠️ All test warnings resolved (clean pytest output!)
- 🔄 Async handling improved throughout test suite
Updated Dependencies:
- 📦 13 package updates including MCP SDK 1.21.1, pytest 9.0.1, ruff 0.14.5
Why This Matters
Working with multi-company D365 F&O data just got easier - whether you're using the Python API, CLI commands, or AI assistants via MCP! No more:
- ❌ Forgetting to set cross-company flags
- ❌ Manual parameter management
- ❌ Query errors due to missing configuration
The client is smart enough to understand your intent and do the right thing automatically, across all interfaces.
Get Started
Install the latest version:
pip install d365fo-client==0.3.5
# or with uv
uv add d365fo-client==0.3.5Links & Resources
- 📚 Documentation: GitHub Repository
- 📝 Full Changelog: CHANGELOG.md
- 📦 PyPI: d365fo-client
Thank You!
Special thanks to the dependabot for keeping our dependencies fresh and the community for continued support!
Have you worked with D365 F&O multi-company scenarios or AI-powered ERP integrations? I'd love to hear your thoughts and experiences in the comments below!