publicdotcom-mcp-server 0.1.0__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.
- publicdotcom_mcp_server-0.1.0/.claude/settings.local.json +18 -0
- publicdotcom_mcp_server-0.1.0/.gitignore +33 -0
- publicdotcom_mcp_server-0.1.0/LICENSE +190 -0
- publicdotcom_mcp_server-0.1.0/PKG-INFO +191 -0
- publicdotcom_mcp_server-0.1.0/README.md +161 -0
- publicdotcom_mcp_server-0.1.0/pyproject.toml +61 -0
- publicdotcom_mcp_server-0.1.0/server.json +29 -0
- publicdotcom_mcp_server-0.1.0/src/publicdotcom_mcp_server/__init__.py +5 -0
- publicdotcom_mcp_server-0.1.0/src/publicdotcom_mcp_server/__main__.py +5 -0
- publicdotcom_mcp_server-0.1.0/src/publicdotcom_mcp_server/server.py +1202 -0
- publicdotcom_mcp_server-0.1.0/tests/__init__.py +0 -0
- publicdotcom_mcp_server-0.1.0/tests/conftest.py +25 -0
- publicdotcom_mcp_server-0.1.0/tests/test_helpers.py +206 -0
- publicdotcom_mcp_server-0.1.0/tests/test_read_tools.py +299 -0
- publicdotcom_mcp_server-0.1.0/tests/test_validation.py +84 -0
- publicdotcom_mcp_server-0.1.0/tests/test_write_tools.py +294 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(pip install -e \".[dev]\" -q)",
|
|
5
|
+
"Bash(python -c \"from publicdotcom_mcp_server.server import mcp; print\\(''import OK''\\)\")",
|
|
6
|
+
"Bash(pytest --tb=short)",
|
|
7
|
+
"Bash(python -c \":*)",
|
|
8
|
+
"Bash(python -c \"from publicdotcom_mcp_server.server import mcp; print\\(f''Server loaded — {len\\(mcp._tool_manager._tools\\)} tools registered''\\)\")",
|
|
9
|
+
"Bash(python3 -c \"from public_api_sdk.models import Account; import inspect; print\\([f for f in Account.model_fields]\\)\")",
|
|
10
|
+
"Bash(python3 -c \"from public_api_sdk.models import Account; print\\(Account.__fields__\\)\")",
|
|
11
|
+
"Bash(pip show:*)",
|
|
12
|
+
"Bash(python3 -c \"from public_api_sdk.models import Portfolio; print\\(list\\(Portfolio.model_fields\\)\\)\")",
|
|
13
|
+
"Bash(wc -l /Users/tarric.sookdeo/Projects/publicdotcom-mcp-server/tests/test_*.py)",
|
|
14
|
+
"Bash(python -m pytest tests/ -v)",
|
|
15
|
+
"WebSearch"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg
|
|
10
|
+
|
|
11
|
+
# Virtual environments
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
ENV/
|
|
15
|
+
|
|
16
|
+
# IDE
|
|
17
|
+
.vscode/
|
|
18
|
+
.idea/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
|
|
22
|
+
# OS
|
|
23
|
+
.DS_Store
|
|
24
|
+
Thumbs.db
|
|
25
|
+
|
|
26
|
+
# Environment
|
|
27
|
+
.env
|
|
28
|
+
.env.local
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
htmlcov/
|
|
33
|
+
.coverage
|
|
@@ -0,0 +1,190 @@
|
|
|
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 the 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 the 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 any 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
|
+
Copyright 2025 Public Holdings, Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: publicdotcom-mcp-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for the Public.com Trading API
|
|
5
|
+
Project-URL: Homepage, https://github.com/publicdotcom/publicdotcom-mcp-server
|
|
6
|
+
Project-URL: Repository, https://github.com/publicdotcom/publicdotcom-mcp-server
|
|
7
|
+
Project-URL: Issues, https://github.com/publicdotcom/publicdotcom-mcp-server/issues
|
|
8
|
+
Project-URL: Public.com API, https://public.com/api
|
|
9
|
+
Author-email: "Public.com" <developers@public.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: brokerage,crypto,mcp,options,public.com,stocks,trading
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Requires-Dist: publicdotcom-py~=0.1.10
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-mock>=3.14; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Public.com MCP Server
|
|
32
|
+
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
[](https://python.org)
|
|
35
|
+
[](https://modelcontextprotocol.io)
|
|
36
|
+
|
|
37
|
+
An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI assistants to your [Public.com](https://public.com) brokerage account. Trade stocks, options, and crypto — get quotes, manage orders, and view your portfolio — all through natural language.
|
|
38
|
+
|
|
39
|
+
> **Disclaimer:** For illustrative and informational purposes only. Not investment advice or recommendations. Use at your own risk.
|
|
40
|
+
|
|
41
|
+
## Tools
|
|
42
|
+
|
|
43
|
+
### Read-Only
|
|
44
|
+
|
|
45
|
+
| Tool | Description |
|
|
46
|
+
|------|-------------|
|
|
47
|
+
| `check_setup` | Verify API credentials and connectivity |
|
|
48
|
+
| `get_accounts` | List all brokerage accounts |
|
|
49
|
+
| `get_portfolio` | View positions, equity, buying power, open orders |
|
|
50
|
+
| `get_orders` | List active/open orders |
|
|
51
|
+
| `get_order` | Get status of a specific order |
|
|
52
|
+
| `get_history` | Transaction history (trades, deposits, dividends, etc.) |
|
|
53
|
+
| `get_quotes` | Real-time quotes for stocks, crypto, options |
|
|
54
|
+
| `get_instrument` | Details about a specific tradeable instrument |
|
|
55
|
+
| `get_all_instruments` | List all available instruments with filters |
|
|
56
|
+
| `get_option_expirations` | Available expiration dates for options |
|
|
57
|
+
| `get_option_chain` | Full option chain (calls + puts) for a symbol |
|
|
58
|
+
| `get_option_greeks` | Greeks (delta, gamma, theta, vega, rho, IV) |
|
|
59
|
+
| `preflight_order` | Estimate costs/impact before placing a single-leg order |
|
|
60
|
+
| `preflight_multileg_order` | Estimate costs for multi-leg options strategies |
|
|
61
|
+
|
|
62
|
+
### Write (Destructive)
|
|
63
|
+
|
|
64
|
+
| Tool | Description |
|
|
65
|
+
|------|-------------|
|
|
66
|
+
| `place_order` | Place a single-leg order (stocks, crypto, options) |
|
|
67
|
+
| `place_multileg_order` | Place multi-leg orders (spreads, straddles, etc.) |
|
|
68
|
+
| `cancel_order` | Cancel an existing order |
|
|
69
|
+
| `cancel_and_replace_order` | Atomically cancel and replace an order |
|
|
70
|
+
|
|
71
|
+
## Prerequisites
|
|
72
|
+
|
|
73
|
+
- **Python 3.10+**
|
|
74
|
+
- **Public.com account** — [Sign up](https://public.com/signup)
|
|
75
|
+
- **Public.com API key** — [Get one here](https://public.com/settings/v2/api)
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install publicdotcom-mcp-server
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or install from source:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
git clone https://github.com/publicdotcom/publicdotcom-mcp-server.git
|
|
87
|
+
cd publicdotcom-mcp-server
|
|
88
|
+
pip install .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
Set your API credentials as environment variables:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Required
|
|
97
|
+
export PUBLIC_COM_SECRET=your_api_secret_key
|
|
98
|
+
|
|
99
|
+
# Optional — sets a default account so you don't need to specify it each time
|
|
100
|
+
export PUBLIC_COM_ACCOUNT_ID=your_account_id
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Usage
|
|
104
|
+
|
|
105
|
+
### Claude Desktop
|
|
106
|
+
|
|
107
|
+
Add this to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"public-com": {
|
|
113
|
+
"command": "publicdotcom-mcp-server",
|
|
114
|
+
"env": {
|
|
115
|
+
"PUBLIC_COM_SECRET": "your_api_secret_key",
|
|
116
|
+
"PUBLIC_COM_ACCOUNT_ID": "your_account_id"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Claude Desktop (using uvx)
|
|
124
|
+
|
|
125
|
+
If you prefer using `uvx` (no pre-install needed):
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"mcpServers": {
|
|
130
|
+
"public-com": {
|
|
131
|
+
"command": "uvx",
|
|
132
|
+
"args": ["publicdotcom-mcp-server"],
|
|
133
|
+
"env": {
|
|
134
|
+
"PUBLIC_COM_SECRET": "your_api_secret_key",
|
|
135
|
+
"PUBLIC_COM_ACCOUNT_ID": "your_account_id"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Running Directly
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# stdio transport (default — for Claude Desktop, Claude Code, etc.)
|
|
146
|
+
publicdotcom-mcp-server
|
|
147
|
+
|
|
148
|
+
# Or run as a Python module
|
|
149
|
+
python -m publicdotcom_mcp_server
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Testing with MCP Inspector
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npx @modelcontextprotocol/inspector publicdotcom-mcp-server
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Clone and install in development mode
|
|
162
|
+
git clone https://github.com/publicdotcom/publicdotcom-mcp-server.git
|
|
163
|
+
cd publicdotcom-mcp-server
|
|
164
|
+
pip install -e ".[dev]"
|
|
165
|
+
|
|
166
|
+
# Run tests
|
|
167
|
+
pytest
|
|
168
|
+
|
|
169
|
+
# Run the server locally
|
|
170
|
+
python -m publicdotcom_mcp_server
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## How It Works
|
|
174
|
+
|
|
175
|
+
This server wraps the [`publicdotcom-py`](https://pypi.org/project/publicdotcom-py/) Python SDK, exposing each API operation as an MCP tool. The MCP protocol allows AI clients to discover and call these tools through a standardized interface.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
AI Client (Claude, etc.)
|
|
179
|
+
↕ MCP Protocol (stdio)
|
|
180
|
+
Public.com MCP Server
|
|
181
|
+
↕ HTTPS
|
|
182
|
+
Public.com Trading API
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
All tools include proper [MCP tool annotations](https://modelcontextprotocol.io/docs/concepts/tools#tool-annotations):
|
|
186
|
+
- Read-only tools are marked with `readOnlyHint: true`
|
|
187
|
+
- Write tools are marked with `destructiveHint: true`
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
[Apache 2.0](LICENSE)
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Public.com MCP Server
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://python.org)
|
|
5
|
+
[](https://modelcontextprotocol.io)
|
|
6
|
+
|
|
7
|
+
An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI assistants to your [Public.com](https://public.com) brokerage account. Trade stocks, options, and crypto — get quotes, manage orders, and view your portfolio — all through natural language.
|
|
8
|
+
|
|
9
|
+
> **Disclaimer:** For illustrative and informational purposes only. Not investment advice or recommendations. Use at your own risk.
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
|
|
13
|
+
### Read-Only
|
|
14
|
+
|
|
15
|
+
| Tool | Description |
|
|
16
|
+
|------|-------------|
|
|
17
|
+
| `check_setup` | Verify API credentials and connectivity |
|
|
18
|
+
| `get_accounts` | List all brokerage accounts |
|
|
19
|
+
| `get_portfolio` | View positions, equity, buying power, open orders |
|
|
20
|
+
| `get_orders` | List active/open orders |
|
|
21
|
+
| `get_order` | Get status of a specific order |
|
|
22
|
+
| `get_history` | Transaction history (trades, deposits, dividends, etc.) |
|
|
23
|
+
| `get_quotes` | Real-time quotes for stocks, crypto, options |
|
|
24
|
+
| `get_instrument` | Details about a specific tradeable instrument |
|
|
25
|
+
| `get_all_instruments` | List all available instruments with filters |
|
|
26
|
+
| `get_option_expirations` | Available expiration dates for options |
|
|
27
|
+
| `get_option_chain` | Full option chain (calls + puts) for a symbol |
|
|
28
|
+
| `get_option_greeks` | Greeks (delta, gamma, theta, vega, rho, IV) |
|
|
29
|
+
| `preflight_order` | Estimate costs/impact before placing a single-leg order |
|
|
30
|
+
| `preflight_multileg_order` | Estimate costs for multi-leg options strategies |
|
|
31
|
+
|
|
32
|
+
### Write (Destructive)
|
|
33
|
+
|
|
34
|
+
| Tool | Description |
|
|
35
|
+
|------|-------------|
|
|
36
|
+
| `place_order` | Place a single-leg order (stocks, crypto, options) |
|
|
37
|
+
| `place_multileg_order` | Place multi-leg orders (spreads, straddles, etc.) |
|
|
38
|
+
| `cancel_order` | Cancel an existing order |
|
|
39
|
+
| `cancel_and_replace_order` | Atomically cancel and replace an order |
|
|
40
|
+
|
|
41
|
+
## Prerequisites
|
|
42
|
+
|
|
43
|
+
- **Python 3.10+**
|
|
44
|
+
- **Public.com account** — [Sign up](https://public.com/signup)
|
|
45
|
+
- **Public.com API key** — [Get one here](https://public.com/settings/v2/api)
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install publicdotcom-mcp-server
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or install from source:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git clone https://github.com/publicdotcom/publicdotcom-mcp-server.git
|
|
57
|
+
cd publicdotcom-mcp-server
|
|
58
|
+
pip install .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
Set your API credentials as environment variables:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Required
|
|
67
|
+
export PUBLIC_COM_SECRET=your_api_secret_key
|
|
68
|
+
|
|
69
|
+
# Optional — sets a default account so you don't need to specify it each time
|
|
70
|
+
export PUBLIC_COM_ACCOUNT_ID=your_account_id
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
### Claude Desktop
|
|
76
|
+
|
|
77
|
+
Add this to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"public-com": {
|
|
83
|
+
"command": "publicdotcom-mcp-server",
|
|
84
|
+
"env": {
|
|
85
|
+
"PUBLIC_COM_SECRET": "your_api_secret_key",
|
|
86
|
+
"PUBLIC_COM_ACCOUNT_ID": "your_account_id"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Claude Desktop (using uvx)
|
|
94
|
+
|
|
95
|
+
If you prefer using `uvx` (no pre-install needed):
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServers": {
|
|
100
|
+
"public-com": {
|
|
101
|
+
"command": "uvx",
|
|
102
|
+
"args": ["publicdotcom-mcp-server"],
|
|
103
|
+
"env": {
|
|
104
|
+
"PUBLIC_COM_SECRET": "your_api_secret_key",
|
|
105
|
+
"PUBLIC_COM_ACCOUNT_ID": "your_account_id"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Running Directly
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# stdio transport (default — for Claude Desktop, Claude Code, etc.)
|
|
116
|
+
publicdotcom-mcp-server
|
|
117
|
+
|
|
118
|
+
# Or run as a Python module
|
|
119
|
+
python -m publicdotcom_mcp_server
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Testing with MCP Inspector
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npx @modelcontextprotocol/inspector publicdotcom-mcp-server
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Clone and install in development mode
|
|
132
|
+
git clone https://github.com/publicdotcom/publicdotcom-mcp-server.git
|
|
133
|
+
cd publicdotcom-mcp-server
|
|
134
|
+
pip install -e ".[dev]"
|
|
135
|
+
|
|
136
|
+
# Run tests
|
|
137
|
+
pytest
|
|
138
|
+
|
|
139
|
+
# Run the server locally
|
|
140
|
+
python -m publicdotcom_mcp_server
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## How It Works
|
|
144
|
+
|
|
145
|
+
This server wraps the [`publicdotcom-py`](https://pypi.org/project/publicdotcom-py/) Python SDK, exposing each API operation as an MCP tool. The MCP protocol allows AI clients to discover and call these tools through a standardized interface.
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
AI Client (Claude, etc.)
|
|
149
|
+
↕ MCP Protocol (stdio)
|
|
150
|
+
Public.com MCP Server
|
|
151
|
+
↕ HTTPS
|
|
152
|
+
Public.com Trading API
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
All tools include proper [MCP tool annotations](https://modelcontextprotocol.io/docs/concepts/tools#tool-annotations):
|
|
156
|
+
- Read-only tools are marked with `readOnlyHint: true`
|
|
157
|
+
- Write tools are marked with `destructiveHint: true`
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
[Apache 2.0](LICENSE)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "publicdotcom-mcp-server"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for the Public.com Trading API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Public.com", email = "developers@public.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mcp", "public.com", "trading", "brokerage", "stocks", "options", "crypto"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: Apache Software License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Office/Business :: Financial :: Investment",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"mcp>=1.0.0",
|
|
29
|
+
"publicdotcom-py~=0.1.10",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=8.0",
|
|
35
|
+
"pytest-asyncio>=0.24",
|
|
36
|
+
"pytest-mock>=3.14",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
publicdotcom-mcp-server = "publicdotcom_mcp_server.server:main"
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/publicdotcom/publicdotcom-mcp-server"
|
|
44
|
+
Repository = "https://github.com/publicdotcom/publicdotcom-mcp-server"
|
|
45
|
+
Issues = "https://github.com/publicdotcom/publicdotcom-mcp-server/issues"
|
|
46
|
+
"Public.com API" = "https://public.com/api"
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/publicdotcom_mcp_server"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
asyncio_mode = "auto"
|
|
53
|
+
testpaths = ["tests"]
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
line-length = 100
|
|
57
|
+
target-version = "py310"
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
61
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
|
|
3
|
+
"name": "io.github.publicdotcom/publicdotcom-mcp-server",
|
|
4
|
+
"title": "Public.com Trading API",
|
|
5
|
+
"description": "Connect AI assistants to your Public.com brokerage account. Trade stocks, options, and crypto — get quotes, manage orders, and view your portfolio.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"packages": [
|
|
8
|
+
{
|
|
9
|
+
"registryType": "pip",
|
|
10
|
+
"identifier": "publicdotcom-mcp-server",
|
|
11
|
+
"version": "0.1.0",
|
|
12
|
+
"transport": {
|
|
13
|
+
"type": "stdio"
|
|
14
|
+
},
|
|
15
|
+
"environment_variables": [
|
|
16
|
+
{
|
|
17
|
+
"name": "PUBLIC_COM_SECRET",
|
|
18
|
+
"description": "Your Public.com API secret key. Get one at https://public.com/settings/v2/api",
|
|
19
|
+
"required": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "PUBLIC_COM_ACCOUNT_ID",
|
|
23
|
+
"description": "Default account ID. Optional — if not set, the server will prompt for it.",
|
|
24
|
+
"required": false
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|