Skip to content

Commit 532cf20

Browse files
authored
Merge pull request #1 from gemini/initial-project-structure
Initial project structure
2 parents e48598f + 49fafd0 commit 532cf20

74 files changed

Lines changed: 7149 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Dependencies
2+
node_modules/
3+
vendor/
4+
5+
# Build output
6+
dist/
7+
build/
8+
out/
9+
*.js.map
10+
11+
# TypeScript
12+
*.tsbuildinfo
13+
14+
# Environment & secrets
15+
.env
16+
.env.*
17+
!.env.example
18+
*.pem
19+
*.key
20+
21+
# OS
22+
.DS_Store
23+
Thumbs.db
24+
25+
# Editors
26+
.vscode/
27+
.idea/
28+
*.swp
29+
*.swo
30+
31+
# Logs
32+
logs/
33+
*.log
34+
npm-debug.log*
35+
36+
# Python
37+
__pycache__/
38+
*.py[cod]
39+
*.egg-info/
40+
.venv/
41+
venv/
42+
43+
# Go
44+
*.exe
45+
*.test
46+
*.out
47+
48+
# Temp
49+
tmp/
50+
.tmp/
51+
52+
# SDK generation
53+
scripts/rest.yaml
54+
packages/sdk-go/
55+
packages/sdk-python/
56+
packages/sdk-typescript/

