@topgunbuild/mcp-server 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,97 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: TopGun Contributors
6
+ Licensed Work: TopGun
7
+ The Licensed Work is (c) 2024 TopGun Contributors.
8
+ Additional Use Grant: You may make production use of the Licensed Work,
9
+ provided Your use does not include offering the
10
+ Licensed Work to third parties as a commercial
11
+ managed database service, database-as-a-service,
12
+ or similar hosted database offering that competes
13
+ with TopGun products or services.
14
+
15
+ For purposes of this license:
16
+ - "Managed database service" means a service that
17
+ allows third parties to create, manage, or operate
18
+ databases using TopGun as the underlying technology.
19
+ - Internal use within your organization is permitted.
20
+ - Using TopGun as part of your application's backend
21
+ (not exposed as a database service) is permitted.
22
+ - Consulting and professional services around TopGun
23
+ are permitted.
24
+
25
+ Change Date: Four years from the date of each version release
26
+ Change License: Apache License, Version 2.0
27
+
28
+ For information about alternative licensing arrangements for the Licensed Work,
29
+ please contact the Licensor.
30
+
31
+ Notice
32
+
33
+ Business Source License 1.1
34
+
35
+ Terms
36
+
37
+ The Licensor hereby grants you the right to copy, modify, create derivative
38
+ works, redistribute, and make non-production use of the Licensed Work. The
39
+ Licensor may make an Additional Use Grant, above, permitting limited production use.
40
+
41
+ Effective on the Change Date, or the fourth anniversary of the first publicly
42
+ available distribution of a specific version of the Licensed Work under this
43
+ License, whichever comes first, the Licensor hereby grants you rights under
44
+ the terms of the Change License, and the rights granted in the paragraph
45
+ above terminate.
46
+
47
+ If your use of the Licensed Work does not comply with the requirements
48
+ currently in effect as described in this License, you must purchase a
49
+ commercial license from the Licensor, its affiliated entities, or authorized
50
+ resellers, or you must refrain from using the Licensed Work.
51
+
52
+ All copies of the original and modified Licensed Work, and derivative works
53
+ of the Licensed Work, are subject to this License. This License applies
54
+ separately for each version of the Licensed Work and the Change Date may vary
55
+ for each version of the Licensed Work released by Licensor.
56
+
57
+ You must conspicuously display this License on each original or modified copy
58
+ of the Licensed Work. If you receive the Licensed Work in original or
59
+ modified form from a third party, the terms and conditions set forth in this
60
+ License apply to your use of that work.
61
+
62
+ Any use of the Licensed Work in violation of this License will automatically
63
+ terminate your rights under this License for the current and all other
64
+ versions of the Licensed Work.
65
+
66
+ This License does not grant you any right in any trademark or logo of
67
+ Licensor or its affiliates (provided that you may use a trademark or logo of
68
+ Licensor as expressly required by this License).
69
+
70
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
71
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
72
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
73
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
74
+ TITLE.
75
+
76
+ MariaDB hereby grants you permission to use this License's text to license
77
+ your works, and to refer to it using the trademark "Business Source License",
78
+ as long as you comply with the Covenants of Licensor below.
79
+
80
+ Covenants of Licensor
81
+
82
+ In consideration of the right to use this License's text and the "Business
83
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
84
+ other recipients of the licensed work to be provided by Licensor:
85
+
86
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
87
+ or a license that is compatible with GPL Version 2.0 or a later version,
88
+ where "compatible" means that software provided under the Change License can
89
+ be included in a program with software provided under GPL Version 2.0 or a
90
+ later version. Licensor may specify additional Change Licenses without
91
+ limitation.
92
+
93
+ 2. To either: (a) specify an Additional Use Grant (above) that does not impose
94
+ any additional restriction on the right granted in this License, as the
95
+ Additional Use Grant; or (b) insert the text "None" to specify a Change Date.
96
+
97
+ 3. Not to modify this License in any other way.
package/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # @topgunbuild/mcp-server
2
+
3
+ MCP (Model Context Protocol) Server for TopGun - enables AI assistants like Claude Desktop and Cursor to interact with TopGun databases through natural language.
4
+
5
+ ## What is MCP?
6
+
7
+ MCP (Model Context Protocol) is Anthropic's open protocol for connecting AI assistants to external data sources. It allows AI tools to query, modify, and search your TopGun database using natural language.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @topgunbuild/mcp-server
13
+ # or
14
+ pnpm add @topgunbuild/mcp-server
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ### Claude Desktop
20
+
21
+ 1. Install the MCP server globally:
22
+ ```bash
23
+ npm install -g @topgunbuild/mcp-server
24
+ ```
25
+
26
+ 2. Configure Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "topgun": {
31
+ "command": "npx",
32
+ "args": ["@topgunbuild/mcp-server"],
33
+ "env": {
34
+ "TOPGUN_URL": "ws://localhost:8080"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ 3. Restart Claude Desktop
42
+
43
+ 4. Try: "Show me all tasks in my TopGun database"
44
+
45
+ ### Cursor
46
+
47
+ Add to `.cursor/config.json` in your workspace:
48
+
49
+ ```json
50
+ {
51
+ "mcp": {
52
+ "servers": {
53
+ "topgun": {
54
+ "command": "npx",
55
+ "args": ["@topgunbuild/mcp-server"],
56
+ "env": {
57
+ "TOPGUN_URL": "ws://localhost:8080"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### Programmatic Usage
66
+
67
+ ```typescript
68
+ import { TopGunMCPServer } from '@topgunbuild/mcp-server';
69
+
70
+ const server = new TopGunMCPServer({
71
+ topgunUrl: 'ws://localhost:8080',
72
+ allowedMaps: ['tasks', 'users'],
73
+ enableMutations: true,
74
+ debug: true,
75
+ });
76
+
77
+ await server.start();
78
+ ```
79
+
80
+ ## CLI Options
81
+
82
+ ```bash
83
+ topgun-mcp [options]
84
+
85
+ Options:
86
+ --url, -u <url> TopGun server URL (default: ws://localhost:8080)
87
+ --token, -t <token> Authentication token
88
+ --maps, -m <maps> Comma-separated list of allowed maps
89
+ --no-mutations Disable mutation operations
90
+ --no-subscriptions Disable subscription operations
91
+ --http Start HTTP transport instead of stdio
92
+ --port, -p <port> HTTP port (default: 3000)
93
+ --debug, -d Enable debug logging
94
+ --help, -h Show help
95
+ --version, -v Show version
96
+ ```
97
+
98
+ ## Available Tools
99
+
100
+ ### topgun_list_maps
101
+ List all available maps.
102
+
103
+ ### topgun_query
104
+ Query data from a map with filters and sorting.
105
+
106
+ ```
107
+ Example: "Show me all tasks with status 'done'"
108
+ ```
109
+
110
+ ### topgun_mutate
111
+ Create, update, or delete data.
112
+
113
+ ```
114
+ Example: "Create a task called 'Review PR #123'"
115
+ ```
116
+
117
+ ### topgun_search
118
+ Perform hybrid search (BM25 full-text + exact matching).
119
+
120
+ ```
121
+ Example: "Find tasks about authentication"
122
+ ```
123
+
124
+ ### topgun_subscribe
125
+ Watch a map for real-time changes.
126
+
127
+ ```
128
+ Example: "Watch for new high-priority tasks"
129
+ ```
130
+
131
+ ### topgun_schema
132
+ Get schema information about a map.
133
+
134
+ ```
135
+ Example: "What fields does the tasks map have?"
136
+ ```
137
+
138
+ ### topgun_stats
139
+ Get statistics about TopGun connection and maps.
140
+
141
+ ```
142
+ Example: "What's the status of my TopGun connection?"
143
+ ```
144
+
145
+ ### topgun_explain
146
+ Explain how a query would be executed.
147
+
148
+ ```
149
+ Example: "Explain query on tasks where status='done'"
150
+ ```
151
+
152
+ ## Configuration Options
153
+
154
+ | Option | Type | Default | Description |
155
+ |--------|------|---------|-------------|
156
+ | `topgunUrl` | string | `ws://localhost:8080` | TopGun server WebSocket URL |
157
+ | `authToken` | string | - | Authentication token |
158
+ | `allowedMaps` | string[] | - | Restrict to specific maps (all by default) |
159
+ | `enableMutations` | boolean | `true` | Allow write operations |
160
+ | `enableSubscriptions` | boolean | `true` | Allow subscriptions |
161
+ | `defaultLimit` | number | `10` | Default query result limit |
162
+ | `maxLimit` | number | `100` | Maximum query result limit |
163
+ | `subscriptionTimeoutSeconds` | number | `60` | Subscription timeout |
164
+ | `debug` | boolean | `false` | Enable debug logging |
165
+
166
+ ## HTTP Transport
167
+
168
+ For web-based MCP clients, you can start the server with HTTP transport:
169
+
170
+ ```bash
171
+ topgun-mcp --http --port 3000
172
+ ```
173
+
174
+ Endpoints:
175
+ - `GET /health` - Health check
176
+ - `GET /mcp` - Server info
177
+ - `GET /mcp/events` - SSE connection
178
+ - `POST /mcp` - Stateless tool calls
179
+
180
+ ## Environment Variables
181
+
182
+ | Variable | Description |
183
+ |----------|-------------|
184
+ | `TOPGUN_URL` | TopGun server URL |
185
+ | `TOPGUN_TOKEN` | Authentication token |
186
+ | `TOPGUN_MAPS` | Comma-separated allowed maps |
187
+ | `TOPGUN_MCP_PORT` | HTTP port (with --http) |
188
+ | `TOPGUN_DEBUG` | Enable debug (true/false) |
189
+
190
+ ## Security
191
+
192
+ - Use `allowedMaps` to restrict access to specific maps
193
+ - Use `enableMutations: false` for read-only access
194
+ - Use authentication tokens in production
195
+ - The MCP server runs locally - data never leaves your machine
196
+
197
+ ## License
198
+
199
+ BSL-1.1