feat(peakflo): expose NetSuite tools through Peakflo connections (like Xero) - #180
Merged
Merged
Conversation
Mirror the Xero credential-sharing path for NetSuite. When a Peakflo tenant is connected to NetSuite (sourceSystem="netsuite"), the Peakflo MCP server now surfaces NetSuite tools prefixed with `netsuite__` and resolves short-lived NetSuite credentials from the Peakflo credential broker — agents never see the raw credentials. - peakflo/main.py: generalize the Xero-only exposure into a source-system registry (SOURCE_SYSTEM_INTEGRATIONS) supporting both xero and netsuite; generic tool listing, prefix matching, and broker-backed dispatch. - netsuite/main.py: make the client functional — real OAuth 1.0a TBA signing (HMAC-SHA256, account-id realm) with automatic OAuth 2.0 Bearer fallback, correct SuiteTalk REST base URL, SuiteQL-based vendor search, and a credential_resolver hook (like Xero) so wrapper servers can inject creds. - tests: network-free unit tests for auth-mode selection + the broker resolver, plus live TOOL_TESTS for the harness. - README: document the SuiteTalk endpoints, the two auth modes, and the Peakflo shared-access path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
When a Workflo agent connects to Peakflo via pfMCP and the Peakflo tenant is connected to an accounting/ERP system, pfMCP already exposes that system's native tools using Peakflo's stored tokens — but only for Xero (#170). This PR does the same for NetSuite.
When
sourceSystem == "netsuite", the Peakflo MCP server now:netsuite__(e.g.netsuite__execute_suiteql,netsuite__create_record).POST /internal/credentials/system-of-record/resolve,sourceSystem: "netsuite") and injects them into the NetSuite server via acredential_resolver— agents never see the raw credentials.Changes
src/servers/peakflo/main.py— generalized the Xero-only exposure into a source-system registry (SOURCE_SYSTEM_INTEGRATIONS) supporting bothxeroandnetsuite:_resolve_source_system,_get_prefixed_source_system_tools,_match_source_system_tool,_call_source_system_tool_via_peakflo_connection(generic)._build_xero_credential_resolver/_build_netsuite_credential_resolver.handle_list_tools/handle_call_toolnow dispatch via the registry. Adding a new source of record is now a single registry entry.src/servers/netsuite/main.py— the client was a non-functional placeholder (Bearer {consumer_key}, wrongrestletsbase URL, a non-existent/searchendpoint). Made it real so shared credentials actually authenticate:requests-oauthlib, with an automatic OAuth 2.0 Bearer fallback (auth mode chosen from whichever creds are present).{account}.suitetalk.api.netsuite.com/services/rest, account id lowercased +_→-); records via/record/v1/*, SuiteQL via/query/v1/suiteqlwithPrefer: transient.credential_resolverhook tocreate_server(mirrors Xero) so wrapper servers inject creds.Tests —
tests/servers/netsuite/: network-free unit tests for auth-mode selection + the broker resolver (10/10 passing), plus liveTOOL_TESTSfor the harness.README — documents the SuiteTalk endpoints, the two auth modes, and the Peakflo shared-access path.
Notes
list_tools.sourceSystem: "netsuite"(same contract as Xero).accessToken+accountId) to be robust to how Peakflo stores the connection.🤖 Generated with Claude Code