Add a Matter.framework API for configuring MRP parameters. (#32548)

* Add a Matter.framework API for configuring MRP parameters.

Also fixes a typo in the ReliableMessageMgr API Matter.framework uses.

* Address review comment.
diff --git a/examples/darwin-framework-tool/BUILD.gn b/examples/darwin-framework-tool/BUILD.gn
index 6228643..665dccf 100644
--- a/examples/darwin-framework-tool/BUILD.gn
+++ b/examples/darwin-framework-tool/BUILD.gn
@@ -193,6 +193,11 @@
     "commands/common/MTRLogging.h",
     "commands/common/RemoteDataModelLogger.h",
     "commands/common/RemoteDataModelLogger.mm",
+    "commands/configuration/Commands.h",
+    "commands/configuration/ResetMRPParametersCommand.h",
+    "commands/configuration/ResetMRPParametersCommand.mm",
+    "commands/configuration/SetMRPParametersCommand.h",
+    "commands/configuration/SetMRPParametersCommand.mm",
     "commands/delay/Commands.h",
     "commands/delay/SleepCommand.h",
     "commands/delay/SleepCommand.mm",
diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
index 842ded8..7dc5b84 100644
--- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
+++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
@@ -34,8 +34,8 @@
 
 class CHIPCommandBridge : public Command {
 public:
-    CHIPCommandBridge(const char * commandName)
-        : Command(commandName)
+    CHIPCommandBridge(const char * commandName, const char * helpText = nullptr)
+        : Command(commandName, helpText)
     {
         AddArgument("commissioner-name", &mCommissionerName);
         AddArgument("commissioner-nodeId", 0, UINT64_MAX, &mCommissionerNodeId,
diff --git a/examples/darwin-framework-tool/commands/configuration/Commands.h b/examples/darwin-framework-tool/commands/configuration/Commands.h
new file mode 100644
index 0000000..8ee148e
--- /dev/null
+++ b/examples/darwin-framework-tool/commands/configuration/Commands.h
@@ -0,0 +1,36 @@
+/*
+ *   Copyright (c) 2024 Project CHIP Authors
+ *   All rights reserved.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+#pragma once
+
+#import <Matter/Matter.h>
+
+#include "ResetMRPParametersCommand.h"
+#include "SetMRPParametersCommand.h"
+
+void registerCommandsConfiguration(Commands & commands)
+{
+    const char * clusterName = "Configuration";
+
+    commands_list clusterCommands = {
+        make_unique<SetMRPParametersCommand>(),
+        make_unique<ResetMRPParametersCommand>(),
+    };
+
+    commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for configuring various state of the Matter framework.");
+}
diff --git a/examples/darwin-framework-tool/commands/configuration/ResetMRPParametersCommand.h b/examples/darwin-framework-tool/commands/configuration/ResetMRPParametersCommand.h
new file mode 100644
index 0000000..10cfe2f
--- /dev/null
+++ b/examples/darwin-framework-tool/commands/configuration/ResetMRPParametersCommand.h
@@ -0,0 +1,35 @@
+/*
+ *   Copyright (c) 2024 Project CHIP Authors
+ *   All rights reserved.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+#pragma once
+
+#import <Matter/Matter.h>
+
+#include "../common/CHIPCommandBridge.h"
+
+class ResetMRPParametersCommand : public CHIPCommandBridge
+{
+public:
+    ResetMRPParametersCommand() : CHIPCommandBridge("reset-mrp-parameters", "Reset MRP parameters to default values.") {}
+
+protected:
+    /////////// CHIPCommandBridge Interface /////////
+    CHIP_ERROR RunCommand() override;
+
+    // Our command is synchronous, so no need to wait.
+    chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::kZero; }
+};
diff --git a/examples/darwin-framework-tool/commands/configuration/ResetMRPParametersCommand.mm b/examples/darwin-framework-tool/commands/configuration/ResetMRPParametersCommand.mm
new file mode 100644
index 0000000..26b82e5
--- /dev/null
+++ b/examples/darwin-framework-tool/commands/configuration/ResetMRPParametersCommand.mm
@@ -0,0 +1,24 @@
+/*
+ *   Copyright (c) 2024 Project CHIP Authors
+ *   All rights reserved.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+#include "ResetMRPParametersCommand.h"
+
+CHIP_ERROR ResetMRPParametersCommand::RunCommand()
+{
+    MTRSetMessageReliabilityParameters(nil, nil, nil, nil);
+    return CHIP_NO_ERROR;
+}
diff --git a/examples/darwin-framework-tool/commands/configuration/SetMRPParametersCommand.h b/examples/darwin-framework-tool/commands/configuration/SetMRPParametersCommand.h
new file mode 100644
index 0000000..e9dc2fa
--- /dev/null
+++ b/examples/darwin-framework-tool/commands/configuration/SetMRPParametersCommand.h
@@ -0,0 +1,52 @@
+/*
+ *   Copyright (c) 2024 Project CHIP Authors
+ *   All rights reserved.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+#pragma once
+
+#import <Matter/Matter.h>
+
+#include "../common/CHIPCommandBridge.h"
+
+class SetMRPParametersCommand : public CHIPCommandBridge
+{
+public:
+    SetMRPParametersCommand() :
+        CHIPCommandBridge("set-mrp-parameters", "Set various MRP parameters.  At least one value must be provided.")
+    {
+        AddArgument("idle-interval", 0, UINT32_MAX, &mIdleRetransmitMs,
+                    "Our MRP idle interval (SII) in milliseconds.  Defaults to current value if not set.");
+        AddArgument("active-interval", 0, UINT32_MAX, &mActiveRetransmitMs,
+                    "Our MRP active interval (SAI) in milliseconds.  Defaults to current value if not set.");
+        AddArgument("active-threshold", 0, UINT32_MAX, &mActiveThresholdMs,
+                    "Our MRP active threshold: how long we stay in active mode before transitioning to idle mode.  Defaults to "
+                    "current value if not set.");
+        AddArgument("additional-retransmit-delay", 0, UINT32_MAX, &mAdditionalRetransmitDelayMs,
+                    "Additional delay between retransmits that we do. Defaults to current value if not set.");
+    }
+
+protected:
+    /////////// CHIPCommandBridge Interface /////////
+    CHIP_ERROR RunCommand() override;
+
+    // Our command is synchronous, so no need to wait.
+    chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::kZero; }
+
+    chip::Optional<uint32_t> mIdleRetransmitMs;
+    chip::Optional<uint32_t> mActiveRetransmitMs;
+    chip::Optional<uint32_t> mActiveThresholdMs;
+    chip::Optional<uint64_t> mAdditionalRetransmitDelayMs;
+};
diff --git a/examples/darwin-framework-tool/commands/configuration/SetMRPParametersCommand.mm b/examples/darwin-framework-tool/commands/configuration/SetMRPParametersCommand.mm
new file mode 100644
index 0000000..9ec49e7
--- /dev/null
+++ b/examples/darwin-framework-tool/commands/configuration/SetMRPParametersCommand.mm
@@ -0,0 +1,48 @@
+/*
+ *   Copyright (c) 2024 Project CHIP Authors
+ *   All rights reserved.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+#include "SetMRPParametersCommand.h"
+
+using namespace chip;
+
+namespace {
+
+template <typename T>
+NSNumber * _Nullable AsNumber(const Optional<T> & value)
+{
+    if (!value.HasValue()) {
+        return nil;
+    }
+
+    return @(value.Value());
+}
+
+} // anonymous namespace
+
+CHIP_ERROR SetMRPParametersCommand::RunCommand()
+{
+    if (!mIdleRetransmitMs.HasValue() && !mActiveRetransmitMs.HasValue() && !mActiveThresholdMs.HasValue() && !mAdditionalRetransmitDelayMs.HasValue()) {
+        ChipLogError(chipTool, "set-mrp-parameters needs to have at least one argument provided");
+        return CHIP_ERROR_INVALID_ARGUMENT;
+    }
+
+    MTRSetMessageReliabilityParameters(AsNumber(mIdleRetransmitMs),
+        AsNumber(mActiveRetransmitMs),
+        AsNumber(mActiveThresholdMs),
+        AsNumber(mAdditionalRetransmitDelayMs));
+    return CHIP_NO_ERROR;
+}
diff --git a/examples/darwin-framework-tool/main.mm b/examples/darwin-framework-tool/main.mm
index 0ba2d15..5f31cb6 100644
--- a/examples/darwin-framework-tool/main.mm
+++ b/examples/darwin-framework-tool/main.mm
@@ -22,6 +22,7 @@
 
 #include "commands/bdx/Commands.h"
 #include "commands/common/Commands.h"
+#include "commands/configuration/Commands.h"
 #include "commands/delay/Commands.h"
 #include "commands/discover/Commands.h"
 #include "commands/interactive/Commands.h"
@@ -46,6 +47,7 @@
         registerCommandsPayload(commands);
         registerClusterOtaSoftwareUpdateProviderInteractive(commands);
         registerCommandsStorage(commands);
+        registerCommandsConfiguration(commands);
         registerClusters(commands);
         return commands.Run(argc, (char **) argv);
     }
diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h
index 7d5b19d..d1efa99 100644
--- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h
+++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h
@@ -179,6 +179,39 @@
 
 @end
 
+/**
+ * Set the Message Reliability Protocol parameters for all controllers.  This
+ * allows control over retransmit delays to account for high-latency networks.
+ *
+ * Setting all arguments to nil will reset to the MRP parameters to their
+ * default values.
+ *
+ * Setting some arguments to non-nil will change just those values, keeping
+ * current values for any arguments that are nil (not resetting them to
+ * defaults).
+ *
+ * Non-nil arguments are specified as an integer number of milliseconds.
+ *
+ * @param idleRetransmitMs the minimal interval between retransmits for someone
+ *                         sending messages to us, when they think we are
+ *                         "idle" and might have our radio only turned on
+ *                         intermittently.
+ * @param activeRetransmitMs the minimal interval between retransmits for
+ *                           someone sending messages to us, when they think we
+ *                           are "active" and have the radio turned on
+ *                           consistently.
+ * @param activeThresholdMs the amount of time we will stay in "active" mode after
+ *                          network activity.
+ * @param additionalRetransmitDelayMs additional delay between retransmits for
+ *                                    messages we send, on top of whatever delay
+ *                                    the other side requests via its MRP
+ *                                    parameters.
+ */
+MTR_EXTERN MTR_NEWLY_AVAILABLE void MTRSetMessageReliabilityParameters(NSNumber * _Nullable idleRetransmitMs,
+    NSNumber * _Nullable activeRetransmitMs,
+    NSNumber * _Nullable activeThresholdMs,
+    NSNumber * _Nullable additionalRetransmitDelayMs);
+
 MTR_DEPRECATED(
     "Please use MTRDeviceControllerFactoryParams", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4))
 @interface MTRControllerFactoryParams : MTRDeviceControllerFactoryParams
diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
index d89df5a..2ccf896 100644
--- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
+++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
@@ -48,10 +48,12 @@
 #import "MTRServerCluster_Internal.h"
 #import "MTRServerEndpoint_Internal.h"
 #import "MTRSessionResumptionStorageBridge.h"
+#import "MTRUnfairLock.h"
 #import "NSDataSpanConversion.h"
 
 #import <os/lock.h>
 
+#include <app/server/Dnssd.h>
 #include <app/util/af.h>
 #include <controller/CHIPDeviceControllerFactory.h>
 #include <credentials/CHIPCert.h>
@@ -62,6 +64,8 @@
 #include <crypto/RawKeySessionKeystore.h>
 #include <lib/support/Pool.h>
 #include <lib/support/TestPersistentStorageDelegate.h>
+#include <messaging/ReliableMessageMgr.h>
+#include <messaging/ReliableMessageProtocolConfig.h>
 #include <platform/PlatformManager.h>
 
 #include <cstdlib>
@@ -968,6 +972,33 @@
     return controller;
 }
 
+- (void)resetOperationalAdvertising
+{
+    if (![self checkIsRunning:nil]) {
+        // No need to reset anything; we are not running, so not
+        // advertising.
+        return;
+    }
+
+    if (!self.advertiseOperational) {
+        // No need to reset anything; we are not advertising the things that
+        // would need to get reset.
+        return;
+    }
+
+    std::lock_guard lock(_controllersLock);
+    if (_controllers.count != 0) {
+        // We have a running controller.  That means we likely need to reset
+        // operational advertising for that controller.
+        dispatch_async(_chipWorkQueue, ^{
+            // StartServer() is the only API we have for resetting DNS-SD
+            // advertising.  It sure would be nice if there were a "restart"
+            // that was a no-op if the DNS-SD server was not already
+            // running.
+            app::DnssdServer::Instance().StartServer();
+        });
+    }
+}
 @end
 
 @implementation MTRDeviceControllerFactory (InternalMethods)
@@ -1449,3 +1480,39 @@
 }
 
 @end
+
+void MTRSetMessageReliabilityParameters(NSNumber * _Nullable idleRetransmitMs,
+    NSNumber * _Nullable activeRetransmitMs,
+    NSNumber * _Nullable activeThresholdMs,
+    NSNumber * _Nullable additionalRetransmitDelayMs)
+{
+    bool resetAdvertising = false;
+    if (idleRetransmitMs == nil && activeRetransmitMs == nil && activeThresholdMs == nil && additionalRetransmitDelayMs == nil) {
+        Messaging::ReliableMessageMgr::SetAdditionalMRPBackoffTime(NullOptional);
+        resetAdvertising = ReliableMessageProtocolConfig::SetLocalMRPConfig(NullOptional);
+    } else {
+        if (additionalRetransmitDelayMs != nil) {
+            System::Clock::Milliseconds64 additionalBackoff(additionalRetransmitDelayMs.unsignedLongLongValue);
+            Messaging::ReliableMessageMgr::SetAdditionalMRPBackoffTime(MakeOptional(additionalBackoff));
+        }
+
+        // Get current MRP parameters, then override the things we were asked to
+        // override.
+        ReliableMessageProtocolConfig mrpConfig = GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig());
+        if (idleRetransmitMs != nil) {
+            mrpConfig.mIdleRetransTimeout = System::Clock::Milliseconds32(idleRetransmitMs.unsignedLongValue);
+        }
+        if (activeRetransmitMs != nil) {
+            mrpConfig.mActiveRetransTimeout = System::Clock::Milliseconds32(activeRetransmitMs.unsignedLongValue);
+        }
+        if (activeThresholdMs != nil) {
+            mrpConfig.mActiveThresholdTime = System::Clock::Milliseconds32(activeThresholdMs.unsignedLongValue);
+        }
+
+        resetAdvertising = ReliableMessageProtocolConfig::SetLocalMRPConfig(MakeOptional(mrpConfig));
+    }
+
+    if (resetAdvertising) {
+        [[MTRDeviceControllerFactory sharedInstance] resetOperationalAdvertising];
+    }
+}
diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj
index 2f69cdf..606d0f1 100644
--- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj
+++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj
@@ -133,6 +133,11 @@
 		5117DD3929A931AE00FFA1AA /* MTROperationalBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 5117DD3729A931AE00FFA1AA /* MTROperationalBrowser.h */; };
 		511913FB28C100EF009235E9 /* MTRBaseSubscriptionCallback.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511913F928C100EF009235E9 /* MTRBaseSubscriptionCallback.mm */; };
 		511913FC28C100EF009235E9 /* MTRBaseSubscriptionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 511913FA28C100EF009235E9 /* MTRBaseSubscriptionCallback.h */; };
