neuron-mcp-server 1.0.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 +21 -0
- package/README.md +178 -0
- package/dist/client.d.ts +34 -0
- package/dist/client.js +104 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +190 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/ai.d.ts +2 -0
- package/dist/tools/ai.js +25 -0
- package/dist/tools/ai.js.map +1 -0
- package/dist/tools/audit.d.ts +2 -0
- package/dist/tools/audit.js +40 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/auth.d.ts +2 -0
- package/dist/tools/auth.js +348 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/billing.d.ts +2 -0
- package/dist/tools/billing.js +51 -0
- package/dist/tools/billing.js.map +1 -0
- package/dist/tools/blog.d.ts +2 -0
- package/dist/tools/blog.js +174 -0
- package/dist/tools/blog.js.map +1 -0
- package/dist/tools/bot-api-keys.d.ts +2 -0
- package/dist/tools/bot-api-keys.js +60 -0
- package/dist/tools/bot-api-keys.js.map +1 -0
- package/dist/tools/bot-api.d.ts +2 -0
- package/dist/tools/bot-api.js +120 -0
- package/dist/tools/bot-api.js.map +1 -0
- package/dist/tools/bots.d.ts +2 -0
- package/dist/tools/bots.js +228 -0
- package/dist/tools/bots.js.map +1 -0
- package/dist/tools/broadcasts.d.ts +2 -0
- package/dist/tools/broadcasts.js +156 -0
- package/dist/tools/broadcasts.js.map +1 -0
- package/dist/tools/builtin-tools.d.ts +5 -0
- package/dist/tools/builtin-tools.js +81 -0
- package/dist/tools/builtin-tools.js.map +1 -0
- package/dist/tools/campaigns.d.ts +2 -0
- package/dist/tools/campaigns.js +277 -0
- package/dist/tools/campaigns.js.map +1 -0
- package/dist/tools/channels.d.ts +2 -0
- package/dist/tools/channels.js +334 -0
- package/dist/tools/channels.js.map +1 -0
- package/dist/tools/contact-lists.d.ts +2 -0
- package/dist/tools/contact-lists.js +214 -0
- package/dist/tools/contact-lists.js.map +1 -0
- package/dist/tools/contacts.d.ts +2 -0
- package/dist/tools/contacts.js +265 -0
- package/dist/tools/contacts.js.map +1 -0
- package/dist/tools/conversations.d.ts +5 -0
- package/dist/tools/conversations.js +270 -0
- package/dist/tools/conversations.js.map +1 -0
- package/dist/tools/knowledge-bases.d.ts +6 -0
- package/dist/tools/knowledge-bases.js +398 -0
- package/dist/tools/knowledge-bases.js.map +1 -0
- package/dist/tools/list-pool.d.ts +2 -0
- package/dist/tools/list-pool.js +120 -0
- package/dist/tools/list-pool.js.map +1 -0
- package/dist/tools/media.d.ts +2 -0
- package/dist/tools/media.js +39 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/newsletters.d.ts +2 -0
- package/dist/tools/newsletters.js +154 -0
- package/dist/tools/newsletters.js.map +1 -0
- package/dist/tools/organizations.d.ts +2 -0
- package/dist/tools/organizations.js +205 -0
- package/dist/tools/organizations.js.map +1 -0
- package/dist/tools/outbound-webhooks.d.ts +5 -0
- package/dist/tools/outbound-webhooks.js +143 -0
- package/dist/tools/outbound-webhooks.js.map +1 -0
- package/dist/tools/payouts.d.ts +2 -0
- package/dist/tools/payouts.js +86 -0
- package/dist/tools/payouts.js.map +1 -0
- package/dist/tools/pool.d.ts +2 -0
- package/dist/tools/pool.js +202 -0
- package/dist/tools/pool.js.map +1 -0
- package/dist/tools/reflections.d.ts +5 -0
- package/dist/tools/reflections.js +90 -0
- package/dist/tools/reflections.js.map +1 -0
- package/dist/tools/tools.d.ts +5 -0
- package/dist/tools/tools.js +174 -0
- package/dist/tools/tools.js.map +1 -0
- package/dist/tools/wallets.d.ts +2 -0
- package/dist/tools/wallets.js +68 -0
- package/dist/tools/wallets.js.map +1 -0
- package/dist/tools/webhooks.d.ts +5 -0
- package/dist/tools/webhooks.js +124 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Neuron (https://neuron.ng)
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Neuron MCP Server
|
|
2
|
+
|
|
3
|
+
> WhatsApp automation platform with 120+ MCP tools for AI-powered chatbots, broadcasts, campaigns, and more.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/neuron-mcp-server)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## What is Neuron?
|
|
9
|
+
|
|
10
|
+
[Neuron](https://neuron.ng) is an AI-powered WhatsApp automation platform. This MCP server exposes **120+ tools** that let AI coding assistants — Claude Code, Cursor, Windsurf, and other MCP-compatible clients — manage your entire WhatsApp business programmatically.
|
|
11
|
+
|
|
12
|
+
Build chatbots, send broadcasts, manage contacts, create campaigns, publish newsletters, and more — all through natural language with your AI assistant.
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
### Option 1: Remote Server (Recommended — zero install)
|
|
17
|
+
|
|
18
|
+
Add to your MCP client config:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"neuron": {
|
|
24
|
+
"type": "url",
|
|
25
|
+
"url": "https://mcp.neuron.ng/mcp"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
No installation required. Works immediately with any MCP client that supports Streamable HTTP.
|
|
32
|
+
|
|
33
|
+
### Option 2: Local Server (via npm)
|
|
34
|
+
|
|
35
|
+
Run directly with npx:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx neuron-mcp-server
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or install globally:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g neuron-mcp-server
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Claude Code config (`~/.claude/mcp.json`):
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"neuron": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["-y", "neuron-mcp-server"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Authentication
|
|
61
|
+
|
|
62
|
+
Three ways to authenticate:
|
|
63
|
+
|
|
64
|
+
### 1. Browser Login (Recommended)
|
|
65
|
+
|
|
66
|
+
Call `neuron_login()` with no arguments. The server returns a URL — open it in your browser to authorize securely. No credentials are shared with the AI.
|
|
67
|
+
|
|
68
|
+
### 2. MCP Token
|
|
69
|
+
|
|
70
|
+
Generate a token from your Neuron dashboard (**Settings > MCP Tokens**), then:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
neuron_login({ token: "your-mcp-token" })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3. Environment Variable
|
|
77
|
+
|
|
78
|
+
Set `NEURON_AUTH_TOKEN` for unattended/CI use:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
NEURON_AUTH_TOKEN=your-token npx neuron-mcp-server
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Available Tools (120+)
|
|
85
|
+
|
|
86
|
+
| Category | Tools | Description |
|
|
87
|
+
|----------|-------|-------------|
|
|
88
|
+
| **Authentication** | 8 | Login, register, org switching, profile management |
|
|
89
|
+
| **Bot Management** | 7 | Create and manage AI chatbots with configurable LLM models |
|
|
90
|
+
| **Conversations** | 11 | Message management, human takeover, send WhatsApp messages |
|
|
91
|
+
| **Knowledge Bases** | 14 | Upload documents, semantic search, sync, ingest content |
|
|
92
|
+
| **Contacts** | 12 | CRUD operations, import/export, semantic search, sync |
|
|
93
|
+
| **Contact Lists** | 11 | Segmentation, merge, membership management |
|
|
94
|
+
| **Channels** | 17 | WhatsApp connections, QR pairing, session management |
|
|
95
|
+
| **Broadcasts** | 7 | Bulk messaging to contact lists |
|
|
96
|
+
| **Campaigns** | 14 | Sponsored campaigns, marketplace, funding |
|
|
97
|
+
| **Newsletters** | 8 | WhatsApp Channel/newsletter management |
|
|
98
|
+
| **Webhooks** | 8 | Inbound and outbound webhook management |
|
|
99
|
+
| **Custom Tools** | 6 | HTTP API tools for bots with secret injection |
|
|
100
|
+
| **Blog** | 6 | Content publishing |
|
|
101
|
+
| **Organizations** | 7 | Team management, audit logs, member invitations |
|
|
102
|
+
| **Billing & Wallet** | 12 | Subscriptions, wallet, payouts, bank accounts |
|
|
103
|
+
| **Marketplace** | 8 | Publish and install bots and contact lists |
|
|
104
|
+
| **Reflections** | 4 | Self-learning bot improvement suggestions |
|
|
105
|
+
| **Media & AI** | 2 | Upload media, AI text rewriting |
|
|
106
|
+
|
|
107
|
+
## Environment Variables
|
|
108
|
+
|
|
109
|
+
| Variable | Description | Default |
|
|
110
|
+
|----------|-------------|---------|
|
|
111
|
+
| `NEURON_API_URL` | API base URL | `https://api.neuron.ng/api/v1` |
|
|
112
|
+
| `NEURON_AUTH_TOKEN` | Pre-set auth token | — |
|
|
113
|
+
| `MCP_TRANSPORT` | Transport mode: `stdio` or `http` | `stdio` |
|
|
114
|
+
| `PORT` | HTTP server port (when using `http` transport) | `3001` |
|
|
115
|
+
|
|
116
|
+
## IDE Setup
|
|
117
|
+
|
|
118
|
+
### Claude Code
|
|
119
|
+
|
|
120
|
+
Add to `~/.claude/mcp.json`:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"mcpServers": {
|
|
125
|
+
"neuron": {
|
|
126
|
+
"command": "npx",
|
|
127
|
+
"args": ["-y", "neuron-mcp-server"]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or use the remote server:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"neuron": {
|
|
139
|
+
"type": "url",
|
|
140
|
+
"url": "https://mcp.neuron.ng/mcp"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Cursor
|
|
147
|
+
|
|
148
|
+
**Settings > MCP Servers > Add Streamable HTTP**
|
|
149
|
+
|
|
150
|
+
URL: `https://mcp.neuron.ng/mcp`
|
|
151
|
+
|
|
152
|
+
### Windsurf
|
|
153
|
+
|
|
154
|
+
**Settings > AI > MCP Servers > Add**
|
|
155
|
+
|
|
156
|
+
Use either the remote URL or local npx command.
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
git clone https://github.com/conquext/neuron-mcp-server.git
|
|
162
|
+
cd neuron-mcp-server
|
|
163
|
+
npm install
|
|
164
|
+
npm run dev
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Links
|
|
168
|
+
|
|
169
|
+
- **Website:** [neuron.ng](https://neuron.ng)
|
|
170
|
+
- **Documentation:** [neuron.ng/docs](https://neuron.ng/docs)
|
|
171
|
+
- **MCP Server Docs:** [neuron.ng/docs/mcp-server](https://neuron.ng/docs/mcp-server)
|
|
172
|
+
- **npm:** [npmjs.com/package/neuron-mcp-server](https://www.npmjs.com/package/neuron-mcp-server)
|
|
173
|
+
|
|
174
|
+
Free to start — no credit card required.
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
[MIT](LICENSE)
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare function setAuthToken(token: string): void;
|
|
2
|
+
export declare function getAuthToken(): string;
|
|
3
|
+
export declare function getBaseUrl(): string;
|
|
4
|
+
interface ApiResponse<T = unknown> {
|
|
5
|
+
success: boolean;
|
|
6
|
+
data?: T;
|
|
7
|
+
error?: {
|
|
8
|
+
message: string;
|
|
9
|
+
code: string;
|
|
10
|
+
details?: unknown;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function api<T = unknown>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", endpoint: string, data?: unknown, params?: Record<string, string | number | undefined>, headers?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
14
|
+
export declare function handleError(error: unknown): string;
|
|
15
|
+
export declare function jsonResult(data: unknown): {
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare function textResult(text: string): {
|
|
22
|
+
content: Array<{
|
|
23
|
+
type: "text";
|
|
24
|
+
text: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
export declare function errorResult(error: unknown): {
|
|
28
|
+
content: Array<{
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}>;
|
|
32
|
+
isError: true;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
// Resolve API URL: prefer NEURON_API_URL if it points to a real server (not Docker-internal hostnames)
|
|
6
|
+
const envUrl = process.env.NEURON_API_URL || "";
|
|
7
|
+
const isDockerInternal = envUrl.includes("neuron-api:") || (envUrl.includes("localhost") && !envUrl.includes("https://"));
|
|
8
|
+
const BASE_URL = isDockerInternal ? "https://api.neuron.ng/api/v1" : (envUrl || "https://api.neuron.ng/api/v1");
|
|
9
|
+
const TOKEN_CACHE_DIR = join(homedir(), ".neuron");
|
|
10
|
+
const TOKEN_CACHE_FILE = join(TOKEN_CACHE_DIR, "mcp-token-cache.json");
|
|
11
|
+
function readCachedToken() {
|
|
12
|
+
try {
|
|
13
|
+
const raw = readFileSync(TOKEN_CACHE_FILE, "utf-8");
|
|
14
|
+
const cache = JSON.parse(raw);
|
|
15
|
+
if (cache.baseUrl === BASE_URL && cache.token) {
|
|
16
|
+
return cache.token;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// No cache or unreadable — that's fine
|
|
21
|
+
}
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
function writeCachedToken(token) {
|
|
25
|
+
try {
|
|
26
|
+
mkdirSync(TOKEN_CACHE_DIR, { recursive: true, mode: 0o700 });
|
|
27
|
+
writeFileSync(TOKEN_CACHE_FILE, JSON.stringify({ baseUrl: BASE_URL, token }), { mode: 0o600 });
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Non-critical — best effort
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let authToken = process.env.NEURON_AUTH_TOKEN || readCachedToken();
|
|
34
|
+
export function setAuthToken(token) {
|
|
35
|
+
authToken = token;
|
|
36
|
+
writeCachedToken(token);
|
|
37
|
+
}
|
|
38
|
+
export function getAuthToken() {
|
|
39
|
+
return authToken;
|
|
40
|
+
}
|
|
41
|
+
export function getBaseUrl() {
|
|
42
|
+
return BASE_URL;
|
|
43
|
+
}
|
|
44
|
+
export async function api(method, endpoint, data, params, headers) {
|
|
45
|
+
try {
|
|
46
|
+
const cleanParams = {};
|
|
47
|
+
if (params) {
|
|
48
|
+
for (const [k, v] of Object.entries(params)) {
|
|
49
|
+
if (v !== undefined)
|
|
50
|
+
cleanParams[k] = v;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const cleanEndpoint = endpoint.replace(/^\/+/, "");
|
|
54
|
+
const response = await axios({
|
|
55
|
+
method,
|
|
56
|
+
url: `${BASE_URL}/${cleanEndpoint}`,
|
|
57
|
+
data,
|
|
58
|
+
params: Object.keys(cleanParams).length > 0 ? cleanParams : undefined,
|
|
59
|
+
timeout: 60000,
|
|
60
|
+
headers: {
|
|
61
|
+
"Content-Type": "application/json",
|
|
62
|
+
Accept: "application/json",
|
|
63
|
+
...(authToken ? { Authorization: `Bearer ${authToken}` } : {}),
|
|
64
|
+
...headers,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return response.data;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error instanceof AxiosError && error.response?.data) {
|
|
71
|
+
return error.response.data;
|
|
72
|
+
}
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export function handleError(error) {
|
|
77
|
+
if (error instanceof AxiosError) {
|
|
78
|
+
if (error.response) {
|
|
79
|
+
const body = error.response.data;
|
|
80
|
+
const msg = body?.error?.message || `HTTP ${error.response.status}`;
|
|
81
|
+
return `Error: ${msg}`;
|
|
82
|
+
}
|
|
83
|
+
const url = error.config?.url || BASE_URL;
|
|
84
|
+
if (error.code === "ECONNABORTED")
|
|
85
|
+
return `Error: Request timed out connecting to ${url}`;
|
|
86
|
+
if (error.code === "ECONNREFUSED") {
|
|
87
|
+
return `Error: Connection refused to ${url}. Try: neuron_login({ token: "your-mcp-token" }) with a token from the Neuron dashboard.`;
|
|
88
|
+
}
|
|
89
|
+
if (error.code === "ENOTFOUND")
|
|
90
|
+
return `Error: DNS lookup failed for ${url}. Check your network connection.`;
|
|
91
|
+
return `Error: Network error (${error.code || "unknown"}): ${error.message} — URL: ${url}`;
|
|
92
|
+
}
|
|
93
|
+
return `Error: ${error instanceof Error ? error.message : String(error)}`;
|
|
94
|
+
}
|
|
95
|
+
export function jsonResult(data) {
|
|
96
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
97
|
+
}
|
|
98
|
+
export function textResult(text) {
|
|
99
|
+
return { content: [{ type: "text", text }] };
|
|
100
|
+
}
|
|
101
|
+
export function errorResult(error) {
|
|
102
|
+
return { content: [{ type: "text", text: handleError(error) }], isError: true };
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAa,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,uGAAuG;AACvG,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;AAChD,MAAM,gBAAgB,GAAG,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,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACvF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3F,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Neuron MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Exposes the full Neuron AI chatbot platform as MCP tools.
|
|
6
|
+
* Supports 120+ tools covering bots, conversations, knowledge bases,
|
|
7
|
+
* tools, webhooks, built-in tools, reflections, channels, contacts,
|
|
8
|
+
* broadcasts, billing, media, AI, marketplace, and more.
|
|
9
|
+
*
|
|
10
|
+
* Environment variables:
|
|
11
|
+
* NEURON_API_URL - Base URL (default: https://api.neuron.ng/api/v1)
|
|
12
|
+
* NEURON_AUTH_TOKEN - Pre-set JWT or API key for authentication
|
|
13
|
+
* MCP_TRANSPORT - "http" for Streamable HTTP, "stdio" (default) for stdio
|
|
14
|
+
* PORT - HTTP server port (default: 3001)
|
|
15
|
+
*
|
|
16
|
+
* Transports:
|
|
17
|
+
* stdio - For local Claude Code / IDE integration (default)
|
|
18
|
+
* http - For remote connections (Claude.ai custom connectors)
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Neuron MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Exposes the full Neuron AI chatbot platform as MCP tools.
|
|
6
|
+
* Supports 120+ tools covering bots, conversations, knowledge bases,
|
|
7
|
+
* tools, webhooks, built-in tools, reflections, channels, contacts,
|
|
8
|
+
* broadcasts, billing, media, AI, marketplace, and more.
|
|
9
|
+
*
|
|
10
|
+
* Environment variables:
|
|
11
|
+
* NEURON_API_URL - Base URL (default: https://api.neuron.ng/api/v1)
|
|
12
|
+
* NEURON_AUTH_TOKEN - Pre-set JWT or API key for authentication
|
|
13
|
+
* MCP_TRANSPORT - "http" for Streamable HTTP, "stdio" (default) for stdio
|
|
14
|
+
* PORT - HTTP server port (default: 3001)
|
|
15
|
+
*
|
|
16
|
+
* Transports:
|
|
17
|
+
* stdio - For local Claude Code / IDE integration (default)
|
|
18
|
+
* http - For remote connections (Claude.ai custom connectors)
|
|
19
|
+
*/
|
|
20
|
+
import { config } from "dotenv";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { dirname, resolve } from "node:path";
|
|
23
|
+
// Load .env from mcp-server directory (not CWD which may be the project root)
|
|
24
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
config({ path: resolve(__dirname, "../.env") });
|
|
26
|
+
import { randomUUID } from "node:crypto";
|
|
27
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
28
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
29
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
30
|
+
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
31
|
+
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
32
|
+
import { registerAuthTools } from "./tools/auth.js";
|
|
33
|
+
import { registerBotTools } from "./tools/bots.js";
|
|
34
|
+
import { registerBotApiKeyTools } from "./tools/bot-api-keys.js";
|
|
35
|
+
import { registerBotApiTools } from "./tools/bot-api.js";
|
|
36
|
+
import { registerConversationTools } from "./tools/conversations.js";
|
|
37
|
+
import { registerKnowledgeBaseTools } from "./tools/knowledge-bases.js";
|
|
38
|
+
import { registerToolsTools } from "./tools/tools.js";
|
|
39
|
+
import { registerWebhooksTools } from "./tools/webhooks.js";
|
|
40
|
+
import { registerReflectionsTools } from "./tools/reflections.js";
|
|
41
|
+
import { registerChannelsTools } from "./tools/channels.js";
|
|
42
|
+
import { registerPoolTools } from "./tools/pool.js";
|
|
43
|
+
import { registerOrganizationTools } from "./tools/organizations.js";
|
|
44
|
+
import { registerAuditTools } from "./tools/audit.js";
|
|
45
|
+
import { registerBuiltinToolsTools } from "./tools/builtin-tools.js";
|
|
46
|
+
import { registerOutboundWebhookTools } from "./tools/outbound-webhooks.js";
|
|
47
|
+
import { registerContactsTools } from "./tools/contacts.js";
|
|
48
|
+
import { registerContactListsTools } from "./tools/contact-lists.js";
|
|
49
|
+
import { registerBroadcastsTools } from "./tools/broadcasts.js";
|
|
50
|
+
import { registerBillingTools } from "./tools/billing.js";
|
|
51
|
+
import { registerMediaTools } from "./tools/media.js";
|
|
52
|
+
import { registerAiTools } from "./tools/ai.js";
|
|
53
|
+
import { registerCampaignTools } from "./tools/campaigns.js";
|
|
54
|
+
import { registerWalletTools } from "./tools/wallets.js";
|
|
55
|
+
import { registerPayoutTools } from "./tools/payouts.js";
|
|
56
|
+
import { registerBlogTools } from "./tools/blog.js";
|
|
57
|
+
import { registerNewsletterTools } from "./tools/newsletters.js";
|
|
58
|
+
import { registerListPoolTools } from "./tools/list-pool.js";
|
|
59
|
+
function createServer() {
|
|
60
|
+
const server = new McpServer({
|
|
61
|
+
name: "neuron-mcp-server",
|
|
62
|
+
version: "1.0.0",
|
|
63
|
+
});
|
|
64
|
+
// Register all tool groups
|
|
65
|
+
registerAuthTools(server);
|
|
66
|
+
registerBotTools(server);
|
|
67
|
+
registerBotApiKeyTools(server);
|
|
68
|
+
registerBotApiTools(server);
|
|
69
|
+
registerConversationTools(server);
|
|
70
|
+
registerKnowledgeBaseTools(server);
|
|
71
|
+
registerToolsTools(server);
|
|
72
|
+
registerWebhooksTools(server);
|
|
73
|
+
registerReflectionsTools(server);
|
|
74
|
+
registerChannelsTools(server);
|
|
75
|
+
registerPoolTools(server);
|
|
76
|
+
registerOrganizationTools(server);
|
|
77
|
+
registerAuditTools(server);
|
|
78
|
+
registerBuiltinToolsTools(server);
|
|
79
|
+
registerOutboundWebhookTools(server);
|
|
80
|
+
registerContactsTools(server);
|
|
81
|
+
registerContactListsTools(server);
|
|
82
|
+
registerBroadcastsTools(server);
|
|
83
|
+
registerBillingTools(server);
|
|
84
|
+
registerMediaTools(server);
|
|
85
|
+
registerAiTools(server);
|
|
86
|
+
registerCampaignTools(server);
|
|
87
|
+
registerWalletTools(server);
|
|
88
|
+
registerPayoutTools(server);
|
|
89
|
+
registerBlogTools(server);
|
|
90
|
+
registerNewsletterTools(server);
|
|
91
|
+
registerListPoolTools(server);
|
|
92
|
+
return server;
|
|
93
|
+
}
|
|
94
|
+
async function startStdio() {
|
|
95
|
+
const server = createServer();
|
|
96
|
+
const transport = new StdioServerTransport();
|
|
97
|
+
await server.connect(transport);
|
|
98
|
+
console.error("Neuron MCP server running via stdio");
|
|
99
|
+
}
|
|
100
|
+
async function startHttp() {
|
|
101
|
+
const PORT = parseInt(process.env.PORT || "3001", 10);
|
|
102
|
+
const app = createMcpExpressApp({ host: "0.0.0.0" });
|
|
103
|
+
const transports = {};
|
|
104
|
+
function createTransport() {
|
|
105
|
+
const transport = new StreamableHTTPServerTransport({
|
|
106
|
+
sessionIdGenerator: () => randomUUID(),
|
|
107
|
+
onsessioninitialized: (sid) => {
|
|
108
|
+
transports[sid] = transport;
|
|
109
|
+
console.error(`Session initialized: ${sid}`);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
transport.onclose = () => {
|
|
113
|
+
const sid = transport.sessionId;
|
|
114
|
+
if (sid && transports[sid]) {
|
|
115
|
+
delete transports[sid];
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return transport;
|
|
119
|
+
}
|
|
120
|
+
app.all("/mcp", async (req, res) => {
|
|
121
|
+
try {
|
|
122
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
123
|
+
let transport;
|
|
124
|
+
if (sessionId && transports[sessionId]) {
|
|
125
|
+
// Known session — reuse existing transport
|
|
126
|
+
transport = transports[sessionId];
|
|
127
|
+
}
|
|
128
|
+
else if (req.method === "POST" && isInitializeRequest(req.body)) {
|
|
129
|
+
// New or re-initializing client — create a fresh session
|
|
130
|
+
// (handles both no session ID and stale session ID after server restart)
|
|
131
|
+
transport = createTransport();
|
|
132
|
+
const server = createServer();
|
|
133
|
+
await server.connect(transport);
|
|
134
|
+
}
|
|
135
|
+
else if (sessionId && !transports[sessionId]) {
|
|
136
|
+
// Stale session ID with a non-initialize request — tell client to re-initialize
|
|
137
|
+
res.status(404).json({
|
|
138
|
+
jsonrpc: "2.0",
|
|
139
|
+
error: { code: -32000, message: "Session expired. Please reconnect." },
|
|
140
|
+
id: null,
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
res.status(400).json({
|
|
146
|
+
jsonrpc: "2.0",
|
|
147
|
+
error: { code: -32000, message: "Bad Request: No valid session ID provided" },
|
|
148
|
+
id: null,
|
|
149
|
+
});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
await transport.handleRequest(req, res, req.body);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
console.error("Error handling MCP request:", error);
|
|
156
|
+
if (!res.headersSent) {
|
|
157
|
+
res.status(500).json({
|
|
158
|
+
jsonrpc: "2.0",
|
|
159
|
+
error: { code: -32603, message: "Internal server error" },
|
|
160
|
+
id: null,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
app.listen(PORT, "0.0.0.0", () => {
|
|
166
|
+
console.error(`Neuron MCP server listening on http://0.0.0.0:${PORT}/mcp`);
|
|
167
|
+
});
|
|
168
|
+
process.on("SIGINT", async () => {
|
|
169
|
+
console.error("Shutting down...");
|
|
170
|
+
for (const sid of Object.keys(transports)) {
|
|
171
|
+
await transports[sid].close().catch(() => { });
|
|
172
|
+
delete transports[sid];
|
|
173
|
+
}
|
|
174
|
+
process.exit(0);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const mode = process.env.MCP_TRANSPORT || "stdio";
|
|
178
|
+
if (mode === "http") {
|
|
179
|
+
startHttp().catch((error) => {
|
|
180
|
+
console.error("Server error:", error);
|
|
181
|
+
process.exit(1);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
startStdio().catch((error) => {
|
|
186
|
+
console.error("Server error:", error);
|
|
187
|
+
process.exit(1);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,8EAA8E;AAC9E,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM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AC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC;AAElD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;KAAM,CAAC;IACN,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tools/ai.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { api, jsonResult, errorResult } from "../client.js";
|
|
3
|
+
export function registerAiTools(server) {
|
|
4
|
+
// Rewrite text
|
|
5
|
+
server.registerTool("neuron_rewrite_text", {
|
|
6
|
+
title: "Rewrite Text",
|
|
7
|
+
description: "Use AI to rewrite or transform text based on an optional instruction (e.g., make it more formal, translate, summarize)",
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
text: z.string().describe("The text to rewrite"),
|
|
10
|
+
instruction: z.string().optional().describe("Instructions for how to rewrite the text (e.g., 'make it more professional', 'translate to Spanish')"),
|
|
11
|
+
}),
|
|
12
|
+
}, async (params) => {
|
|
13
|
+
try {
|
|
14
|
+
const result = await api("POST", "/ai/rewrite", {
|
|
15
|
+
text: params.text,
|
|
16
|
+
instruction: params.instruction,
|
|
17
|
+
});
|
|
18
|
+
return jsonResult(result);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return errorResult(error);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../../src/tools/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,eAAe;IACf,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,wHAAwH;QACrI,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;YAChD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sGAAsG,CAAC;SACpJ,CAAC;KACH,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE;gBAC9C,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC,CAAC;YACH,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { api, jsonResult, errorResult } from "../client.js";
|
|
3
|
+
export function registerAuditTools(server) {
|
|
4
|
+
// List Audit Logs
|
|
5
|
+
server.registerTool("neuron_list_audit_logs", {
|
|
6
|
+
title: "List Audit Logs",
|
|
7
|
+
description: "Retrieve audit logs with optional filtering by page, limit, action, and resource type",
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
page: z.number().int().positive().optional().describe("Page number for pagination (starts at 1)"),
|
|
10
|
+
limit: z.number().int().positive().optional().describe("Number of records per page"),
|
|
11
|
+
action: z.string().optional().describe("Filter by action type (e.g., 'CREATE', 'UPDATE', 'DELETE')"),
|
|
12
|
+
resourceType: z.string().optional().describe("Filter by resource type (e.g., 'USER', 'ORGANIZATION', 'CAMPAIGN')"),
|
|
13
|
+
}),
|
|
14
|
+
annotations: {
|
|
15
|
+
readOnlyHint: true,
|
|
16
|
+
},
|
|
17
|
+
}, async (params) => {
|
|
18
|
+
try {
|
|
19
|
+
const queryParams = {};
|
|
20
|
+
if (params.page !== undefined) {
|
|
21
|
+
queryParams.page = params.page;
|
|
22
|
+
}
|
|
23
|
+
if (params.limit !== undefined) {
|
|
24
|
+
queryParams.limit = params.limit;
|
|
25
|
+
}
|
|
26
|
+
if (params.action !== undefined) {
|
|
27
|
+
queryParams.action = params.action;
|
|
28
|
+
}
|
|
29
|
+
if (params.resourceType !== undefined) {
|
|
30
|
+
queryParams.resourceType = params.resourceType;
|
|
31
|
+
}
|
|
32
|
+
const result = await api("GET", "/audit", undefined, queryParams);
|
|
33
|
+
return jsonResult(result);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return errorResult(error);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/tools/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,UAAU,k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