@efficy/tribecrm-mcp-server 0.2.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Efficy SA
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,297 @@
1
+ # TribeCRM MCP Server
2
+
3
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)
4
+ [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-1.0-green)](https://github.com/modelcontextprotocol)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Model Context Protocol (MCP) server for TribeCRM API integration. This server enables AI assistants like Claude to interact with TribeCRM entities, perform searches, and manage connectors.
8
+
9
+ ## 🚀 Features
10
+
11
+ ### Tools
12
+ - **Entity Management** (CRUD operations)
13
+ - Create, read, update, and delete CRM entities
14
+ - Support for contacts, companies, deals, activities, and more
15
+ - **Advanced Search & Query**
16
+ - Search across entities with filters and pagination
17
+ - Complex filter criteria support
18
+ - **Connector Management**
19
+ - List available integration connectors
20
+ - Get connector details and status
21
+
22
+ ### Resources
23
+ - **Entity Type Definitions**: Access schema and field information for entity types
24
+ - **Dynamic Resources**: Entity data exposed as MCP resources for context
25
+
26
+ ## 📋 Prerequisites
27
+
28
+ - Node.js 18 or higher
29
+ - TribeCRM API credentials (Client ID and Secret)
30
+ - Access to a TribeCRM instance
31
+
32
+ ## 🔧 Installation
33
+
34
+ ```bash
35
+ npm install
36
+ ```
37
+
38
+ ## ⚙️ Configuration
39
+
40
+ 1. Copy the environment template:
41
+ ```bash
42
+ cp .env.example .env
43
+ ```
44
+
45
+ 2. Configure your TribeCRM API credentials in `.env`:
46
+ ```env
47
+ TRIBECRM_API_URL=https://api.tribecrm.com
48
+ TRIBECRM_CLIENT_ID=your_client_id_here
49
+ TRIBECRM_CLIENT_SECRET=your_client_secret_here
50
+ TRIBECRM_ORGANIZATION_ID=optional_org_id
51
+ MCP_SERVER_NAME=tribecrm
52
+ ```
53
+
54
+ ## 🏗️ Building
55
+
56
+ ```bash
57
+ npm run build
58
+ ```
59
+
60
+ ## 🎯 Usage
61
+
62
+ ### Running the Server
63
+
64
+ ```bash
65
+ npm start
66
+ ```
67
+
68
+ ### Development Mode
69
+
70
+ ```bash
71
+ npm run dev
72
+ ```
73
+
74
+ ### MCP Client Configuration
75
+
76
+ Add to your MCP client settings (e.g., `~/Library/Application Support/Claude/claude_desktop_config.json` for Claude Desktop):
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "tribecrm": {
82
+ "command": "node",
83
+ "args": ["/absolute/path/to/tribecrm-mcp-server/dist/index.js"],
84
+ "env": {
85
+ "TRIBECRM_API_URL": "https://api.tribecrm.com",
86
+ "TRIBECRM_CLIENT_ID": "your_client_id",
87
+ "TRIBECRM_CLIENT_SECRET": "your_client_secret"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ## 📚 Available Tools
95
+
96
+ ### Entity Operations
97
+
98
+ #### `tribecrm_get_entity`
99
+ Retrieve a specific entity by ID
100
+
101
+ **Parameters:**
102
+ - `entityType` (string): Entity type (e.g., 'contact', 'company', 'deal')
103
+ - `entityId` (string): Unique entity identifier
104
+
105
+ **Example:**
106
+ ```json
107
+ {
108
+ "entityType": "contact",
109
+ "entityId": "12345"
110
+ }
111
+ ```
112
+
113
+ #### `tribecrm_create_entity`
114
+ Create a new entity
115
+
116
+ **Parameters:**
117
+ - `entityType` (string): Entity type to create
118
+ - `data` (object): Entity data as key-value pairs
119
+
120
+ **Example:**
121
+ ```json
122
+ {
123
+ "entityType": "contact",
124
+ "data": {
125
+ "name": "John Smith",
126
+ "email": "john@example.com",
127
+ "phone": "+1234567890"
128
+ }
129
+ }
130
+ ```
131
+
132
+ #### `tribecrm_update_entity`
133
+ Update an existing entity
134
+
135
+ **Parameters:**
136
+ - `entityType` (string): Entity type
137
+ - `entityId` (string): Entity ID to update
138
+ - `data` (object): Updated entity data
139
+
140
+ **Example:**
141
+ ```json
142
+ {
143
+ "entityType": "contact",
144
+ "entityId": "12345",
145
+ "data": {
146
+ "email": "newemail@example.com"
147
+ }
148
+ }
149
+ ```
150
+
151
+ #### `tribecrm_delete_entity`
152
+ Delete an entity
153
+
154
+ **Parameters:**
155
+ - `entityType` (string): Entity type
156
+ - `entityId` (string): Entity ID to delete
157
+
158
+ ### Search Operations
159
+
160
+ #### `tribecrm_search_entities`
161
+ Search for entities with filters and pagination
162
+
163
+ **Parameters:**
164
+ - `entityType` (string, required): Entity type to search
165
+ - `query` (string, optional): Search query string
166
+ - `filters` (object, optional): Filter criteria
167
+ - `page` (number, optional): Page number (default: 1)
168
+ - `pageSize` (number, optional): Results per page (default: 20, max: 100)
169
+
170
+ **Example:**
171
+ ```json
172
+ {
173
+ "entityType": "company",
174
+ "query": "tech",
175
+ "filters": {
176
+ "location": "New York",
177
+ "status": "active"
178
+ },
179
+ "page": 1,
180
+ "pageSize": 20
181
+ }
182
+ ```
183
+
184
+ ### Connector Operations
185
+
186
+ #### `tribecrm_list_connectors`
187
+ List all available connectors
188
+
189
+ **Parameters:** None
190
+
191
+ #### `tribecrm_get_connector`
192
+ Get details of a specific connector
193
+
194
+ **Parameters:**
195
+ - `connectorId` (string): Connector ID
196
+
197
+ ## 📖 Documentation
198
+
199
+ - [Usage Examples](docs/EXAMPLES.md) - Detailed usage examples and scenarios
200
+ - [Troubleshooting Guide](docs/TROUBLESHOOTING.md) - Common issues and solutions
201
+ - [Contributing](CONTRIBUTING.md) - Guidelines for contributing to this project
202
+
203
+ ## 🏗️ Architecture
204
+
205
+ ```
206
+ ┌─────────────────┐
207
+ │ MCP Client │
208
+ │ (Claude, etc.) │
209
+ └────────┬────────┘
210
+
211
+ │ MCP Protocol (stdio)
212
+
213
+ ┌────────▼────────────────┐
214
+ │ TribeCRM MCP Server │
215
+ │ ┌──────────────────┐ │
216
+ │ │ Tool Handlers │ │
217
+ │ │ - Entity CRUD │ │
218
+ │ │ - Search │ │
219
+ │ │ - Connectors │ │
220
+ │ └──────────────────┘ │
221
+ │ ┌──────────────────┐ │
222
+ │ │ Resource Handler │ │
223
+ │ │ - Entity Types │ │
224
+ │ └──────────────────┘ │
225
+ │ ┌──────────────────┐ │
226
+ │ │ API Client │ │
227
+ │ │ - OAuth2 Auth │ │
228
+ │ │ - HTTP Requests │ │
229
+ │ └──────────────────┘ │
230
+ └────────┬────────────────┘
231
+
232
+ │ HTTPS + OAuth2
233
+
234
+ ┌────────▼────────────┐
235
+ │ TribeCRM API │
236
+ │ (REST API) │
237
+ └─────────────────────┘
238
+ ```
239
+
240
+ ## 🔐 Authentication
241
+
242
+ The server uses OAuth2 Client Credentials flow:
243
+ 1. Authenticates with TribeCRM API using client credentials
244
+ 2. Obtains access token
245
+ 3. Automatically refreshes token before expiry
246
+ 4. Includes token in all API requests
247
+
248
+ ## 🛠️ Development
249
+
250
+ ### Project Structure
251
+
252
+ ```
253
+ tribecrm-mcp-server/
254
+ ├── src/
255
+ │ ├── index.ts # Main MCP server implementation
256
+ │ ├── client.ts # TribeCRM API client
257
+ │ └── types.ts # TypeScript type definitions
258
+ ├── docs/
259
+ │ ├── EXAMPLES.md # Usage examples
260
+ │ └── TROUBLESHOOTING.md # Troubleshooting guide
261
+ ├── dist/ # Compiled JavaScript (generated)
262
+ ├── .env.example # Environment template
263
+ ├── package.json # Dependencies and scripts
264
+ ├── tsconfig.json # TypeScript configuration
265
+ └── README.md # This file
266
+ ```
267
+
268
+ ### Tech Stack
269
+
270
+ - **TypeScript** - Type-safe development
271
+ - **@modelcontextprotocol/sdk** - MCP protocol implementation
272
+ - **axios** - HTTP client for API requests
273
+ - **dotenv** - Environment variable management
274
+
275
+ ## 🤝 Contributing
276
+
277
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
278
+
279
+ ## 📝 License
280
+
281
+ MIT License - see LICENSE file for details
282
+
283
+ ## 🔗 Links
284
+
285
+ - [TribeCRM](https://tribecrm.com) - Official TribeCRM website
286
+ - [Model Context Protocol](https://modelcontextprotocol.io) - MCP documentation
287
+ - [GitHub Repository](https://github.com/jnorsa-efficy/tribecrm-mcp-server)
288
+
289
+ ## 📧 Support
290
+
291
+ For issues and questions:
292
+ - Open an issue on [GitHub](https://github.com/jnorsa-efficy/tribecrm-mcp-server/issues)
293
+ - Check the [Troubleshooting Guide](docs/TROUBLESHOOTING.md)
294
+
295
+ ---
296
+
297
+ **Note:** This is an unofficial MCP server for TribeCRM. For official API documentation, please refer to your TribeCRM instance documentation.
@@ -0,0 +1,59 @@
1
+ import { TribeCRMConfig, Entity, EntityType } from './types.js';
2
+ export declare class TribeCRMClient {
3
+ private axiosInstance;
4
+ private config;
5
+ private token;
6
+ private tokenExpiry;
7
+ constructor(config: TribeCRMConfig);
8
+ private ensureAuthenticated;
9
+ /**
10
+ * Get a single entity by ID
11
+ * @param entityType OData entity type (e.g. 'Relation_Organization', 'Relation_Person')
12
+ * @param entityId Entity UUID
13
+ * @param expand Optional $expand parameter
14
+ * @param select Optional $select parameter
15
+ */
16
+ getEntity(entityType: string, entityId: string, expand?: string, select?: string): Promise<Entity>;
17
+ /**
18
+ * Create a new entity
19
+ * @param entityType OData entity type
20
+ * @param data Entity data (without ID)
21
+ */
22
+ createEntity(entityType: string, data: Record<string, any>): Promise<Entity>;
23
+ /**
24
+ * Update an existing entity
25
+ * @param entityType OData entity type
26
+ * @param entityId Entity UUID
27
+ * @param data Entity data (must include ID)
28
+ */
29
+ updateEntity(entityType: string, entityId: string, data: Record<string, any>): Promise<Entity>;
30
+ /**
31
+ * Delete an entity
32
+ * @param entityType OData entity type
33
+ * @param entityId Entity UUID
34
+ */
35
+ deleteEntity(entityType: string, entityId: string): Promise<void>;
36
+ /**
37
+ * Search/query entities with OData filters
38
+ * @param entityType OData entity type
39
+ * @param options Query options (filter, select, expand, orderby, top, skip, count)
40
+ */
41
+ queryEntities(entityType: string, options?: {
42
+ filter?: string;
43
+ select?: string;
44
+ expand?: string;
45
+ orderby?: string;
46
+ top?: number;
47
+ skip?: number;
48
+ count?: boolean;
49
+ }): Promise<any>;
50
+ /**
51
+ * Get current employee information
52
+ */
53
+ getCurrentEmployee(expand?: string): Promise<any>;
54
+ /**
55
+ * List available entity types (metadata)
56
+ */
57
+ listEntityTypes(): Promise<EntityType[]>;
58
+ }
59
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAa,MAAM,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAEpG,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,KAAK,CAA0B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ient {
3
+ axiosInstance;
4
+ config;
5
+ token = null;
6
+ tokenExpiry = 0;
7
+ constructor(config) {
8
+ this.config = config;
9
+ this.axiosInstance = axios.create({
10
+ baseURL: config.apiUrl,
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ },
14
+ });
15
+ }
16
+ async ensureAuthenticated() {
17
+ const now = Date.now();
18
+ if (this.token && this.tokenExpiry > now + 60000) {
19
+ return;
20
+ }
21
+ try {
22
+ const response = await axios.post('https://auth.tribecrm.nl/oauth2/token', new URLSearchParams({
23
+ grant_type: 'client_credentials',
24
+ client_id: this.config.clientId,
25
+ client_secret: this.config.clientSecret,
26
+ scope: 'read write offline',
27
+ ...(this.config.organizationId && { organization_id: this.config.organizationId }),
28
+ }), {
29
+ headers: {
30
+ 'Content-Type': 'application/x-www-form-urlencoded',
31
+ },
32
+ });
33
+ this.token = response.data;
34
+ this.tokenExpiry = now + (this.token.expires_in * 1000);
35
+ this.axiosInstance.defaults.headers.common['Authorization'] = `Bearer ${this.token.access_token}`;
36
+ }
37
+ catch (error) {
38
+ throw new Error(`Authentication failed: ${error.response?.data?.error_description || error.message}`);
39
+ }
40
+ }
41
+ /**
42
+ * Get a single entity by ID
43
+ * @param entityType OData entity type (e.g. 'Relation_Organization', 'Relation_Person')
44
+ * @param entityId Entity UUID
45
+ * @param expand Optional $expand parameter
46
+ * @param select Optional $select parameter
47
+ */
48
+ async getEntity(entityType, entityId, expand, select) {
49
+ await this.ensureAuthenticated();
50
+ const params = {};
51
+ if (expand)
52
+ params.$expand = expand;
53
+ if (select)
54
+ params.$select = select;
55
+ const response = await this.axiosInstance.get(`/v1/odata/${entityType}(${entityId})`, { params });
56
+ return response.data;
57
+ }
58
+ /**
59
+ * Create a new entity
60
+ * @param entityType OData entity type
61
+ * @param data Entity data (without ID)
62
+ */
63
+ async createEntity(entityType, data) {
64
+ await this.ensureAuthenticated();
65
+ const response = await this.axiosInstance.post(`/v1/odata/${entityType}`, data);
66
+ return response.data;
67
+ }
68
+ /**
69
+ * Update an existing entity
70
+ * @param entityType OData entity type
71
+ * @param entityId Entity UUID
72
+ * @param data Entity data (must include ID)
73
+ */
74
+ async updateEntity(entityType, entityId, data) {
75
+ await this.ensureAuthenticated();
76
+ const payload = { ...data, ID: entityId };
77
+ const response = await this.axiosInstance.post(`/v1/odata/${entityType}`, payload);
78
+ return response.data;
79
+ }
80
+ /**
81
+ * Delete an entity
82
+ * @param entityType OData entity type
83
+ * @param entityId Entity UUID
84
+ */
85
+ async deleteEntity(entityType, entityId) {
86
+ await this.ensureAuthenticated();
87
+ await this.axiosInstance.delete(`/v1/odata/${entityType}(${entityId})`);
88
+ }
89
+ /**
90
+ * Search/query entities with OData filters
91
+ * @param entityType OData entity type
92
+ * @param options Query options (filter, select, expand, orderby, top, skip, count)
93
+ */
94
+ async queryEntities(entityType, options) {
95
+ await this.ensureAuthenticated();
96
+ const params = {};
97
+ if (options?.filter)
98
+ params.$filter = options.filter;
99
+ if (options?.select)
100
+ params.$select = options.select;
101
+ if (options?.expand)
102
+ params.$expand = options.expand;
103
+ if (options?.orderby)
104
+ params.$orderby = options.orderby;
105
+ if (options?.top)
106
+ params.$top = options.top;
107
+ if (options?.skip)
108
+ params.$skip = options.skip;
109
+ if (options?.count)
110
+ params.$count = 'true';
111
+ const response = await this.axiosInstance.get(`/v1/odata/${entityType}`, { params });
112
+ return response.data;
113
+ }
114
+ /**
115
+ * Get current employee information
116
+ */
117
+ async getCurrentEmployee(expand) {
118
+ await this.ensureAuthenticated();
119
+ const params = {};
120
+ if (expand)
121
+ params.$expand = expand;
122
+ const response = await this.axiosInstance.get('/v1/odata/GetCurrentEmployee()', { params });
123
+ return response.data;
124
+ }
125
+ /**
126
+ * List available entity types (metadata)
127
+ */
128
+ async listEntityTypes() {
129
+ await this.ensureAuthenticated();
130
+ try {
131
+ const response = await this.axiosInstance.get('/v1/odata/$metadata');
132
+ // Parse OData metadata XML - simplified version
133
+ // In production, you'd parse the XML properly
134
+ return [
135
+ { code: 'Relation_Organization', name: 'Organizations', fields: [] },
136
+ { code: 'Relation_Person', name: 'Persons', fields: [] },
137
+ { code: 'Relationship_Organization_CommercialRelationship_Customer', name: 'Customers', fields: [] },
138
+ { code: 'Relationship_Organization_CommercialRelationship_Lead', name: 'Leads', fields: [] },
139
+ { code: 'Activity_Invoice', name: 'Invoices', fields: [] },
140
+ { code: 'Activity_Appointment', name: 'Appointments', fields: [] },
141
+ { code: 'Product', name: 'Products', fields: [] },
142
+ ];
143
+ }
144
+ catch (error) {
145
+ console.error('Error fetching metadata:', error);
146
+ return [];
147
+ }
148
+ }
149
+ }
150
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAG7C,MAAM,OAAO,cAAc;IACjB,aAAa,CAAgB;IAC7B,MAAM,CAAiB;IACvB,KAAK,GAAqB,IAAI,CAAC;IAC/B,WAAW,GAAW,CAAC,CAAC;IAEhC,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,MAAM,CAAC,MAAM;YACtB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;YACjD,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAC/B,uCAAuC,EACvC,IAAI,eAAe,CAAC;gBAClB,UAAU,EAAE,oBAAoB;gBAChC,SAAS,EAAE,IAAI,CAAC,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iB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;gBACxD,EAAE,IAAI,EAAE,2DAA2D,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE;gBACpG,EAAE,IAAI,EAAE,uDAAuD,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;gBAC5F,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;gBAC1D,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE;gBAClE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;aAClD,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YACjD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,336 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ import dotenv from 'dotenv';
6
+ import { TribeCRMClient } from './client.js';
7
+ // Load environment variables
8
+ dotenv.config();
9
+ // Validate configuration
10
+ const config = {
11
+ apiUrl: process.env.TRIBECRM_API_URL || 'https://api.tribecrm.nl',
12
+ clientId: process.env.TRIBECRM_CLIENT_ID || '',
13
+ clientSecret: process.env.TRIBECRM_CLIENT_SECRET || '',
14
+ organizationId: process.env.TRIBECRM_ORGANIZATION_ID,
15
+ };
16
+ if (!config.clientId || !config.clientSecret) {
17
+ console.error('Error: Missing required environment variables');
18
+ console.error('Required: TRIBECRM_CLIENT_ID, TRIBECRM_CLIENT_SECRET');
19
+ console.error('Optional: TRIBECRM_API_URL (default: https://api.tribecrm.nl), TRIBECRM_ORGANIZATION_ID');
20
+ process.exit(1);
21
+ }
22
+ // Initialize client
23
+ const client = new TribeCRMClient(config);
24
+ // Initialize MCP server
25
+ const server = new Server({
26
+ name: process.env.MCP_SERVER_NAME || 'tribecrm',
27
+ version: '0.2.0',
28
+ }, {
29
+ capabilities: {
30
+ tools: {},
31
+ resources: {},
32
+ },
33
+ });
34
+ // Register tool handlers
35
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
36
+ return {
37
+ tools: [
38
+ {
39
+ name: 'tribecrm_get_entity',
40
+ description: 'Get a single entity by ID. Common entity types: Relation_Organization, Relation_Person, Activity_Invoice, Product',
41
+ inputSchema: {
42
+ type: 'object',
43
+ properties: {
44
+ entityType: {
45
+ type: 'string',
46
+ description: 'OData entity type (e.g., Relation_Organization, Relation_Person, Activity_Invoice)',
47
+ },
48
+ entityId: {
49
+ type: 'string',
50
+ description: 'Entity UUID',
51
+ },
52
+ expand: {
53
+ type: 'string',
54
+ description: 'Optional $expand parameter (e.g., "Address", "InvoiceAddress($expand=Country)")',
55
+ },
56
+ select: {
57
+ type: 'string',
58
+ description: 'Optional $select parameter (e.g., "Name,EmailAddress,PhoneNumber")',
59
+ },
60
+ },
61
+ required: ['entityType', 'entityId'],
62
+ },
63
+ },
64
+ {
65
+ name: 'tribecrm_query_entities',
66
+ description: 'Query entities with OData filters. Supports $filter, $select, $expand, $orderby, $top, $skip, $count',
67
+ inputSchema: {
68
+ type: 'object',
69
+ properties: {
70
+ entityType: {
71
+ type: 'string',
72
+ description: 'OData entity type to query',
73
+ },
74
+ filter: {
75
+ type: 'string',
76
+ description: 'OData $filter expression (e.g., "Name eq \'John\' or contains(Name,\'tech\')")',
77
+ },
78
+ select: {
79
+ type: 'string',
80
+ description: 'Comma-separated list of fields to return',
81
+ },
82
+ expand: {
83
+ type: 'string',
84
+ description: 'Related entities to expand',
85
+ },
86
+ orderby: {
87
+ type: 'string',
88
+ description: 'Field to sort by with optional desc (e.g., "Name desc")',
89
+ },
90
+ top: {
91
+ type: 'number',
92
+ description: 'Number of records to return (pagination)',
93
+ },
94
+ skip: {
95
+ type: 'number',
96
+ description: 'Number of records to skip (pagination)',
97
+ },
98
+ count: {
99
+ type: 'boolean',
100
+ description: 'Include total count in response',
101
+ },
102
+ },
103
+ required: ['entityType'],
104
+ },
105
+ },
106
+ {
107
+ name: 'tribecrm_create_entity',
108
+ description: 'Create a new entity in TribeCRM',
109
+ inputSchema: {
110
+ type: 'object',
111
+ properties: {
112
+ entityType: {
113
+ type: 'string',
114
+ description: 'OData entity type',
115
+ },
116
+ data: {
117
+ type: 'object',
118
+ description: 'Entity data (do not include ID)',
119
+ },
120
+ },
121
+ required: ['entityType', 'data'],
122
+ },
123
+ },
124
+ {
125
+ name: 'tribecrm_update_entity',
126
+ description: 'Update an existing entity in TribeCRM',
127
+ inputSchema: {
128
+ type: 'object',
129
+ properties: {
130
+ entityType: {
131
+ type: 'string',
132
+ description: 'OData entity type',
133
+ },
134
+ entityId: {
135
+ type: 'string',
136
+ description: 'Entity UUID to update',
137
+ },
138
+ data: {
139
+ type: 'object',
140
+ description: 'Updated entity data',
141
+ },
142
+ },
143
+ required: ['entityType', 'entityId', 'data'],
144
+ },
145
+ },
146
+ {
147
+ name: 'tribecrm_delete_entity',
148
+ description: 'Delete an entity from TribeCRM',
149
+ inputSchema: {
150
+ type: 'object',
151
+ properties: {
152
+ entityType: {
153
+ type: 'string',
154
+ description: 'OData entity type',
155
+ },
156
+ entityId: {
157
+ type: 'string',
158
+ description: 'Entity UUID to delete',
159
+ },
160
+ },
161
+ required: ['entityType', 'entityId'],
162
+ },
163
+ },
164
+ {
165
+ name: 'tribecrm_get_current_employee',
166
+ description: 'Get information about the currently authenticated employee',
167
+ inputSchema: {
168
+ type: 'object',
169
+ properties: {
170
+ expand: {
171
+ type: 'string',
172
+ description: 'Optional $expand parameter (e.g., "Person")',
173
+ },
174
+ },
175
+ },
176
+ },
177
+ ],
178
+ };
179
+ });
180
+ // Register call tool handler
181
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
182
+ try {
183
+ const { name, arguments: args } = request.params;
184
+ switch (name) {
185
+ case 'tribecrm_get_entity': {
186
+ const { entityType, entityId, expand, select } = args;
187
+ const entity = await client.getEntity(entityType, entityId, expand, select);
188
+ return {
189
+ content: [
190
+ {
191
+ type: 'text',
192
+ text: JSON.stringify(entity, null, 2),
193
+ },
194
+ ],
195
+ };
196
+ }
197
+ case 'tribecrm_query_entities': {
198
+ const { entityType, filter, select, expand, orderby, top, skip, count } = args;
199
+ const results = await client.queryEntities(entityType, {
200
+ filter,
201
+ select,
202
+ expand,
203
+ orderby,
204
+ top,
205
+ skip,
206
+ count,
207
+ });
208
+ return {
209
+ content: [
210
+ {
211
+ type: 'text',
212
+ text: JSON.stringify(results, null, 2),
213
+ },
214
+ ],
215
+ };
216
+ }
217
+ case 'tribecrm_create_entity': {
218
+ const { entityType, data } = args;
219
+ const entity = await client.createEntity(entityType, data);
220
+ return {
221
+ content: [
222
+ {
223
+ type: 'text',
224
+ text: `Entity created successfully:\\n${JSON.stringify(entity, null, 2)}`,
225
+ },
226
+ ],
227
+ };
228
+ }
229
+ case 'tribecrm_update_entity': {
230
+ const { entityType, entityId, data } = args;
231
+ const entity = await client.updateEntity(entityType, entityId, data);
232
+ return {
233
+ content: [
234
+ {
235
+ type: 'text',
236
+ text: `Entity updated successfully:\\n${JSON.stringify(entity, null, 2)}`,
237
+ },
238
+ ],
239
+ };
240
+ }
241
+ case 'tribecrm_delete_entity': {
242
+ const { entityType, entityId } = args;
243
+ await client.deleteEntity(entityType, entityId);
244
+ return {
245
+ content: [
246
+ {
247
+ type: 'text',
248
+ text: `Entity ${entityId} deleted successfully`,
249
+ },
250
+ ],
251
+ };
252
+ }
253
+ case 'tribecrm_get_current_employee': {
254
+ const { expand } = args;
255
+ const employee = await client.getCurrentEmployee(expand);
256
+ return {
257
+ content: [
258
+ {
259
+ type: 'text',
260
+ text: JSON.stringify(employee, null, 2),
261
+ },
262
+ ],
263
+ };
264
+ }
265
+ default:
266
+ throw new Error(`Unknown tool: ${name}`);
267
+ }
268
+ }
269
+ catch (error) {
270
+ return {
271
+ content: [
272
+ {
273
+ type: 'text',
274
+ text: `Error: ${error.response?.data?.error?.message || error.message}`,
275
+ },
276
+ ],
277
+ isError: true,
278
+ };
279
+ }
280
+ });
281
+ // Register resource handlers
282
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
283
+ try {
284
+ const entityTypes = await client.listEntityTypes();
285
+ return {
286
+ resources: entityTypes.map((type) => ({
287
+ uri: `tribecrm://entity-types/${type.code}`,
288
+ name: type.name,
289
+ description: `Entity type: ${type.name}`,
290
+ mimeType: 'application/json',
291
+ })),
292
+ };
293
+ }
294
+ catch (error) {
295
+ console.error('Error listing resources:', error);
296
+ return { resources: [] };
297
+ }
298
+ });
299
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
300
+ const { uri } = request.params;
301
+ try {
302
+ if (uri.startsWith('tribecrm://entity-types/')) {
303
+ const entityTypeCode = uri.replace('tribecrm://entity-types/', '');
304
+ const entityTypes = await client.listEntityTypes();
305
+ const entityType = entityTypes.find((t) => t.code === entityTypeCode);
306
+ if (!entityType) {
307
+ throw new Error(`Entity type not found: ${entityTypeCode}`);
308
+ }
309
+ return {
310
+ contents: [
311
+ {
312
+ uri,
313
+ mimeType: 'application/json',
314
+ text: JSON.stringify(entityType, null, 2),
315
+ },
316
+ ],
317
+ };
318
+ }
319
+ throw new Error(`Unknown resource URI: ${uri}`);
320
+ }
321
+ catch (error) {
322
+ throw new Error(`Error reading resource: ${error.message}`);
323
+ }
324
+ });
325
+ // Start server
326
+ async function main() {
327
+ const transport = new StdioServerTransport();
328
+ await server.connect(transport);
329
+ console.error('TribeCRM MCP Server v0.2.0 running on stdio');
330
+ console.error('Connected to:', config.apiUrl);
331
+ }
332
+ main().catch((error) => {
333
+ console.error('Server error:', error);
334
+ process.exit(1);
335
+ });
336
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,6BAA6B;AAC7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,yBAAyB;AACzB,MAAM,MAAM,GAAmB;IAC7B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,yBAAyB;IACjE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE;IAC9C,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE;IACtD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB;CACrD,CAAC;AAEF,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC/D,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,OAAO,CAAC,KAAK,CAAC,yFAAyF,CAAC,CAAC;IACzG,OAAO,CAAC,I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,GAAG;wBACH,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC1C;iBACF;aACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC7D,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ export interface TribeCRMConfig {
2
+ apiUrl: string;
3
+ clientId: string;
4
+ clientSecret: string;
5
+ organizationId?: string;
6
+ }
7
+ export interface AuthToken {
8
+ access_token: string;
9
+ token_type: string;
10
+ expires_in: number;
11
+ scope: string;
12
+ }
13
+ export interface Entity {
14
+ id: string;
15
+ type: string;
16
+ [key: string]: any;
17
+ }
18
+ export interface EntityType {
19
+ code: string;
20
+ name: string;
21
+ fields: EntityField[];
22
+ }
23
+ export interface EntityField {
24
+ code: string;
25
+ name: string;
26
+ type: string;
27
+ required: boolean;
28
+ }
29
+ export interface SearchResult {
30
+ items: Entity[];
31
+ totalCount: number;
32
+ page: number;
33
+ pageSize: number;
34
+ }
35
+ export interface Connector {
36
+ id: string;
37
+ code: string;
38
+ name: string;
39
+ type: string;
40
+ enabled: boolean;
41
+ }
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@efficy/tribecrm-mcp-server",
3
+ "version": "0.2.0",
4
+ "description": "Model Context Protocol server for TribeCRM API - enables AI assistants to interact with TribeCRM",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "tribecrm-mcp-server": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsc --watch",
18
+ "start": "node dist/index.js",
19
+ "prepare": "npm run build",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "mcp",
24
+ "model-context-protocol",
25
+ "tribecrm",
26
+ "api",
27
+ "crm",
28
+ "odata",
29
+ "claude",
30
+ "ai",
31
+ "llm"
32
+ ],
33
+ "author": "Johann Norsa <johann.norsa@efficy.com>",
34
+ "license": "MIT",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/efficy-sa/tribecrm-mcp-server.git"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/efficy-sa/tribecrm-mcp-server/issues"
41
+ },
42
+ "homepage": "https://github.com/efficy-sa/tribecrm-mcp-server#readme",
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "dependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.0.4",
51
+ "axios": "^1.7.9",
52
+ "dotenv": "^16.4.7"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^22.10.5",
56
+ "typescript": "^5.7.3"
57
+ }
58
+ }