+		512431252BA0C8B7000BC136 /* Commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 512431182BA0C09A000BC136 /* Commands.h */; };
+		512431262BA0C8BA000BC136 /* ResetMRPParametersCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 512431192BA0C09A000BC136 /* ResetMRPParametersCommand.h */; };
+		512431272BA0C8BF000BC136 /* SetMRPParametersCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 5124311B2BA0C09A000BC136 /* SetMRPParametersCommand.h */; };
+		512431282BA0C8BF000BC136 /* SetMRPParametersCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5124311C2BA0C09A000BC136 /* SetMRPParametersCommand.mm */; };
+		512431292BA0C8BF000BC136 /* ResetMRPParametersCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5124311A2BA0C09A000BC136 /* ResetMRPParametersCommand.mm */; };
 		5129BCFD26A9EE3300122DDF /* MTRError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5129BCFC26A9EE3300122DDF /* MTRError.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		51339B1F2A0DA64D00C798C1 /* MTRCertificateValidityTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 51339B1E2A0DA64D00C798C1 /* MTRCertificateValidityTests.m */; };
 		5136661328067D550025EDAE /* MTRDeviceController_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */; };
@@ -529,6 +534,11 @@
 		5117DD3729A931AE00FFA1AA /* MTROperationalBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTROperationalBrowser.h; sourceTree = "<group>"; };
 		511913F928C100EF009235E9 /* MTRBaseSubscriptionCallback.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRBaseSubscriptionCallback.mm; sourceTree = "<group>"; };
 		511913FA28C100EF009235E9 /* MTRBaseSubscriptionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseSubscriptionCallback.h; sourceTree = "<group>"; };
+		512431182BA0C09A000BC136 /* Commands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Commands.h; sourceTree = "<group>"; };
+		512431192BA0C09A000BC136 /* ResetMRPParametersCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResetMRPParametersCommand.h; sourceTree = "<group>"; };
+		5124311A2BA0C09A000BC136 /* ResetMRPParametersCommand.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResetMRPParametersCommand.mm; sourceTree = "<group>"; };
+		5124311B2BA0C09A000BC136 /* SetMRPParametersCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetMRPParametersCommand.h; sourceTree = "<group>"; };
+		5124311C2BA0C09A000BC136 /* SetMRPParametersCommand.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetMRPParametersCommand.mm; sourceTree = "<group>"; };
 		5129BCFC26A9EE3300122DDF /* MTRError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRError.h; sourceTree = "<group>"; };
 		51339B1E2A0DA64D00C798C1 /* MTRCertificateValidityTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRCertificateValidityTests.m; sourceTree = "<group>"; };
 		5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceController_Internal.h; sourceTree = "<group>"; };
@@ -814,6 +824,7 @@
 		037C3D7B2991BD4F00B7EEE2 /* commands */ = {
 			isa = PBXGroup;
 			children = (
+				5124311D2BA0C09A000BC136 /* configuration */,
 				B4FCD56C2B603A6300832859 /* bdx */,
 				B4E262182AA0CFFE00DBA5BC /* delay */,
 				03FB93DA2A46200A0048CB35 /* discover */,
@@ -1112,6 +1123,18 @@
 			path = TestHelpers;
 			sourceTree = "<group>";
 		};
+		5124311D2BA0C09A000BC136 /* configuration */ = {
+			isa = PBXGroup;
+			children = (
+				512431182BA0C09A000BC136 /* Commands.h */,
+				512431192BA0C09A000BC136 /* ResetMRPParametersCommand.h */,
+				5124311A2BA0C09A000BC136 /* ResetMRPParametersCommand.mm */,
+				5124311B2BA0C09A000BC136 /* SetMRPParametersCommand.h */,
+				5124311C2BA0C09A000BC136 /* SetMRPParametersCommand.mm */,
+			);
+			path = configuration;
+			sourceTree = "<group>";
+		};
 		51D0B1312B618C4F006E3511 /* ServerEndpoint */ = {
 			isa = PBXGroup;
 			children = (
@@ -1447,6 +1470,7 @@
 				037C3DB12991BD5000B7EEE2 /* OpenCommissioningWindowCommand.h in Headers */,
 				039145E92993179300257B3E /* GetCommissionerNodeIdCommand.h in Headers */,
 				037C3DCE2991BD5100B7EEE2 /* CHIPCommandBridge.h in Headers */,
+				512431272BA0C8BF000BC136 /* SetMRPParametersCommand.h in Headers */,
 				037C3DD22991BD5200B7EEE2 /* InteractiveCommands.h in Headers */,
 				037C3DAF2991BD4F00B7EEE2 /* DeviceControllerDelegateBridge.h in Headers */,
 				B4FCD5712B603A6300832859 /* DownloadLogCommand.h in Headers */,
@@ -1473,7 +1497,9 @@
 				037C3DCC2991BD5100B7EEE2 /* MTRError_Utils.h in Headers */,
 				037C3DAD2991BD4F00B7EEE2 /* PairingCommandBridge.h in Headers */,
 				037C3DBB2991BD5000B7EEE2 /* Commands.h in Headers */,
+				512431262BA0C8BA000BC136 /* ResetMRPParametersCommand.h in Headers */,
 				03FB93DF2A46200A0048CB35 /* Commands.h in Headers */,
+				512431252BA0C8B7000BC136 /* Commands.h in Headers */,
 				037C3DB22991BD5000B7EEE2 /* PreWarmCommissioningCommand.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1797,6 +1823,8 @@
 				037C3DD42991BD5200B7EEE2 /* logging.mm in Sources */,
 				B45374012A9FEC4F00807602 /* unix-sockets.c in Sources */,
 				03F430A82994112B00166449 /* editline.c in Sources */,
+				512431282BA0C8BF000BC136 /* SetMRPParametersCommand.mm in Sources */,
+				512431292BA0C8BF000BC136 /* ResetMRPParametersCommand.mm in Sources */,
 				B45373E92A9FEBC100807602 /* server.c in Sources */,
 				037C3DB32991BD5000B7EEE2 /* OpenCommissioningWindowCommand.mm in Sources */,
 				037C3DAE2991BD4F00B7EEE2 /* PairingCommandBridge.mm in Sources */,
diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh
index e802e99..78023f9 100755
--- a/src/darwin/Framework/chip_xcode_build_connector.sh
+++ b/src/darwin/Framework/chip_xcode_build_connector.sh
@@ -98,6 +98,7 @@
     'chip_build_tests=false'
     'chip_enable_wifi=false'
     'chip_enable_python_modules=false'
+    'chip_device_config_enable_dynamic_mrp_config=true'
     'chip_log_message_max_size=4096' # might as well allow nice long log messages
     'chip_disable_platform_kvs=true'
     'enable_fuzz_test_targets=false'
diff --git a/src/messaging/ReliableMessageMgr.h b/src/messaging/ReliableMessageMgr.h
index 3401a3e..ae953cb 100644
--- a/src/messaging/ReliableMessageMgr.h
+++ b/src/messaging/ReliableMessageMgr.h
@@ -220,7 +220,7 @@
      * set this before actually bringing up the stack and having access to a
      * ReliableMessageMgr.
      */
-    static void SetAdditionaMRPBackoffTime(const Optional<System::Clock::Milliseconds64> & additionalTime)
+    static void SetAdditionalMRPBackoffTime(const Optional<System::Clock::Milliseconds64> & additionalTime)
     {
         sAdditionalMRPBackoffTime = additionalTime;
     }