LICENSE

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
http://www.apache.org/licenses/
4+
5+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6+
7+
1. Definitions.
8+
9+
"License" shall mean the terms and conditions for use, reproduction,
10+
and distribution as defined by Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity authorized by
13+
the copyright owner that is granting the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all
16+
other entities that control, are controlled by, or are under common
17+
control with that entity. For the purposes of this definition,
18+
"control" means (i) the power, direct or indirect, to cause the
19+
direction or management of such entity, whether by contract or
20+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
21+
outstanding shares, or (iii) beneficial ownership of such entity.
22+
23+
"You" (or "Your") shall mean an individual or Legal Entity
24+
exercising permissions granted by this License.
25+
26+
"Source" form shall mean the preferred form for making modifications,
27+
including but not limited to software source code, documentation
28+
source, and configuration files.
29+
30+
"Object" form shall mean any form resulting from mechanical
31+
transformation or translation of a Source form, including but
32+
not limited to compiled object code, generated documentation,
33+
and conversions to other media types.
34+
35+
"Work" shall mean the work of authorship made available under
36+
the License, as indicated by a copyright notice that is included in
37+
or attached to the work (an example is provided in the Appendix below).
38+
39+
"Derivative Works" shall mean any work, whether in Source or Object
40+
form, that is based on (or derived from) the Work and for which the
41+
editorial revisions, annotations, elaborations, or other modifications
42+
represent, as a whole, an original work of authorship. For the purposes
43+
of this License, Derivative Works shall not include works that remain
44+
separable from, or merely link (or bind by name) to the interfaces of,
45+
the Work and derivative works thereof.
46+
47+
"Contribution" shall mean, as submitted to the Licensor for inclusion
48+
in the Work by the copyright owner or by an individual or Legal Entity
49+
authorized to submit on behalf of the copyright owner. For the purposes
50+
of this definition, "submitted" means any form of electronic, verbal,
51+
or written communication sent to the Licensor or its representatives,
52+
including but not limited to communication on electronic mailing lists,
53+
source code control systems, and issue tracking systems that are managed
54+
by, or on behalf of, the Licensor for the purpose of discussing and
55+
improving the Work, but excluding communication that is conspicuously
56+
marked or designated in writing by the copyright owner as "Not a
57+
Contribution."
58+
59+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
60+
whom a Contribution has been received by the Licensor and incorporated
61+
within the Work.
62+
63+
2. Grant of Copyright License. Subject to the terms and conditions of
64+
this License, each Contributor hereby grants to You a perpetual,
65+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66+
copyright license to reproduce, prepare Derivative Works of,
67+
publicly display, publicly perform, sublicense, and distribute the
68+
Work and such Derivative Works in Source or Object form.
69+
70+
3. Grant of Patent License. Subject to the terms and conditions of
71+
this License, each Contributor hereby grants to You a perpetual,
72+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73+
(except as stated in this section) patent license to make, have made,
74+
use, offer to sell, sell, import, and otherwise transfer the Work,
75+
where such license applies only to those patent claims licensable
76+
by such Contributor that are necessarily infringed by their
77+
Contribution(s) alone or by combination of their Contribution(s)
78+
with the Work to which such Contribution(s) was submitted. If You
79+
institute patent litigation against any entity (including a cross-claim
80+
or counterclaim in a lawsuit) alleging that the Work or any
81+
Contribution embodied within the Work constitutes direct or contributory
82+
patent infringement, then any patent licenses granted to You under
83+
this License for that Work shall terminate as of the date such
84+
litigation is filed.
85+
86+
4. Redistribution. You may reproduce and distribute copies of the
87+
Work or Derivative Works thereof in any medium, with or without
88+
modifications, and in Source or Object form, provided that You
89+
meet the following conditions:
90+
91+
(a) You must give any other recipients of the Work or Derivative
92+
Works a copy of this License; and
93+
94+
(b) You must cause any modified files to carry prominent notices
95+
stating that You changed the files; and
96+
97+
(c) You must retain, in the Source form of any Derivative Works
98+
that You distribute, all copyright, patent, trademark, and
99+
attribution notices from the Source form of the Work,
100+
excluding those notices that do not pertain to any part of
101+
the Derivative Works; and
102+
103+
(d) If the Work includes a "NOTICE" text file as part of its
104+
distribution, You must include a readable copy of the
105+
attribution notices contained within such NOTICE file, in
106+
at least one of the following places: within a NOTICE text
107+
file distributed as part of the Derivative Works; within
108+
the Source form or documentation, if provided along with the
109+
Derivative Works; or, within a display generated by the
110+
Derivative Works, if and wherever such third-party notices
111+
normally appear. The contents of the NOTICE file are for
112+
informational purposes only and do not modify the License.
113+
You may add Your own attribution notices within Derivative
114+
Works that You distribute, alongside or in addition to the
115+
NOTICE text from the Work, provided that such additional
116+
attribution notices cannot be construed as modifying the License.
117+
118+
You may add Your own license statement for Your modifications and
119+
may provide additional grant of rights to use, copy, modify, merge,
120+
publish, distribute, sublicense, and/or sell copies of the
121+
Contribution, and to permit persons to whom the Contribution is
122+
furnished to do so.
123+
124+
5. Submission of Contributions. Unless You explicitly state otherwise,
125+
any Contribution intentionally submitted for inclusion in the Work
126+
by You to the Licensor shall be under the terms and conditions of
127+
this License, without any additional terms or conditions.
128+
Notwithstanding the above, nothing herein shall supersede or modify
129+
the terms of any separate license agreement you may have executed
130+
with Licensor regarding such Contributions.
131+
132+
6. Trademarks. This License does not grant permission to use the trade
133+
names, trademarks, service marks, or product names of the Licensor,
134+
except as required for reasonable and customary use in describing the
135+
origin of the Work and reproducing the content of the NOTICE file.
136+
137+
7. Disclaimer of Warranty. Unless required by applicable law or
138+
agreed to in writing, Licensor provides the Work (and each
139+
Contributor provides its Contributions) on an "AS IS" BASIS,
140+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141+
implied, including, without limitation, any warranties or conditions
142+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143+
PARTICULAR PURPOSE. You are solely responsible for determining the
144+
appropriateness of using or reproducing the Work and assume any
145+
risks associated with Your exercise of permissions under this License.
146+
147+
8. Limitation of Liability. In no event and under no legal theory,
148+
whether in tort (including negligence), contract, or otherwise,
149+
unless required by applicable law (such as deliberate and grossly
150+
negligent acts) or agreed to in writing, shall any Contributor be
151+
liable to You for damages, including any direct, indirect, special,
152+
incidental, or exemplary damages of any character arising as a
153+
result of this License or out of the use or inability to use the
154+
Work (including but not limited to damages for loss of goodwill,
155+
work stoppage, computer failure or malfunction, or all other
156+
commercial damages or losses), even if such Contributor has been
157+
advised of the possibility of such damages.
158+
159+
9. Accepting Warranty or Additional Liability. While redistributing
160+
the Work or Derivative Works thereof, You may choose to offer,
161+
and charge a fee for, acceptance of support, warranty, indemnity,
162+
or other liability obligations and/or rights consistent with this
163+
License. However, in accepting such obligations, You may act only
164+
on Your own behalf and on Your sole responsibility, not on behalf
165+
of any other Contributor, and only if You agree to indemnify,
166+
defend, and hold each Contributor harmless for any liability
167+
incurred by, or claims asserted against, such Contributor by reason
168+
of your accepting any such warranty or additional liability.
169+
170+
END OF TERMS AND CONDITIONS
171+
172+
APPENDIX: How to apply the Apache License to your work.
173+
174+
To apply the Apache License to your work, attach the following
175+
boilerplate notice, with the fields enclosed by brackets "[]"
176+
replaced with your own identifying information. (Don't include
177+
the brackets!) The text should be enclosed in the appropriate
178+
comment syntax for the file format in question. It may also be
179+
included in a separate file called "LICENSE" accompanying the
180+
work, or embedded in the source code comments.
181+
182+
Copyright [yyyy] [name of copyright owner]
183+
184+
Licensed under the Apache License, Version 2.0 (the "License");
185+
you may not use this file except in compliance with the License.
186+
You may obtain a copy of the License at
187+
188+
http://www.apache.org/licenses/LICENSE-2.0
189+
190+
Unless required by applicable law or agreed to in writing, software
191+
distributed under the License is distributed on an "AS IS" BASIS,
192+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193+
See the License for the specific language governing permissions and
194+
limitations under the License.

