ghostserver 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.
Files changed (36) hide show
  1. ghostserver-0.1.0/.gitignore +10 -0
  2. ghostserver-0.1.0/CLAUDE.md +46 -0
  3. ghostserver-0.1.0/LICENSE +21 -0
  4. ghostserver-0.1.0/PKG-INFO +207 -0
  5. ghostserver-0.1.0/README.md +181 -0
  6. ghostserver-0.1.0/docs/superpowers/plans/2026-03-30-conduit-mcp-server.md +2324 -0
  7. ghostserver-0.1.0/ghostserver.toml.example +41 -0
  8. ghostserver-0.1.0/pyproject.toml +46 -0
  9. ghostserver-0.1.0/src/ghostserver/__init__.py +2 -0
  10. ghostserver-0.1.0/src/ghostserver/__main__.py +4 -0
  11. ghostserver-0.1.0/src/ghostserver/adapters/__init__.py +22 -0
  12. ghostserver-0.1.0/src/ghostserver/adapters/aws.py +111 -0
  13. ghostserver-0.1.0/src/ghostserver/adapters/cloudflare.py +121 -0
  14. ghostserver-0.1.0/src/ghostserver/adapters/gcal.py +178 -0
  15. ghostserver-0.1.0/src/ghostserver/adapters/github.py +142 -0
  16. ghostserver-0.1.0/src/ghostserver/adapters/gmail.py +187 -0
  17. ghostserver-0.1.0/src/ghostserver/boot.py +45 -0
  18. ghostserver-0.1.0/src/ghostserver/config.py +70 -0
  19. ghostserver-0.1.0/src/ghostserver/gate.py +40 -0
  20. ghostserver-0.1.0/src/ghostserver/google_auth.py +171 -0
  21. ghostserver-0.1.0/src/ghostserver/server.py +38 -0
  22. ghostserver-0.1.0/src/ghostserver/tokens.py +153 -0
  23. ghostserver-0.1.0/tests/__init__.py +0 -0
  24. ghostserver-0.1.0/tests/adapters/__init__.py +0 -0
  25. ghostserver-0.1.0/tests/adapters/conftest.py +36 -0
  26. ghostserver-0.1.0/tests/adapters/test_aws.py +224 -0
  27. ghostserver-0.1.0/tests/adapters/test_cloudflare.py +134 -0
  28. ghostserver-0.1.0/tests/adapters/test_gcal.py +244 -0
  29. ghostserver-0.1.0/tests/adapters/test_github.py +80 -0
  30. ghostserver-0.1.0/tests/adapters/test_gmail.py +190 -0
  31. ghostserver-0.1.0/tests/conftest.py +10 -0
  32. ghostserver-0.1.0/tests/test_boot.py +42 -0
  33. ghostserver-0.1.0/tests/test_config.py +54 -0
  34. ghostserver-0.1.0/tests/test_gate.py +61 -0
  35. ghostserver-0.1.0/tests/test_server.py +27 -0
  36. ghostserver-0.1.0/tests/test_tokens.py +256 -0
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .pytest_cache/
7
+ .venv/
8
+ *.egg
9
+ ghostserver.toml
10
+ .ghostserver/
@@ -0,0 +1,46 @@
1
+ # Ghostserver — Local MCP Server
2
+
3
+ Self-hosted MCP server connecting Claude Code to GitHub, Gmail, Google Calendar, Cloudflare, and AWS. All tokens stored locally via 1Password. No cloud proxy.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ pip install -e ".[dev]"
9
+ # One-time: set up Google OAuth
10
+ python -m ghostserver.google_auth
11
+ # Run server
12
+ python -m ghostserver
13
+ ```
14
+
15
+ ## Architecture
16
+
17
+ - **spine** manages frozen config registry + token store singleton
18
+ - **gate** enforces per-service: enabled check, token validity, time-windowed rate limits
19
+ - **fastmcp** handles MCP protocol; each adapter is a mounted sub-server
20
+ - **1Password CLI** (`op`) stores all tokens — nothing in env vars or .env files
21
+
22
+ ## Config
23
+
24
+ Edit `ghostserver.toml` to enable/disable services and set 1Password token references.
25
+
26
+ ## Tests
27
+
28
+ ```bash
29
+ pytest -v
30
+ ```
31
+
32
+ ## 21 Tools
33
+
34
+ **GitHub** (5): list_repos, create_issue, list_prs, get_pr, search_code
35
+ **Gmail** (4): search, read, send, labels
36
+ **Google Calendar** (4): list_events, create_event, free_busy, get_event
37
+ **Cloudflare** (4): list_zones, list_dns, create_dns, list_workers
38
+ **AWS** (4): list_buckets, list_objects, describe_instances, cloudwatch_metrics
39
+
40
+ ## Adding a new adapter
41
+
42
+ 1. Create `src/ghostserver/adapters/{name}.py`
43
+ 2. Define `SERVICE = "{name}"` and `server = FastMCP("{Name}")`
44
+ 3. Add `@server.tool` functions that call `check_gate(SERVICE)` first
45
+ 4. Add the service to `Config` in `config.py`
46
+ 5. Add to the import list in `adapters/__init__.py`
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adam Thomas / GhostLogic LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghostserver
3
+ Version: 0.1.0
4
+ Summary: Self-hosted MCP server connecting AI tools to GitHub, Gmail, Google Calendar, Cloudflare, and AWS
5
+ Project-URL: Homepage, https://github.com/adam-scott-thomas/ghostserver
6
+ Project-URL: Repository, https://github.com/adam-scott-thomas/ghostserver
7
+ Project-URL: Issues, https://github.com/adam-scott-thomas/ghostserver/issues
8
+ Author-email: Adam Thomas <adam@ghostlogic.dev>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,aws,cloudflare,github,gmail,mcp,model-context-protocol,tools
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Requires-Python: >=3.12
17
+ Requires-Dist: boto3>=1.35
18
+ Requires-Dist: fastmcp>=2.0
19
+ Requires-Dist: httpx>=0.27
20
+ Requires-Dist: maelspine>=0.1.1
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
23
+ Requires-Dist: pytest>=8.0; extra == 'dev'
24
+ Requires-Dist: respx>=0.22; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # GhostServer
28
+
29
+ Self-hosted MCP server that connects any AI tool to your real accounts. Your tokens never leave your machine.
30
+
31
+ Works with Claude Code, Cursor, VS Code Copilot, Windsurf, and any MCP-compatible client.
32
+
33
+ ## Why
34
+
35
+ Every "MCP server" out there is either a setup wizard pointing at someone else's cloud, or locked to one AI vendor. GhostServer runs locally, stores credentials in your own vault, and speaks standard MCP protocol so any client can use it.
36
+
37
+ ## 21 Tools, 5 Services
38
+
39
+ | Service | Tools |
40
+ |---------|-------|
41
+ | **GitHub** | list repos, create issues, list/get PRs, search code |
42
+ | **Gmail** | search, read, send, list labels |
43
+ | **Google Calendar** | list events, create events, free/busy, get event |
44
+ | **Cloudflare** | list zones, DNS records, create DNS, list Workers |
45
+ | **AWS** | S3 buckets/objects, EC2 instances, CloudWatch metrics |
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pip install ghostserver
51
+ ```
52
+
53
+ Or from source:
54
+
55
+ ```bash
56
+ git clone https://github.com/adam-scott-thomas/ghostserver.git
57
+ cd ghostserver
58
+ pip install -e ".[dev]"
59
+ ```
60
+
61
+ ## Quick Start
62
+
63
+ ### 1. Configure
64
+
65
+ ```bash
66
+ cp ghostserver.toml.example ghostserver.toml
67
+ ```
68
+
69
+ Edit `ghostserver.toml` — enable the services you want and set your credential references.
70
+
71
+ ### 2. Store Credentials
72
+
73
+ GhostServer supports three credential backends:
74
+
75
+ **Environment variables** (simplest):
76
+ ```toml
77
+ [server]
78
+ credential_backend = "env"
79
+
80
+ [github]
81
+ enabled = true
82
+ token_ref = "GITHUB_TOKEN"
83
+ ```
84
+ ```bash
85
+ export GITHUB_TOKEN="ghp_your_token_here"
86
+ ```
87
+
88
+ **Credentials file** (no env pollution):
89
+ ```toml
90
+ [server]
91
+ credential_backend = "file"
92
+ credential_file = "~/.ghostserver/credentials"
93
+
94
+ [github]
95
+ enabled = true
96
+ token_ref = "GITHUB_TOKEN"
97
+ ```
98
+ ```
99
+ # ~/.ghostserver/credentials
100
+ GITHUB_TOKEN=ghp_your_token_here
101
+ CLOUDFLARE_TOKEN=your_cf_token
102
+ ```
103
+
104
+ **1Password CLI** (most secure):
105
+ ```toml
106
+ [server]
107
+ credential_backend = "op"
108
+
109
+ [github]
110
+ enabled = true
111
+ token_ref = "op://Development/GitHub PAT/credential"
112
+ ```
113
+
114
+ **Auto-detect** (default): tries 1Password, then credentials file, then env vars.
115
+
116
+ ### 3. Google Services (one-time setup)
117
+
118
+ Gmail and Google Calendar require OAuth. Run the setup wizard once:
119
+
120
+ ```bash
121
+ python -m ghostserver.google_auth
122
+ ```
123
+
124
+ This opens your browser, gets consent, and stores the refresh token in your chosen backend.
125
+
126
+ ### 4. Connect to your AI tool
127
+
128
+ **Claude Code:**
129
+ ```bash
130
+ claude mcp add --transport stdio ghostserver -- python -m ghostserver
131
+ ```
132
+
133
+ **Cursor / VS Code:**
134
+ Add to your MCP settings:
135
+ ```json
136
+ {
137
+ "ghostserver": {
138
+ "command": "python",
139
+ "args": ["-m", "ghostserver"]
140
+ }
141
+ }
142
+ ```
143
+
144
+ **Any MCP client (stdio):**
145
+ ```bash
146
+ python -m ghostserver
147
+ ```
148
+
149
+ ## Architecture
150
+
151
+ ```
152
+ Your AI Tool (Claude Code, Cursor, etc.)
153
+ |
154
+ | MCP protocol (stdio)
155
+ |
156
+ v
157
+ GhostServer (local process)
158
+ |
159
+ |-- spine (frozen config registry)
160
+ |-- gate (per-service rate limiting + enabled checks)
161
+ |-- token store (pluggable: 1Password / env / file)
162
+ |
163
+ |-- GitHub adapter ──> api.github.com
164
+ |-- Gmail adapter ──> gmail.googleapis.com
165
+ |-- Calendar adapter ──> googleapis.com/calendar
166
+ |-- Cloudflare adapter ──> api.cloudflare.com
167
+ |-- AWS adapter ──> boto3 (local credentials)
168
+ ```
169
+
170
+ Every adapter is a single file. The gate enforces rate limits per service. Spine provides the frozen config singleton so adapters don't pass objects around.
171
+
172
+ ## Adding Your Own Adapter
173
+
174
+ Create `src/ghostserver/adapters/myservice.py`:
175
+
176
+ ```python
177
+ from fastmcp import FastMCP
178
+ from spine import Core
179
+ from ghostserver.gate import check_gate
180
+
181
+ SERVICE = "myservice"
182
+ server = FastMCP("My Service")
183
+
184
+ @server.tool
185
+ async def myservice_do_thing(param: str) -> dict:
186
+ """Description for the AI client."""
187
+ check_gate(SERVICE)
188
+ tokens = Core.instance().get("tokens")
189
+ token = tokens.get(Core.instance().get("config").myservice.token_ref)
190
+ # ... call your API ...
191
+ return {"result": "done"}
192
+ ```
193
+
194
+ Add the service config to `config.py`, add the module name to `adapters/__init__.py`, done. Submit a PR.
195
+
196
+ ## Development
197
+
198
+ ```bash
199
+ git clone https://github.com/adam-scott-thomas/ghostserver.git
200
+ cd ghostserver
201
+ pip install -e ".[dev]"
202
+ pytest -v
203
+ ```
204
+
205
+ ## License
206
+
207
+ MIT
@@ -0,0 +1,181 @@
1
+ # GhostServer
2
+
3
+ Self-hosted MCP server that connects any AI tool to your real accounts. Your tokens never leave your machine.
4
+
5
+ Works with Claude Code, Cursor, VS Code Copilot, Windsurf, and any MCP-compatible client.
6
+
7
+ ## Why
8
+
9
+ Every "MCP server" out there is either a setup wizard pointing at someone else's cloud, or locked to one AI vendor. GhostServer runs locally, stores credentials in your own vault, and speaks standard MCP protocol so any client can use it.
10
+
11
+ ## 21 Tools, 5 Services
12
+
13
+ | Service | Tools |
14
+ |---------|-------|
15
+ | **GitHub** | list repos, create issues, list/get PRs, search code |
16
+ | **Gmail** | search, read, send, list labels |
17
+ | **Google Calendar** | list events, create events, free/busy, get event |
18
+ | **Cloudflare** | list zones, DNS records, create DNS, list Workers |
19
+ | **AWS** | S3 buckets/objects, EC2 instances, CloudWatch metrics |
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install ghostserver
25
+ ```
26
+
27
+ Or from source:
28
+
29
+ ```bash
30
+ git clone https://github.com/adam-scott-thomas/ghostserver.git
31
+ cd ghostserver
32
+ pip install -e ".[dev]"
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ### 1. Configure
38
+
39
+ ```bash
40
+ cp ghostserver.toml.example ghostserver.toml
41
+ ```
42
+
43
+ Edit `ghostserver.toml` — enable the services you want and set your credential references.
44
+
45
+ ### 2. Store Credentials
46
+
47
+ GhostServer supports three credential backends:
48
+
49
+ **Environment variables** (simplest):
50
+ ```toml
51
+ [server]
52
+ credential_backend = "env"
53
+
54
+ [github]
55
+ enabled = true
56
+ token_ref = "GITHUB_TOKEN"
57
+ ```
58
+ ```bash
59
+ export GITHUB_TOKEN="ghp_your_token_here"
60
+ ```
61
+
62
+ **Credentials file** (no env pollution):
63
+ ```toml
64
+ [server]
65
+ credential_backend = "file"
66
+ credential_file = "~/.ghostserver/credentials"
67
+
68
+ [github]
69
+ enabled = true
70
+ token_ref = "GITHUB_TOKEN"
71
+ ```
72
+ ```
73
+ # ~/.ghostserver/credentials
74
+ GITHUB_TOKEN=ghp_your_token_here
75
+ CLOUDFLARE_TOKEN=your_cf_token
76
+ ```
77
+
78
+ **1Password CLI** (most secure):
79
+ ```toml
80
+ [server]
81
+ credential_backend = "op"
82
+
83
+ [github]
84
+ enabled = true
85
+ token_ref = "op://Development/GitHub PAT/credential"
86
+ ```
87
+
88
+ **Auto-detect** (default): tries 1Password, then credentials file, then env vars.
89
+
90
+ ### 3. Google Services (one-time setup)
91
+
92
+ Gmail and Google Calendar require OAuth. Run the setup wizard once:
93
+
94
+ ```bash
95
+ python -m ghostserver.google_auth
96
+ ```
97
+
98
+ This opens your browser, gets consent, and stores the refresh token in your chosen backend.
99
+
100
+ ### 4. Connect to your AI tool
101
+
102
+ **Claude Code:**
103
+ ```bash
104
+ claude mcp add --transport stdio ghostserver -- python -m ghostserver
105
+ ```
106
+
107
+ **Cursor / VS Code:**
108
+ Add to your MCP settings:
109
+ ```json
110
+ {
111
+ "ghostserver": {
112
+ "command": "python",
113
+ "args": ["-m", "ghostserver"]
114
+ }
115
+ }
116
+ ```
117
+
118
+ **Any MCP client (stdio):**
119
+ ```bash
120
+ python -m ghostserver
121
+ ```
122
+
123
+ ## Architecture
124
+
125
+ ```
126
+ Your AI Tool (Claude Code, Cursor, etc.)
127
+ |
128
+ | MCP protocol (stdio)
129
+ |
130
+ v
131
+ GhostServer (local process)
132
+ |
133
+ |-- spine (frozen config registry)
134
+ |-- gate (per-service rate limiting + enabled checks)
135
+ |-- token store (pluggable: 1Password / env / file)
136
+ |
137
+ |-- GitHub adapter ──> api.github.com
138
+ |-- Gmail adapter ──> gmail.googleapis.com
139
+ |-- Calendar adapter ──> googleapis.com/calendar
140
+ |-- Cloudflare adapter ──> api.cloudflare.com
141
+ |-- AWS adapter ──> boto3 (local credentials)
142
+ ```
143
+
144
+ Every adapter is a single file. The gate enforces rate limits per service. Spine provides the frozen config singleton so adapters don't pass objects around.
145
+
146
+ ## Adding Your Own Adapter
147
+
148
+ Create `src/ghostserver/adapters/myservice.py`:
149
+
150
+ ```python
151
+ from fastmcp import FastMCP
152
+ from spine import Core
153
+ from ghostserver.gate import check_gate
154
+
155
+ SERVICE = "myservice"
156
+ server = FastMCP("My Service")
157
+
158
+ @server.tool
159
+ async def myservice_do_thing(param: str) -> dict:
160
+ """Description for the AI client."""
161
+ check_gate(SERVICE)
162
+ tokens = Core.instance().get("tokens")
163
+ token = tokens.get(Core.instance().get("config").myservice.token_ref)
164
+ # ... call your API ...
165
+ return {"result": "done"}
166
+ ```
167
+
168
+ Add the service config to `config.py`, add the module name to `adapters/__init__.py`, done. Submit a PR.
169
+
170
+ ## Development
171
+
172
+ ```bash
173
+ git clone https://github.com/adam-scott-thomas/ghostserver.git
174
+ cd ghostserver
175
+ pip install -e ".[dev]"
176
+ pytest -v
177
+ ```
178
+
179
+ ## License
180
+
181
+ MIT