coinex-mcp-server 0.1.0a6__tar.gz

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.
@@ -0,0 +1,9 @@
1
+ # CoinEx API Credentials
2
+ # Get your API credentials from: https://www.coinex.com/
3
+ COINEX_ACCESS_ID=your_access_id_here
4
+ COINEX_SECRET_KEY=your_secret_key_here
5
+
6
+ # Optional: HTTP Authentication Settings
7
+ # HTTP_AUTH_ENABLED=true
8
+ # API_TOKEN=your_bearer_token_here
9
+ # API_SCOPES=read,write
@@ -0,0 +1,201 @@
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, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,22 @@
1
+ # Include documentation files
2
+ include README.md
3
+ include README_cn.md
4
+ include LICENSE
5
+
6
+ # Include configuration examples
7
+ include .env.example
8
+
9
+ # Exclude development and build files
10
+ global-exclude __pycache__
11
+ global-exclude *.py[co]
12
+ global-exclude .DS_Store
13
+ global-exclude *.so
14
+ global-exclude *.dylib
15
+
16
+ # Exclude test and development directories
17
+ prune tests
18
+ prune .git
19
+ prune .idea
20
+ prune .pytest_cache
21
+ prune .venv
22
+ prune deploy
@@ -0,0 +1,346 @@
1
+ Metadata-Version: 2.4
2
+ Name: coinex-mcp-server
3
+ Version: 0.1.0a6
4
+ Summary: A CoinEx MCP (Model Context Protocol) server that enables AI agents to interact with the CoinEx cryptocurrency exchange
5
+ Author: CoinEx MCP Contributors
6
+ Maintainer: CoinEx MCP Contributors
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/coinexcom/coinex_mcp_server
9
+ Project-URL: Repository, https://github.com/coinexcom/coinex_mcp_server
10
+ Project-URL: Documentation, https://github.com/coinexcom/coinex_mcp_server#readme
11
+ Project-URL: Bug Tracker, https://github.com/coinexcom/coinex_mcp_server/issues
12
+ Keywords: coinex,mcp,model-context-protocol,cryptocurrency,exchange,trading,api,fastmcp,ai-agent
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Office/Business :: Financial
21
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Framework :: AsyncIO
24
+ Classifier: Environment :: Console
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: httpx>=0.28.1
29
+ Requires-Dist: fastmcp==2.12.4
30
+ Requires-Dist: python-dotenv>=1.1.1
31
+ Requires-Dist: pydantic>=2.7.0
32
+ Dynamic: license-file
33
+
34
+ # CoinEx MCP Server
35
+
36
+ [中文版本](README_cn.md) | English
37
+
38
+ A CoinEx MCP (Model Context Protocol) server that enables AI agents to interact with the CoinEx cryptocurrency exchange.
39
+
40
+ ## Features
41
+
42
+ - 🔍 Retrieve market data (spot/futures with unified parameters)
43
+ - 💰 Query account balances (authentication required)
44
+ - 📊 Get K-line data (spot/futures)
45
+ - 📈 View order book depth (spot/futures)
46
+ - 💹 Place orders (authentication required)
47
+ - 📋 Query order history (authentication required)
48
+ - 📜 Futures-specific: funding rates, premium/basis history, margin tiers, liquidation history, etc.
49
+
50
+ ## Installation & Configuration
51
+
52
+ ### 1. Install Dependencies
53
+
54
+ ```bash
55
+ uv sync
56
+ ```
57
+
58
+ ### 2. Configure API Credentials
59
+
60
+ In the default stdio mode, API credentials are obtained through environment variables, but typically MCP servers are not launched directly from the command line. You can configure credentials in two ways:
61
+
62
+ #### 2.1 MCP Client Configuration
63
+ Through MCP clients like Claude Desktop, CherryStudio, or mcp inspector.
64
+
65
+ #### 2.2 Local File Configuration
66
+ 1. Copy the environment variable template file:
67
+ ```bash
68
+ cp .env.example .env
69
+ ```
70
+
71
+ 2. Edit the `.env` file and fill in your CoinEx API credentials:
72
+ ```env
73
+ COINEX_ACCESS_ID=your_access_id_here
74
+ COINEX_SECRET_KEY=your_secret_key_here
75
+ ```
76
+ _Note: In SSE or Streamable HTTP mode, environment variable credentials will be ignored._
77
+
78
+ ### 3. Obtain CoinEx API Credentials
79
+
80
+ 1. Log in to [CoinEx Official Website](https://www.coinex.com/)
81
+ 2. Go to **User Center** -> **API Management**
82
+ 3. Create a new API Key
83
+ 4. Copy the Access ID and Secret Key to your `.env` file
84
+
85
+ ⚠️ **Security Notice**:
86
+ - Keep your API credentials safe and do not share them with others
87
+ - Set appropriate permissions for your API Key, only enabling necessary functions
88
+ - Do not commit the `.env` file to version control systems
89
+
90
+ ## MCP Client Configuration
91
+
92
+ As published to PyPI, you can configure MCP clients to use this server without pre-installing the package.
93
+
94
+ ### Using uvx (Recommended)
95
+
96
+ [uvx](https://docs.astral.sh/uv/guides/tools/) automatically manages package installation and environment isolation, similar to npx for Node.js.
97
+
98
+ #### Claude Desktop Configuration
99
+
100
+ Edit your Claude Desktop configuration file:
101
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
102
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
103
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "coinex": {
109
+ "command": "uvx",
110
+ "args": ["coinex-mcp-server"],
111
+ "env": {
112
+ "COINEX_ACCESS_ID": "your_access_id_here",
113
+ "COINEX_SECRET_KEY": "your_secret_key_here"
114
+ }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ #### CherryStudio Configuration
121
+
122
+ In CherryStudio's MCP settings, add:
123
+
124
+ ```json
125
+ {
126
+ "mcpServers": {
127
+ "coinex": {
128
+ "command": "uvx",
129
+ "args": ["coinex-mcp-server"],
130
+ "env": {
131
+ "COINEX_ACCESS_ID": "your_access_id_here",
132
+ "COINEX_SECRET_KEY": "your_secret_key_here"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ #### HTTP Mode with uvx
140
+
141
+ To run the server in HTTP mode:
142
+
143
+ ```json
144
+ {
145
+ "mcpServers": {
146
+ "coinex-http": {
147
+ "command": "uvx",
148
+ "args": [
149
+ "coinex-mcp-server",
150
+ "--transport",
151
+ "http",
152
+ "--host",
153
+ "127.0.0.1",
154
+ "--port",
155
+ "8000",
156
+ "--path",
157
+ "/mcp"
158
+ ]
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ ### Using Pre-installed Package
165
+
166
+ If you prefer to install the package first:
167
+
168
+ ```bash
169
+ # Install the package
170
+ pip install coinex-mcp-server
171
+
172
+ # Or with uv
173
+ uv pip install coinex-mcp-server
174
+ ```
175
+
176
+ Then configure your MCP client:
177
+
178
+ ```json
179
+ {
180
+ "mcpServers": {
181
+ "coinex": {
182
+ "command": "python",
183
+ "args": [
184
+ "-m",
185
+ "coinex_mcp_server.main"
186
+ ],
187
+ "env": {
188
+ "COINEX_ACCESS_ID": "your_access_id_here",
189
+ "COINEX_SECRET_KEY": "your_secret_key_here"
190
+ }
191
+ }
192
+ }
193
+ }
194
+ ```
195
+
196
+ ## From Source Usage
197
+
198
+ ### clone the project
199
+ `git clone https://github.com/coinexcom/coinex_mcp_server`
200
+
201
+ ### Start the Server
202
+
203
+ ```bash
204
+ python -m coinex_mcp_server.main
205
+ ```
206
+
207
+ ### Command Line Arguments & Examples
208
+
209
+ The server supports command line arguments for switching transport protocols and network configuration:
210
+
211
+ - `--transport`: Transport protocol, options: `stdio` (default) | `http` (equivalent to `streamable-http`) | `streamable-http` | `sse`
212
+ - `--host`: HTTP service bind address (only valid for http/streamable-http mode)
213
+ - `--port`: HTTP service port (only valid for http/streamable-http mode)
214
+ - `--path`: Endpoint path
215
+ - http/streamable-http mode: MCP endpoint path (default `/mcp`)
216
+ - sse mode: SSE mount path
217
+ - `--enable-http-auth`: Enable HTTP-based authentication and sensitive tools (disabled by default, only exposes query tools)
218
+ - `--workers`: Number of worker processes for HTTP/SSE mode (managed by underlying uvicorn)
219
+
220
+ #### View Help:
221
+ ```bash
222
+ python -m coinex_mcp_server.main --help
223
+ ```
224
+
225
+ #### Default stdio Service Start
226
+ (Usually no manual start needed, configure startup file and parameters in agent)
227
+ ```bash
228
+ python -m coinex_mcp_server.main
229
+ ```
230
+
231
+ #### Start HTTP Service
232
+ ```bash
233
+ python -m coinex_mcp_server.main --transport http --host 0.0.0.0 --port 8000 --path /mcp --workers 2
234
+ ```
235
+
236
+ Note: If using HTTP GET method to directly access the `/mcp` endpoint, it may return `406 Not Acceptable`, which is normal—Streamable HTTP endpoints require protocol-compliant interaction flows; this return code also proves the HTTP service has started and is responding.
237
+
238
+ ### Pass CoinEx Credentials via HTTP Headers (HTTP Mode)
239
+ The server does not store third-party exchange credentials. For tools requiring authentication (balance/place order/cancel order/order history), include the following headers in HTTP requests (case-insensitive):
240
+ - `X-CoinEx-Access-Id: <your CoinEx Access ID>`
241
+ - `X-CoinEx-Secret-Key: <your CoinEx Secret Key>`
242
+
243
+ **Important Notes**
244
+ - **Never** enable credential pass-through functionality in publicly exposed services; ensure the entire server backend is controlled within an internal network! (Even with HTTPS transport, reverse proxies and other server nodes may offload request headers and log them)
245
+ - Deploy via HTTPS to prevent man-in-the-middle eavesdropping (use reverse proxy/Nginx/Caddy to add TLS to MCP endpoints).
246
+ - These headers are only needed when "HTTP authentication is enabled" and you're calling tools that require user credentials (auth tag).
247
+ - Enable with: `--enable-http-auth` or set environment variable `HTTP_AUTH_ENABLED=true`
248
+ - By default, HTTP authentication is disabled, exposing only query tools (public), which don't need or read the above headers.
249
+ - Only valid for HTTP/Streamable HTTP mode; STDIO mode reads credentials from environment variables (or .env config file).
250
+
251
+ ### Logging & Security
252
+ - Ensure reverse proxies/APM/logging systems don't record sensitive headers like `Authorization` or `X-CoinEx-*`.
253
+
254
+ ## Tools Overview
255
+
256
+ Note: In HTTP mode, only `public` type tools are exposed by default; `auth` type tools require enabling `--enable-http-auth` or setting `HTTP_AUTH_ENABLED=true` to be available.
257
+
258
+ ### Standard Parameter Conventions:
259
+ - `market_type`: Default `"spot"`, use `"futures"` for contracts.
260
+ - `symbol`: Supports `BTCUSDT` / `BTC/USDT` / `btc` / `BTC` (defaults to `USDT` if no quote currency).
261
+ - `interval` (depth aggregation levels): Default `"0"`.
262
+ - `period`: Default `"1hour"`, validated against spot/futures whitelists.
263
+ - `start_time`/`end_time`: Millisecond timestamps.
264
+
265
+ ### Market Data (public)
266
+ * `list_markets(market_type="spot"|"futures", symbols: str|list[str]|None)`
267
+ - Get market status; `symbols` can be comma-separated or array, returns all if not provided.
268
+ * `get_tickers(market_type="spot"|"futures", symbol: str|list[str]|None, top_n=5)`
269
+ - Get ticker snapshots; returns top `top_n` when `symbol` not provided.
270
+ * `get_orderbook(symbol, limit=20, market_type="spot"|"futures", interval="0")`
271
+ - Get order book (depth); supports futures.
272
+ * `get_kline(symbol, period="1hour", limit=100, market_type="spot"|"futures")`
273
+ - Get K-line data; periods validated against respective spot/futures whitelists.
274
+ * `get_recent_trades(symbol, market_type="spot"|"futures", limit=100)`
275
+ - Get recent trades (deals).
276
+ * `get_index_price(market_type="spot"|"futures", symbol: str|list[str]|None, top_n=5)`
277
+ - Get market index (spot/futures).
278
+
279
+ ### Futures-Specific (public)
280
+ * `get_funding_rate(symbol)`
281
+ - Get current funding rate.
282
+ * `get_funding_rate_history(symbol, start_time?, end_time?, page=1, limit=100)`
283
+ - Get funding rate history.
284
+ * `get_premium_index_history(symbol, start_time?, end_time?, page=1, limit=100)`
285
+ - Get premium index history.
286
+ * `get_basis_history(symbol, start_time?, end_time?, page=1, limit=100)`
287
+ - Get basis rate history.
288
+ * `get_position_tiers(symbol)`
289
+ - Get position tiers/margin tier information.
290
+ * `get_liquidation_history(symbol?, side?, start_time?, end_time?, page=1, limit=100)`
291
+ - Get liquidation history.
292
+
293
+ ### Account & Trading (auth)
294
+ * `get_account_balance()`
295
+ - Get account balance information.
296
+ * `place_order(symbol, side, type, amount, price?)`
297
+ - Place trading order.
298
+ * `cancel_order(symbol, order_id)`
299
+ - Cancel order.
300
+ * `get_order_history(symbol?, limit=100)`
301
+ - Get order history (open orders + completed orders).
302
+
303
+ ## Environment Variables
304
+
305
+ | Variable | Description | Required |
306
+ |----------|-------------|----------|
307
+ | `COINEX_ACCESS_ID` | CoinEx API Access ID | No (optional with HTTP pass-through) |
308
+ | `COINEX_SECRET_KEY` | CoinEx API Secret Key | No (optional with HTTP pass-through) |
309
+ | `API_TOKEN` | Bearer token to protect MCP endpoint | No |
310
+ | `API_SCOPES` | Required scopes for endpoint | No |
311
+ | `HTTP_AUTH_ENABLED` | Enable HTTP authentication (default false) | No |
312
+
313
+ ## Development
314
+
315
+ ### Project Structure
316
+
317
+ ```
318
+ coinex_mcp_server/
319
+ ├── main.py # MCP server main file
320
+ ├── coinex_client.py # CoinEx API client (unified spot/futures wrapper)
321
+ ├── doc/
322
+ │ ├── coinex_api/
323
+ │ │ └── coinex_api.md # CoinEx API documentation
324
+ ├── pyproject.toml # Project configuration
325
+ └── README.md # Project documentation
326
+ ```
327
+
328
+ ### Dependencies
329
+
330
+ - `fastmcp` - FastMCP framework (2.x)
331
+ - `httpx` - HTTP client
332
+ - `python-dotenv` - Environment variable loading
333
+
334
+ ## Troubleshooting
335
+ - If calls return `code != 0`, record the `message` and check parameters (`period`, `limit`, `symbol` normalization).
336
+ - In corporate network environments or with firewall restrictions, external APIs may be blocked; please verify network policies.
337
+
338
+ ## License
339
+
340
+ This project is open source under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license.
341
+
342
+ ## Contributing
343
+ Issues and Pull Requests are welcome!
344
+
345
+ ## Disclaimer
346
+ This tool is for educational and research purposes only. When using this tool for actual trading, please fully understand the risks and operate carefully. The developers are not responsible for any losses resulting from the use of this tool.