packages/mcp-server/README.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Gemini MCP Server
2+
3+
An MCP (Model Context Protocol) server that exposes the [Gemini cryptocurrency exchange API](https://docs.gemini.com/rest-api/) as tools for AI assistants like Claude.
4+
5+
## Setup
6+
7+
### 1. Get Gemini API credentials
8+
9+
Create an API key at [exchange.gemini.com/settings/api](https://exchange.gemini.com/settings/api). You'll need both the API key and secret.
10+
11+
> **Master API keys:** If your key starts with `master-`, it has access to multiple sub-accounts and you must also specify which account to target via `GEMINI_ACCOUNT` (e.g. `"primary"`). The server will exit with a clear error on startup if this is missing.
12+
13+
### 2. Install and build
14+
15+
```bash
16+
git clone <repo-url> && cd packages/mcp-server
17+
npm install
18+
npm run build
19+
```
20+
21+
### 3. Add to your MCP client
22+
23+
Credentials are passed as environment variables in your MCP client config — do not use `.env` files.
24+
25+
**Claude Code** — add via the CLI:
26+
27+
```bash
28+
claude mcp add gemini -s user -e GEMINI_API_KEY=your_key -e GEMINI_API_SECRET=your_secret -- node /absolute/path/to/mcp-server/dist/index.js
29+
```
30+
31+
For a Master API key, also pass `GEMINI_ACCOUNT`:
32+
33+
```bash
34+
claude mcp add gemini -s user -e GEMINI_API_KEY=master-xxxx -e GEMINI_API_SECRET=your_secret -e GEMINI_ACCOUNT=primary -- node /absolute/path/to/mcp-server/dist/index.js
35+
```
36+
37+
The `-s user` flag registers the server globally across all your projects. Omit it to register only for the current project.
38+
39+
**Claude Desktop** — add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
40+
41+
```json
42+
{
43+
"mcpServers": {
44+
"gemini": {
45+
"command": "node",
46+
"args": ["/absolute/path/to/mcp-server/dist/index.js"],
47+
"env": {
48+
"GEMINI_API_KEY": "your_api_key_here",
49+
"GEMINI_API_SECRET": "your_api_secret_here",
50+
"GEMINI_ACCOUNT": "primary"
51+
}
52+
}
53+
}
54+
}
55+
```
56+
57+
**ChatGPT** — add to your ChatGPT desktop app's MCP config file at `~/.chatgpt/mcp.json`:
58+
59+
```json
60+
{
61+
"servers": {
62+
"gemini": {
63+
"command": "node",
64+
"args": ["/absolute/path/to/mcp-server/dist/index.js"],
65+
"env": {
66+
"GEMINI_API_KEY": "your_api_key_here",
67+
"GEMINI_API_SECRET": "your_api_secret_here",
68+
"GEMINI_ACCOUNT": "primary"
69+
}
70+
}
71+
}
72+
}
73+
```
74+
75+
> **Sandbox testing:** Set `GEMINI_API_BASE_URL=https://api.sandbox.gemini.com` to use Gemini's sandbox environment.
76+
77+
## Examples
78+
79+
### Check prices and balances
80+
81+
> "What's the current price of BTC and ETH?"
82+
83+
The assistant will call `gemini_get_ticker` for both symbols and return the latest bid/ask/last prices.
84+
85+
> "Show me my account balances."
86+
87+
Calls `gemini_get_balances` and returns your holdings across all currencies.
88+
89+
### Place and manage orders
90+
91+
> "Buy 0.01 BTC at $60,000."
92+
93+
The assistant calls `gemini_new_order` with symbol `btcusd`, side `buy`, amount `0.01`, and price `60000`.
94+
95+
> "Cancel all my open orders."
96+
97+
Calls `gemini_cancel_all_active_orders` to clear your order book.
98+
99+
### Market analysis
100+
101+
> "Show me the 1-hour candles for ETH/USD over the last day."
102+
103+
Calls `gemini_get_candles` with symbol `ethusd` and time frame `1hr`.
104+
105+
> "What's the order book depth for SOLUSD?"
106+
107+
Calls `gemini_get_order_book` and returns current bids and asks.
108+
109+
### Staking
110+
111+
> "What are my current staking positions and rewards?"
112+
113+
Calls `gemini_get_staking_balances` to show staked assets and accrued rewards.
114+
115+
> "Stake 1 ETH."
116+
117+
Calls `gemini_stake` with the specified currency and amount.
118+
119+
## Available tools
120+
121+
| Category | Tools | Auth required |
122+
|-----------------|---------------------------------------------------------------------------|---------------|
123+
| **Market Data** | Tickers, candles, order book, trades, auctions, price feed, funding rates | No |
124+
| **Orders** | Place, cancel, status, active orders, trade history, volume | Yes |
125+
| **Funds** | Balances, transfers, deposit addresses, withdrawals, bank accounts | Yes |
126+
| **Account** | Account details, sub-accounts, roles, approved addresses | Yes |
127+
| **Margin** | Margin account, preview, positions, funding payments | Yes |
128+
| **Staking** | Balances, history, rates, stake, unstake | Yes |
129+
130+
## Development
131+
132+
```bash
133+
npm run dev # Run with hot reload via tsx
134+
npm run build # Compile TypeScript
135+
npm start # Run compiled output
136+
```

0 commit comments

Comments
 (0)