fortrip 0.3.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -21
- package/NOTICE +4 -0
- package/README.md +204 -115
- package/THIRD-PARTY-NOTICES +30 -0
- package/dist/chunk-53656LB2.js +16486 -0
- package/dist/cli.js +292 -1157
- package/dist/mcp-bridge-LPQBHWLD.js +339 -0
- package/package.json +21 -15
- package/AGENT_GUIDE.md +0 -200
- package/guides/planning.md +0 -57
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,150 +1,239 @@
|
|
|
1
|
-
# fortrip
|
|
1
|
+
# fortrip
|
|
2
2
|
|
|
3
|
-
Search,
|
|
4
|
-
The npm package and the command
|
|
3
|
+
Search hotels, check live room rates and book with a payment link, from the
|
|
4
|
+
terminal or an AI agent. Hotels only for now. The npm package and the command
|
|
5
|
+
are both `fortrip`.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npx -y fortrip login
|
|
9
|
+
npx -y fortrip hotels search --query Bangkok --check-in 2026-11-10 --check-out 2026-11-12
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Install and run
|
|
13
|
+
|
|
14
|
+
Node.js 22 or newer. Run it with `npx`, which needs no install:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx -y fortrip <command>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
or install it once and run `fortrip <command>`:
|
|
9
21
|
|
|
10
22
|
```bash
|
|
11
|
-
|
|
12
|
-
npx fortrip search --query Bangkok --check-in 2026-11-10 --check-out 2026-11-12
|
|
23
|
+
npm install --global fortrip
|
|
13
24
|
```
|
|
14
25
|
|
|
15
|
-
|
|
26
|
+
`fortrip --help` lists the commands, `fortrip hotels --help` the hotel
|
|
27
|
+
commands, `fortrip <command> --help` one command's flags, and
|
|
28
|
+
`fortrip --version` prints the version.
|
|
29
|
+
|
|
30
|
+
Upgrading from 0.3: 1.0 signs in with OAuth, so a 0.3 sign-in is not reused;
|
|
31
|
+
run `fortrip login` once. A `FORTRIP_TOKEN` from 0.3 is no longer accepted.
|
|
32
|
+
`fortrip mcp` replaces the separate `fortrip-mcp` package.
|
|
33
|
+
|
|
34
|
+
## Upgrading from 1.x
|
|
35
|
+
|
|
36
|
+
2.0 puts the hotel commands under `fortrip hotels`, with the same flags and
|
|
37
|
+
arguments:
|
|
38
|
+
|
|
39
|
+
| 1.x | 2.0 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `search` | `hotels search` |
|
|
42
|
+
| `hotel <hotelId>` | `hotels get <hotelId>` |
|
|
43
|
+
| `rates` | `hotels rates` |
|
|
44
|
+
| `book` | `hotels book` |
|
|
45
|
+
|
|
46
|
+
Two MCP tools are renamed: `get_rates` is now `get_hotel_rates` and
|
|
47
|
+
`create_booking` is now `book_hotel`. Sign-in is unchanged. `fortrip mcp` now
|
|
48
|
+
also starts before you sign in: it lists its tools, and the first tool call
|
|
49
|
+
answers with the sign-in link. 2.0 is licensed under Apache 2.0 instead of MIT.
|
|
50
|
+
|
|
51
|
+
## Sign in
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
fortrip login
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`login` prints a code and a link on stderr, opens the link in your browser
|
|
58
|
+
(not with `--no-browser`), and waits until you sign in to Fortrip and approve.
|
|
59
|
+
It then prints your account.
|
|
60
|
+
|
|
61
|
+
An AI agent can't sit in `login`, so any other command that needs a sign-in
|
|
62
|
+
doesn't wait: it exits with code 3 and prints `loginUrl`, `userCode` and
|
|
63
|
+
`expiresInSeconds` as JSON on stderr. The agent shows the link to the user;
|
|
64
|
+
once the user has approved it in the browser, the agent reruns the same
|
|
65
|
+
command, which finishes signing in and carries on. Commands that run in
|
|
66
|
+
parallel share one link. When Fortrip stops accepting the saved sign-in (it
|
|
67
|
+
was revoked, or it expired and couldn't be renewed), the command does the same
|
|
68
|
+
and keeps the old sign-in until the new link is approved.
|
|
69
|
+
|
|
70
|
+
You stay signed in. Access tokens last 24 hours and the CLI renews them
|
|
71
|
+
itself, before they run out; refresh tokens don't expire, so the sign-in lasts
|
|
72
|
+
until you run `fortrip logout`, which revokes this machine's sign-in and
|
|
73
|
+
deletes it (other machines stay signed in). `fortrip whoami` prints the
|
|
74
|
+
signed-in account.
|
|
75
|
+
|
|
76
|
+
The sign-in is saved in `~/.config/fortrip/credentials.json` (`$XDG_CONFIG_HOME`
|
|
77
|
+
is honoured), mode `0600`, per API URL, so a token is only sent to the server
|
|
78
|
+
that issued it.
|
|
79
|
+
|
|
80
|
+
If a new or renewed sign-in can't be saved (the file stays busy or turns out to
|
|
81
|
+
be damaged), the `hotels` commands and `whoami` still work for that run, with
|
|
82
|
+
the new token. The sign-in is kept in a `credentials.recovered-*.json`
|
|
83
|
+
file next to the credentials file, and the command's JSON output carries a
|
|
84
|
+
`warning` and, when the sign-in could be kept, that file in `recoveryFile`.
|
|
85
|
+
Later commands use it, and the next successful save merges it back. `login`
|
|
86
|
+
doesn't carry on in that case: it exits 1, with `recoveryFile` in the error, and
|
|
87
|
+
the sign-in is kept in that file all the same.
|
|
88
|
+
|
|
89
|
+
If the directory itself can't be written (a read-only home, as in some agent
|
|
90
|
+
sandboxes), `login` exits 1 before it asks you to approve anything, and any
|
|
91
|
+
other command that needs to save a sign-in exits 1 too. The error says to set
|
|
92
|
+
`XDG_CONFIG_HOME` to a directory that can be written, or to set `FORTRIP_TOKEN`.
|
|
16
93
|
|
|
17
94
|
## Commands
|
|
18
95
|
|
|
19
96
|
| Command | What it does |
|
|
20
97
|
|---|---|
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
command's. `search`, `rates` and `book` also accept `--body '<json>'` or
|
|
31
|
-
`--body @file.json` with the raw request body; flags override its fields.
|
|
98
|
+
| `hotels search` | Find hotels with indicative prices |
|
|
99
|
+
| `hotels get <hotelId>` | Static hotel detail: description, policies, facilities and photos |
|
|
100
|
+
| `hotels rates` | Live rooms and rates for up to 15 hotels |
|
|
101
|
+
| `hotels book` | Create an order and get a payment link |
|
|
102
|
+
| `login` | Sign in through the browser (device code) |
|
|
103
|
+
| `logout` | Revoke and forget the saved token |
|
|
104
|
+
| `whoami` | Show the signed-in account |
|
|
105
|
+
| `guide [topic]` | Print the guide for AI agents (Markdown) |
|
|
106
|
+
| `mcp` | Run an MCP server over stdio for local clients, bridged to Fortrip's hosted server |
|
|
32
107
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
108
|
+
```bash
|
|
109
|
+
fortrip hotels rates --hotel <hotelId> --check-in 2026-11-10 --check-out 2026-11-12 --rooms 1 --adults 2
|
|
110
|
+
```
|
|
36
111
|
|
|
37
|
-
|
|
112
|
+
`hotels search`, `hotels rates` and `hotels book` also accept `--body '<json>'`
|
|
113
|
+
or `--body @file.json` with the raw request body; flags override its fields.
|
|
38
114
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
| 1 | Other error (`retryable: true` on stderr: worth one retry) |
|
|
43
|
-
| 2 | Invalid arguments (local or HTTP 400) |
|
|
44
|
-
| 3 | Not logged in, or the sign-in wasn't accepted (HTTP 401) |
|
|
45
|
-
| 4 | Rate limited (HTTP 429; `retryAfterSeconds` on stderr) |
|
|
115
|
+
`--adults` and `--child-age` are per room, and every room has the same
|
|
116
|
+
occupancy: 2 rooms for 4 adults is `--rooms 2 --adults 2`. `hotels rates` and
|
|
117
|
+
`hotels book` both require `--rooms` and `--adults`.
|
|
46
118
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
API URL, so a saved token is only sent to the server that issued it.
|
|
52
|
-
- Without a token, any other command starts a device login and exits 3 with
|
|
53
|
-
`loginUrl` on stderr instead of waiting. Once that link is approved in the
|
|
54
|
-
browser, rerunning the command saves the token and carries on. This is how
|
|
55
|
-
AI agents sign in, since they can't sit in `login`. Commands run in
|
|
56
|
-
parallel share one login link. If the server doesn't accept the saved
|
|
57
|
-
token, the command keeps it and starts a new login the same way; once that
|
|
58
|
-
link is approved, the new token replaces the saved one.
|
|
59
|
-
- `FORTRIP_TOKEN` overrides the saved login (CI, remote sandboxes). It is not
|
|
60
|
-
tied to a server: it is sent to whatever `FORTRIP_API_URL` points at. If the
|
|
61
|
-
server doesn't accept it, commands exit 3 with `tokenSource: "FORTRIP_TOKEN"`
|
|
62
|
-
and no `loginUrl`.
|
|
63
|
-
- `FORTRIP_API_URL` overrides the base URL (default `https://fortrip.ai`).
|
|
64
|
-
Plain `http` is only accepted for `localhost`.
|
|
65
|
-
- `FORTRIP_CURRENCY` sets the default `--currency` for `search` and `rates`
|
|
66
|
-
(`CNY` or `USD`; the API defaults to `CNY`). Display only: `book`
|
|
67
|
-
charges the currency it returns.
|
|
68
|
-
|
|
69
|
-
`logout` revokes the saved token. With the Fortrip server update released
|
|
70
|
-
alongside CLI 0.3.1, sign-ins that go unused for 90 days stop working, and
|
|
71
|
-
signed-in users can list and revoke their CLI sign-ins in their Fortrip
|
|
72
|
-
account (account menu → **Fortrip CLI**).
|
|
73
|
-
|
|
74
|
-
If a new sign-in can't be saved (the file is busy or damaged), it is kept
|
|
75
|
-
in a `credentials.recovered-*.json` file next to `credentials.json` (mode
|
|
76
|
-
`0600`), and the command's JSON output names it in `warning` and
|
|
77
|
-
`recoveryFile`. The next successful save merges it back and removes the
|
|
78
|
-
file; `logout` revokes and removes these too.
|
|
79
|
-
|
|
80
|
-
Sharing `credentials.json` with 0.3.0 works on a best-effort basis: 0.3.0
|
|
81
|
-
finds the newest pending login where it expects it, but it writes the file
|
|
82
|
-
without a lock, so don't sign in with 0.3.0 and 0.3.1 at the same moment.
|
|
83
|
-
|
|
84
|
-
## Agent skill
|
|
119
|
+
`hotels book` creates an unpaid order and prints a payment link for it.
|
|
120
|
+
Nothing is charged until the person pays on the page the link opens.
|
|
121
|
+
|
|
122
|
+
## For AI agents
|
|
85
123
|
|
|
86
124
|
```bash
|
|
87
|
-
npx
|
|
125
|
+
npx -y fortrip guide # when to use the CLI, call order, sign-in, what to show before a payment link
|
|
126
|
+
npx -y fortrip guide planning # flexible dates, budgets, split stays, several destinations
|
|
88
127
|
```
|
|
89
128
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
and what to show the user before handing over a payment link. The guide ships
|
|
96
|
-
with the package, so a CLI release updates every installed skill. Edit
|
|
97
|
-
`AGENT_GUIDE.md`, not the skill.
|
|
98
|
-
|
|
99
|
-
`fortrip skill planning` prints [`guides/planning.md`](guides/planning.md):
|
|
100
|
-
what to ask, how to rank and how to present options for flexible dates,
|
|
101
|
-
budgets, split stays and several destinations. Both guides are printed with
|
|
102
|
-
`fortrip@latest` replaced by the running version, so an agent keeps using the
|
|
103
|
-
same CLI for the whole conversation.
|
|
129
|
+
Both print Markdown, with `fortrip@latest` replaced by the running version, so
|
|
130
|
+
an agent keeps using the same CLI for the whole conversation. The guide is
|
|
131
|
+
written once in
|
|
132
|
+
[`@fortrip/agent-contract`](https://github.com/FortripEngineering/fortrip/tree/main/packages/contract/guide)
|
|
133
|
+
and compiled into the CLI.
|
|
104
134
|
|
|
105
|
-
|
|
135
|
+
For agents that can run shell commands, the same guide is also a skill:
|
|
106
136
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
137
|
+
```bash
|
|
138
|
+
npx skills add FortripEngineering/fortrip --skill fortrip-cli
|
|
139
|
+
```
|
|
110
140
|
|
|
111
|
-
##
|
|
141
|
+
## MCP server
|
|
142
|
+
|
|
143
|
+
`fortrip mcp` runs an MCP server on stdio for clients that start local
|
|
144
|
+
servers. It forwards to Fortrip's hosted MCP server, `https://fortrip.ai/api/mcp`,
|
|
145
|
+
with your saved sign-in.
|
|
146
|
+
|
|
147
|
+
You can add the server to a client before you sign in: signed out, it still
|
|
148
|
+
starts and lists its tools. The first tool call is then answered with a
|
|
149
|
+
JSON-RPC error (`-32001`) whose message says to run `npx -y fortrip login` in a
|
|
150
|
+
terminal, or to open the sign-in link it names and approve it. Once you have,
|
|
151
|
+
the next tool call works, with no restart. If a sign-in stops working later,
|
|
152
|
+
only the request that hit it fails with the same kind of error, and the server
|
|
153
|
+
keeps running.
|
|
154
|
+
|
|
155
|
+
Claude Desktop (Settings, Developer, Edit Config; on macOS
|
|
156
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json`, on Windows
|
|
157
|
+
`%APPDATA%\Claude\claude_desktop_config.json`) and Cursor (`~/.cursor/mcp.json`,
|
|
158
|
+
or `.cursor/mcp.json` in a project):
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"mcpServers": {
|
|
163
|
+
"fortrip": {
|
|
164
|
+
"command": "npx",
|
|
165
|
+
"args": ["-y", "fortrip", "mcp"]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Claude Code:
|
|
112
172
|
|
|
113
173
|
```bash
|
|
114
|
-
|
|
115
|
-
pnpm dev search --query Bangkok ... # run from source
|
|
116
|
-
pnpm test
|
|
117
|
-
pnpm typecheck
|
|
118
|
-
pnpm build # dist/cli.js
|
|
174
|
+
claude mcp add fortrip -- npx -y fortrip mcp
|
|
119
175
|
```
|
|
120
176
|
|
|
121
|
-
|
|
177
|
+
Codex, with `codex mcp add fortrip -- npx -y fortrip mcp` or in
|
|
178
|
+
`~/.codex/config.toml`:
|
|
122
179
|
|
|
123
|
-
|
|
180
|
+
```toml
|
|
181
|
+
[mcp_servers.fortrip]
|
|
182
|
+
command = "npx"
|
|
183
|
+
args = ["-y", "fortrip", "mcp"]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Clients that support remote MCP servers with OAuth don't need the CLI: add
|
|
187
|
+
`https://fortrip.ai/api/mcp` as a remote server and sign in to Fortrip in the
|
|
188
|
+
browser when the client asks. In Claude Code, that is
|
|
189
|
+
`claude mcp add --transport http fortrip https://fortrip.ai/api/mcp`.
|
|
190
|
+
|
|
191
|
+
## Environment variables
|
|
192
|
+
|
|
193
|
+
| Variable | Meaning |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `FORTRIP_TOKEN` | An access token, used instead of the saved sign-in. It lasts at most 24 hours, so it suits one sandbox session or one CI run, not standing CI. It isn't tied to a server: it is sent to whatever `FORTRIP_API_URL` points at. If Fortrip doesn't accept it, or it contains a line break or another character that can't be sent in a header, commands exit 3 with `tokenSource: "FORTRIP_TOKEN"` and no `loginUrl`; the error never repeats the token. |
|
|
196
|
+
| `FORTRIP_API_URL` | The base URL (default `https://fortrip.ai`). Plain `http` is only accepted for `localhost`. |
|
|
197
|
+
| `FORTRIP_CURRENCY` | The default `--currency` for `hotels search` and `hotels rates` (`CNY` or `USD`; the API uses `CNY` when nothing sets one). It only changes how prices are shown: `hotels book` charges the currency it returns. |
|
|
124
198
|
|
|
125
|
-
|
|
126
|
-
[`.github/workflows/publish.yml`](.github/workflows/publish.yml), which signs
|
|
127
|
-
in with npm trusted publishing (no npm token in GitHub). Pull requests and
|
|
128
|
-
pushes to `main` run typecheck, tests and the build through
|
|
129
|
-
[`.github/workflows/ci.yml`](.github/workflows/ci.yml).
|
|
199
|
+
## Output and exit codes
|
|
130
200
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
201
|
+
Data commands (the `hotels` commands, `login`, `logout` and `whoami`) print
|
|
202
|
+
JSON on stdout. `guide` prints Markdown, and `fortrip mcp`
|
|
203
|
+
speaks MCP over stdio. Errors are JSON on stderr, with an `error` message, the
|
|
204
|
+
`exitCode` and any details.
|
|
134
205
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
206
|
+
| Code | Meaning |
|
|
207
|
+
|---|---|
|
|
208
|
+
| 0 | Success |
|
|
209
|
+
| 1 | Other error (`retryable: true` on stderr: worth one retry) |
|
|
210
|
+
| 2 | Invalid arguments (local or HTTP 400) |
|
|
211
|
+
| 3 | Not signed in, or the sign-in wasn't accepted (HTTP 401); `loginUrl` on stderr |
|
|
212
|
+
| 4 | Rate limited (HTTP 429; `retryAfterSeconds` on stderr) |
|
|
213
|
+
|
|
214
|
+
## Support
|
|
215
|
+
|
|
216
|
+
For changes, cancellations, refunds or other help with a booking, email
|
|
217
|
+
[info@fortrip.ai](mailto:info@fortrip.ai) with the booking's order link
|
|
218
|
+
(`orderUrl`).
|
|
219
|
+
|
|
220
|
+
## Releasing
|
|
139
221
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
the new guide on its next `npx fortrip@latest skill`.
|
|
222
|
+
Both packages in this repository, `fortrip` and `@fortrip/agent-contract`,
|
|
223
|
+
are released together from a `vX.Y.Z` tag. See
|
|
224
|
+
[Releasing](https://github.com/FortripEngineering/fortrip#releasing) in the
|
|
225
|
+
repository's README.
|
|
145
226
|
|
|
146
227
|
## License
|
|
147
228
|
|
|
148
229
|
The code and documentation in this repository are licensed under the
|
|
149
|
-
[
|
|
150
|
-
|
|
230
|
+
[Apache License 2.0](https://github.com/FortripEngineering/fortrip/blob/main/LICENSE).
|
|
231
|
+
Copyright 2026 FortripAI, Inc. Versions before 2.0.0 were published under the
|
|
232
|
+
MIT License. This license does not grant access to the hosted Fortrip service,
|
|
233
|
+
hotel inventory, or third-party data.
|
|
234
|
+
|
|
235
|
+
"Fortrip" and the Fortrip logo are trademarks of FortripAI, Inc. The license
|
|
236
|
+
does not grant permission to use the trade names, trademarks, service marks or
|
|
237
|
+
product names of FortripAI, Inc., except as required for reasonable and
|
|
238
|
+
customary use in describing the origin of the software and reproducing the
|
|
239
|
+
content of the NOTICE file (section 6).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Third-party notices for the fortrip package
|
|
2
|
+
|
|
3
|
+
The files in dist/ include code from the packages below, bundled into them.
|
|
4
|
+
Each is listed with its version and license, followed by the license text
|
|
5
|
+
from the package's LICENSE file.
|
|
6
|
+
|
|
7
|
+
================================================================================
|
|
8
|
+
zod 4.4.3 (MIT)
|
|
9
|
+
--------------------------------------------------------------------------------
|
|
10
|
+
MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2025 Colin McDonnell
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|