vtiger-mcp 0.2.0 → 0.2.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,52 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is
4
+ based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
5
+ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.2.1] - 2026-07-13
8
+
9
+ ### Added
10
+ - Copy-paste **AI-agent install prompt** in the README — paste it into any
11
+ file-editing AI agent to install and configure vtiger-mcp automatically.
12
+ - **CLIENTS.md** — per-client setup for Claude Desktop/Code, Cursor,
13
+ Windsurf, Google Antigravity, VS Code (Copilot), OpenAI Codex CLI, Gemini
14
+ CLI, and any MCP client.
15
+ - README badges (npm version, license, node).
16
+
17
+ ### Changed
18
+ - Ship `CLIENTS.md` and `CHANGELOG.md` inside the published npm package.
19
+
20
+ ## [0.2.0] - 2026-07-13
21
+
22
+ ### Added
23
+ - **Configurable timesheet module.** The timesheet helpers default to
24
+ `TimeControl` but now work on any vtiger install without code changes,
25
+ via `VTIGER_TIMESHEET_MODULE`, `VTIGER_TASK_MODULE`,
26
+ `VTIGER_PROJECT_MODULE`, and optional `VTIGER_TS_*_FIELD` field-name
27
+ overrides (see `.env.example`).
28
+ - `CONTRIBUTING.md`, GitHub issue forms (bug / feature), and a PR template.
29
+
30
+ ### Notes
31
+ - No breaking changes — defaults are unchanged for existing users.
32
+ - The generic `create_record` / `update_record` / `query` /
33
+ `describe_module` tools work regardless of module names.
34
+
35
+ ## [0.1.0] - 2026-07-13
36
+
37
+ ### Added
38
+ - First public release.
39
+ - **MCP server** exposing vtiger CRM to AI agents, and a **CLI** over the
40
+ same core.
41
+ - Generic tools (per-user access): `list_modules`, `describe_module`,
42
+ `query` (VTQL), `retrieve_record`, `create_record`, `update_record`,
43
+ `delete_record`.
44
+ - Timesheet helpers: `whoami`, `list_my_projects`, `list_my_tasks`,
45
+ `log_timesheet`, `list_my_timesheets`, `update_timesheet`.
46
+ - Per-user authentication via each user's Webservice Access Key, so
47
+ vtiger's role/profile and row-level sharing are preserved.
48
+ - Deletes disabled by default (`VTIGER_ALLOW_DELETE=false`).
49
+
50
+ [0.2.1]: https://github.com/ViralP17/vtiger-mcp/releases/tag/v0.2.1
51
+ [0.2.0]: https://github.com/ViralP17/vtiger-mcp/releases/tag/v0.2.0
52
+ [0.1.0]: https://github.com/ViralP17/vtiger-mcp/releases/tag/v0.1.0
package/CLIENTS.md ADDED
@@ -0,0 +1,137 @@
1
+ # Connecting vtiger-mcp to your MCP client
2
+
3
+ vtiger-mcp is a standard **stdio MCP server**, so it works with *any*
4
+ MCP-compatible client. Most clients use the same JSON block — only the
5
+ **file location** (or add command) differs.
6
+
7
+ **The common block** (works in Claude Desktop, Claude Code, Cursor,
8
+ Windsurf, Antigravity, Gemini CLI, and more):
9
+
10
+ ```json
11
+ {
12
+ "mcpServers": {
13
+ "vtiger": {
14
+ "command": "npx",
15
+ "args": ["-y", "vtiger-mcp"],
16
+ "env": {
17
+ "VTIGER_URL": "https://yourcrmdomain.com",
18
+ "VTIGER_USERNAME": "your.username",
19
+ "VTIGER_ACCESS_KEY": "your-access-key",
20
+ "VTIGER_ALLOW_DELETE": "false"
21
+ }
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ Get your **Webservice Access Key** from the CRM: *My Preferences →
28
+ "Webservice Access Key"* (not your login password).
29
+
30
+ > **Windows note:** if a GUI app can't find `npx`, either install globally
31
+ > (`npm i -g vtiger-mcp`) and use `"command": "vtiger-mcp"`, or use
32
+ > `"command": "node"` with the absolute path to the installed server, e.g.
33
+ > `["C:\\Users\\you\\AppData\\Roaming\\npm\\node_modules\\vtiger-mcp\\dist\\mcp\\server.js"]`.
34
+
35
+ ---
36
+
37
+ ## Claude Desktop
38
+
39
+ Config file:
40
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
41
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
42
+
43
+ Paste the common block, then **fully quit and reopen** Claude Desktop.
44
+ Windows one-click alternative: run [`setup.ps1`](setup.ps1) (see
45
+ [SETUP.md](SETUP.md)).
46
+
47
+ ## Claude Code
48
+
49
+ Add it in one command:
50
+
51
+ ```bash
52
+ claude mcp add vtiger \
53
+ --env VTIGER_URL=https://yourcrmdomain.com \
54
+ --env VTIGER_USERNAME=your.username \
55
+ --env VTIGER_ACCESS_KEY=your-access-key \
56
+ -- npx -y vtiger-mcp
57
+ ```
58
+
59
+ …or add the common block to a project `.mcp.json`.
60
+
61
+ ## Cursor
62
+
63
+ Config file: `.cursor/mcp.json` (per-project) or `~/.cursor/mcp.json`
64
+ (global). Paste the common block, then enable **vtiger** in
65
+ *Settings → MCP*.
66
+
67
+ ## Windsurf (Codeium)
68
+
69
+ Config file: `~/.codeium/windsurf/mcp_config.json`. Paste the common block
70
+ and refresh MCP servers in the Cascade panel.
71
+
72
+ ## Google Antigravity
73
+
74
+ Open **Settings → MCP / Agent tools → Add MCP server** and paste the common
75
+ block (Antigravity uses the same `mcpServers` shape). If you prefer a file,
76
+ use its `mcp_config.json` with the same content. Reload the MCP servers
77
+ after saving.
78
+
79
+ ## VS Code (GitHub Copilot — Agent mode)
80
+
81
+ Config file: `.vscode/mcp.json` (workspace). VS Code uses a top-level
82
+ `servers` key and a `type`:
83
+
84
+ ```json
85
+ {
86
+ "servers": {
87
+ "vtiger": {
88
+ "type": "stdio",
89
+ "command": "npx",
90
+ "args": ["-y", "vtiger-mcp"],
91
+ "env": {
92
+ "VTIGER_URL": "https://yourcrmdomain.com",
93
+ "VTIGER_USERNAME": "your.username",
94
+ "VTIGER_ACCESS_KEY": "your-access-key"
95
+ }
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ Then open the Chat view in **Agent** mode and start the `vtiger` server.
102
+
103
+ ## OpenAI Codex CLI
104
+
105
+ Config file: `~/.codex/config.toml` (TOML):
106
+
107
+ ```toml
108
+ [mcp_servers.vtiger]
109
+ command = "npx"
110
+ args = ["-y", "vtiger-mcp"]
111
+ env = { VTIGER_URL = "https://yourcrmdomain.com", VTIGER_USERNAME = "your.username", VTIGER_ACCESS_KEY = "your-access-key", VTIGER_ALLOW_DELETE = "false" }
112
+ ```
113
+
114
+ ## Gemini CLI
115
+
116
+ Config file: `~/.gemini/settings.json` (global) or `.gemini/settings.json`
117
+ (project). Use the common `mcpServers` block. Or add via command:
118
+
119
+ ```bash
120
+ gemini mcp add vtiger npx -y vtiger-mcp
121
+ ```
122
+
123
+ (then set the `VTIGER_*` env vars in `settings.json`).
124
+
125
+ ## Any other MCP client
126
+
127
+ Point it at the stdio command **`npx -y vtiger-mcp`** and provide the three
128
+ `VTIGER_*` environment variables. That's all any MCP client needs.
129
+
130
+ ---
131
+
132
+ ### Verify it's connected
133
+
134
+ Ask the agent *"list my vtiger modules"* or *"show my timesheets this
135
+ week."* From a terminal you can sanity-check the same credentials with the
136
+ CLI: `npx -y vtiger-mcp` is the server, while `npm i -g vtiger-mcp` gives
137
+ you `vtiger whoami`, `vtiger describe TimeControl`, etc.
package/README.md CHANGED
@@ -1,197 +1,247 @@
1
- # vtiger-mcp
2
-
3
- **MCP server + CLI for [vtiger CRM](https://www.vtiger.com/).** Connect any
4
- AI agent (Claude Desktop, Claude Code, Cursor, …) to your vtiger CRM to
5
- **log timesheets** and **create / update records in any module** — in
6
- plain English.
7
-
8
- It talks to vtiger's built-in REST API (`/webservice.php`, available in
9
- vtiger 6.x / 7.x). It adds **no** access rules of its own: every call runs
10
- **as the authenticated user**, so vtiger enforces that user's role,
11
- profile, and row-level sharing automatically. Each person uses their own
12
- **Webservice Access Key**, so they only see and change what their account
13
- already allows.
14
-
15
- > New to the terminal? See **[SETUP.md](SETUP.md)** for a click-by-click,
16
- > non-developer guide.
17
-
18
- ---
19
-
20
- ## Features
21
-
22
- - 🔐 **Per-user auth** via each user's Webservice Access Key — row-level
23
- access preserved, nothing centralized.
24
- - 🧩 **Any module**: `create`, `update`, `query`, `describe`, `retrieve`,
25
- `delete` — subject to the user's permissions.
26
- - ⏱️ **Timesheet helpers** for the time-tracking module (create/list/update
27
- entries, resolve tasks by name).
28
- - 🖥️ Ships as both an **MCP server** (for AI agents) and a **CLI**.
29
- - 📦 Zero changes to your vtiger install. Node 18+, no native deps.
30
-
31
- ## Requirements
32
-
33
- - **Node.js 18+**
34
- - A vtiger CRM (6.x / 7.x) whose `/webservice.php` endpoint is reachable
35
- - Your **Webservice Access Key** — in the CRM: *My Preferences →
36
- "Webservice Access Key"* (a 16-char string; **not** your login password)
37
-
38
- ## Install
39
-
40
- ```bash
41
- # Global (gives you the `vtiger` CLI and the `vtiger-mcp` server binary)
42
- npm install -g vtiger-mcp
43
-
44
- # …or run without installing
45
- npx vtiger-mcp # starts the MCP server (stdio)
46
- ```
47
-
48
- Or from source:
49
-
50
- ```bash
51
- git clone https://github.com/ViralP17/vtiger-mcp.git
52
- cd vtiger-mcp
53
- npm install
54
- npm run build
55
- ```
56
-
57
- ## Configure
58
-
59
- Set three environment variables (via your MCP client config, or a `.env`
60
- file for the CLI — see [.env.example](.env.example)):
61
-
62
- | Variable | Example | Notes |
63
- |---|---|---|
64
- | `VTIGER_URL` | `https://yourcrmdomain.com` | Base URL, no `/webservice.php` |
65
- | `VTIGER_USERNAME` | `your.username` | Your vtiger login |
66
- | `VTIGER_ACCESS_KEY` | `xxxxxxxxxxxxxxxx` | Webservice Access Key |
67
- | `VTIGER_ALLOW_DELETE` | `false` | Set `true` to allow `delete` |
68
-
69
- ## Use as an MCP server
70
-
71
- Point your AI client at `vtiger-mcp` and pass your credentials in `env`.
72
-
73
- **Via npx (after `npm install -g vtiger-mcp` or letting npx fetch it):**
74
-
75
- ```json
76
- {
77
- "mcpServers": {
78
- "vtiger": {
79
- "command": "npx",
80
- "args": ["-y", "vtiger-mcp"],
81
- "env": {
82
- "VTIGER_URL": "https://yourcrmdomain.com",
83
- "VTIGER_USERNAME": "your.username",
84
- "VTIGER_ACCESS_KEY": "your-access-key",
85
- "VTIGER_ALLOW_DELETE": "false"
86
- }
87
- }
88
- }
89
- }
90
- ```
91
-
92
- **From a source checkout** (use `node` + the built server path):
93
-
94
- ```json
95
- {
96
- "mcpServers": {
97
- "vtiger": {
98
- "command": "node",
99
- "args": ["/path/to/vtiger-mcp/dist/mcp/server.js"],
100
- "env": { "VTIGER_URL": "https://yourcrmdomain.com", "VTIGER_USERNAME": "your.username", "VTIGER_ACCESS_KEY": "your-access-key" }
101
- }
102
- }
103
- }
104
- ```
105
-
106
- - **Claude Desktop** config: `%APPDATA%\Claude\claude_desktop_config.json`
107
- (Windows) / `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
108
- - **Cursor / Claude Code**: a `.mcp.json` with the same `mcpServers` shape
109
-
110
- Then just ask, e.g. *"Log 3 hours to the Website Redesign task today as
111
- regular hours"* or *"Show my timesheets this week."*
112
-
113
- ## Use as a CLI
114
-
115
- ```bash
116
- export VTIGER_URL=https://yourcrmdomain.com
117
- export VTIGER_USERNAME=your.username
118
- export VTIGER_ACCESS_KEY=your-access-key # or put these in a .env file
119
-
120
- vtiger whoami
121
- vtiger modules
122
- vtiger describe TimeControl
123
- vtiger query "SELECT tc_code, date_start, totaltime FROM TimeControl LIMIT 5;"
124
- vtiger log-timesheet --task "Website Redesign" --start 10:00 --end 13:00 --type "Regular Hours" --activity "API work"
125
- vtiger my-timesheets --from 2026-07-01 --to 2026-07-31
126
- vtiger create ProjectTask --set projecttaskname="Write docs" --set projectid=<id>
127
- vtiger update 17x1234 --set description="Revised notes"
128
- ```
129
-
130
- ## Tools exposed to the AI agent
131
-
132
- **Any module (scoped to your access):**
133
-
134
- | Tool | What it does |
135
- |---|---|
136
- | `list_modules` | Modules you can access |
137
- | `describe_module` | Live fields of a module (names, mandatory, picklists, references) |
138
- | `query` | Read-only VTQL `SELECT` |
139
- | `retrieve_record` | Fetch one record by id |
140
- | `create_record` | Create a record in any writable module |
141
- | `update_record` | Partial update of a record |
142
- | `delete_record` | Delete (only if `VTIGER_ALLOW_DELETE=true`) |
143
-
144
- **Timesheet helpers (the time-tracking module):**
145
-
146
- | Tool | What it does |
147
- |---|---|
148
- | `whoami` | Your vtiger user id / profile |
149
- | `list_my_projects` | Projects you can access |
150
- | `list_my_tasks` | Project tasks (for the `related_to` link) |
151
- | `log_timesheet` | Add a daily entry (resolves task, defaults date/owner, computes total) |
152
- | `list_my_timesheets` | Your entries in a date range |
153
- | `update_timesheet` | Edit an existing entry |
154
-
155
- ## Notes & tips
156
-
157
- - **Field names vary per install.** vtiger schemas are customizable, so
158
- always `describe_module` (or `vtiger describe <Module>`) first to learn
159
- the exact field names before creating/updating.
160
- - **Ids** are vtiger "webservice ids" like `17x1234`
161
- (`<moduleId>x<recordId>`). Reference fields (owner, `related_to`,
162
- `projectid`) expect these ids; the timesheet helpers resolve task names
163
- to ids for you.
164
- - **The timesheet module is configurable** (see below). It defaults to
165
- `TimeControl`; point it at your module without touching code.
166
- - **Deletes are off by default.** Set `VTIGER_ALLOW_DELETE=true` only if you
167
- want the agent/CLI to delete records (and your account has that right).
168
- - **Security.** Your access key is a secret — keep it in your local `.env`
169
- or client config only. Use HTTPS. Nothing is centralized; each user runs
170
- their own copy with their own key.
171
-
172
- ## Configuring the timesheet module (other vtiger installs)
173
-
174
- The timesheet helpers default to the `TimeControl` module with
175
- `ProjectTask`/`Project` links. If your install uses different module or
176
- field names, set these env vars (all optional) — no code changes needed:
177
-
178
- | Variable | Default | Purpose |
179
- |---|---|---|
180
- | `VTIGER_TIMESHEET_MODULE` | `TimeControl` | Time-entry module |
181
- | `VTIGER_TASK_MODULE` | `ProjectTask` | Module linked from an entry |
182
- | `VTIGER_PROJECT_MODULE` | `Project` | Project module |
183
-
184
- Advanced field-name overrides (rarely needed): `VTIGER_TS_DATE_START_FIELD`,
185
- `VTIGER_TS_DATE_END_FIELD`, `VTIGER_TS_TIME_START_FIELD`,
186
- `VTIGER_TS_TIME_END_FIELD`, `VTIGER_TS_RELATED_FIELD`, `VTIGER_TS_DESC_FIELD`,
187
- `VTIGER_TS_HOURSTYPE_FIELD`, `VTIGER_TS_TOTAL_FIELD`, `VTIGER_TS_OWNER_FIELD`,
188
- `VTIGER_TASK_NAME_FIELD`, `VTIGER_TASK_PROJECT_FIELD`,
189
- `VTIGER_PROJECT_NAME_FIELD`. See [.env.example](.env.example) for the full
190
- list and defaults.
191
-
192
- > Whatever your modules are named, the generic `create_record`,
193
- > `update_record`, `query`, and `describe_module` tools always work.
194
-
195
- ## License
196
-
197
- [MIT](LICENSE) © ViralP17
1
+ # vtiger-mcp
2
+
3
+ [![npm version](https://img.shields.io/npm/v/vtiger-mcp?color=cb3837&logo=npm)](https://www.npmjs.com/package/vtiger-mcp)
4
+ [![license: MIT](https://img.shields.io/npm/l/vtiger-mcp?color=blue)](LICENSE)
5
+ [![node](https://img.shields.io/node/v/vtiger-mcp)](https://nodejs.org)
6
+
7
+ **MCP server + CLI for [vtiger CRM](https://www.vtiger.com/).** Connect any
8
+ AI agent (Claude Desktop, Claude Code, Cursor, …) to your vtiger CRM to
9
+ **log timesheets** and **create / update records in any module** in
10
+ plain English.
11
+
12
+ It talks to vtiger's built-in REST API (`/webservice.php`, available in
13
+ vtiger 6.x / 7.x). It adds **no** access rules of its own: every call runs
14
+ **as the authenticated user**, so vtiger enforces that user's role,
15
+ profile, and row-level sharing automatically. Each person uses their own
16
+ **Webservice Access Key**, so they only see and change what their account
17
+ already allows.
18
+
19
+ > New to the terminal? See **[SETUP.md](SETUP.md)** for a click-by-click,
20
+ > non-developer guide.
21
+
22
+ ---
23
+
24
+ ## 🤖 Install with an AI agent (copy-paste prompt)
25
+
26
+ Don't want to edit config files yourself? Copy the whole prompt below and
27
+ paste it into an AI agent that can edit files (Claude Code, Cursor,
28
+ Windsurf, Gemini CLI, OpenAI Codex, VS Code Copilot Agent, ). It will ask
29
+ for your details and set everything up for you.
30
+
31
+ ```text
32
+ Install and configure the "vtiger-mcp" MCP server for me (npm package name: vtiger-mcp).
33
+ It lets me log vtiger CRM timesheets and create/update records in any module from this agent.
34
+
35
+ Do this:
36
+ 1. Verify Node.js 18+ is installed (run: node --version). If it's missing, tell me to install
37
+ the LTS from https://nodejs.org and stop.
38
+ 2. Ask me for these and WAIT for my answers:
39
+ - VTIGER_URL: my vtiger base URL, e.g. https://yourcrmdomain.com (no /webservice.php)
40
+ - VTIGER_USERNAME: my vtiger login username
41
+ - VTIGER_ACCESS_KEY: my "Webservice Access Key" from vtiger -> My Preferences (NOT my password)
42
+ 3. Detect which MCP client I use and find its config file:
43
+ - Claude Desktop: %APPDATA%\Claude\claude_desktop_config.json (Windows) or
44
+ ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
45
+ - Cursor: ~/.cursor/mcp.json ; Windsurf: ~/.codeium/windsurf/mcp_config.json ;
46
+ Gemini CLI: ~/.gemini/settings.json (all use the "mcpServers" JSON key)
47
+ - VS Code: ./.vscode/mcp.json (uses a top-level "servers" key with "type": "stdio")
48
+ - OpenAI Codex CLI: ~/.codex/config.toml (TOML table [mcp_servers.vtiger])
49
+ If you can't tell, ask me which client I'm using.
50
+ 4. Back up that file, then MERGE IN (do not overwrite my other servers) a server named "vtiger":
51
+ command: npx
52
+ args: ["-y", "vtiger-mcp"]
53
+ env: { VTIGER_URL, VTIGER_USERNAME, VTIGER_ACCESS_KEY, VTIGER_ALLOW_DELETE: "false" }
54
+ Use the correct shape for my client (mcpServers JSON, VS Code "servers", or Codex TOML).
55
+ 5. Keep my access key ONLY in this local config. Never commit it, echo it back in full, or share it.
56
+ 6. (Optional) Verify auth by running, with those env vars set: npx -p vtiger-mcp vtiger whoami
57
+ It should print my vtiger userId.
58
+ 7. Tell me to fully quit and reopen my client, then try: "list my vtiger modules"
59
+ or "log 2 hours to <task name> today".
60
+ ```
61
+
62
+ Prefer to do it manually? See **[CLIENTS.md](CLIENTS.md)** for every client's
63
+ exact config.
64
+
65
+ ---
66
+
67
+ ## Features
68
+
69
+ - 🔐 **Per-user auth** via each user's Webservice Access Key — row-level
70
+ access preserved, nothing centralized.
71
+ - 🧩 **Any module**: `create`, `update`, `query`, `describe`, `retrieve`,
72
+ `delete` — subject to the user's permissions.
73
+ - ⏱️ **Timesheet helpers** for the time-tracking module (create/list/update
74
+ entries, resolve tasks by name).
75
+ - 🖥️ Ships as both an **MCP server** (for AI agents) and a **CLI**.
76
+ - 📦 Zero changes to your vtiger install. Node 18+, no native deps.
77
+
78
+ ## Requirements
79
+
80
+ - **Node.js 18+**
81
+ - A vtiger CRM (6.x / 7.x) whose `/webservice.php` endpoint is reachable
82
+ - Your **Webservice Access Key** — in the CRM: *My Preferences →
83
+ "Webservice Access Key"* (a 16-char string; **not** your login password)
84
+
85
+ ## Install
86
+
87
+ ```bash
88
+ # Global (gives you the `vtiger` CLI and the `vtiger-mcp` server binary)
89
+ npm install -g vtiger-mcp
90
+
91
+ # …or run without installing
92
+ npx vtiger-mcp # starts the MCP server (stdio)
93
+ ```
94
+
95
+ Or from source:
96
+
97
+ ```bash
98
+ git clone https://github.com/ViralP17/vtiger-mcp.git
99
+ cd vtiger-mcp
100
+ npm install
101
+ npm run build
102
+ ```
103
+
104
+ ## Configure
105
+
106
+ Set three environment variables (via your MCP client config, or a `.env`
107
+ file for the CLI — see [.env.example](.env.example)):
108
+
109
+ | Variable | Example | Notes |
110
+ |---|---|---|
111
+ | `VTIGER_URL` | `https://yourcrmdomain.com` | Base URL, no `/webservice.php` |
112
+ | `VTIGER_USERNAME` | `your.username` | Your vtiger login |
113
+ | `VTIGER_ACCESS_KEY` | `xxxxxxxxxxxxxxxx` | Webservice Access Key |
114
+ | `VTIGER_ALLOW_DELETE` | `false` | Set `true` to allow `delete` |
115
+
116
+ ## Use as an MCP server
117
+
118
+ Point your AI client at `vtiger-mcp` and pass your credentials in `env`.
119
+
120
+ **Via npx (after `npm install -g vtiger-mcp` or letting npx fetch it):**
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "vtiger": {
126
+ "command": "npx",
127
+ "args": ["-y", "vtiger-mcp"],
128
+ "env": {
129
+ "VTIGER_URL": "https://yourcrmdomain.com",
130
+ "VTIGER_USERNAME": "your.username",
131
+ "VTIGER_ACCESS_KEY": "your-access-key",
132
+ "VTIGER_ALLOW_DELETE": "false"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ **From a source checkout** (use `node` + the built server path):
140
+
141
+ ```json
142
+ {
143
+ "mcpServers": {
144
+ "vtiger": {
145
+ "command": "node",
146
+ "args": ["/path/to/vtiger-mcp/dist/mcp/server.js"],
147
+ "env": { "VTIGER_URL": "https://yourcrmdomain.com", "VTIGER_USERNAME": "your.username", "VTIGER_ACCESS_KEY": "your-access-key" }
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ - **Claude Desktop** config: `%APPDATA%\Claude\claude_desktop_config.json`
154
+ (Windows) / `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
155
+
156
+ > 📎 **Using Cursor, VS Code, Windsurf, Antigravity, OpenAI Codex CLI,
157
+ > Gemini CLI, or another client?** See **[CLIENTS.md](CLIENTS.md)** for the
158
+ > exact config file and format for each — it's the same server everywhere.
159
+
160
+ Then just ask, e.g. *"Log 3 hours to the Website Redesign task today as
161
+ regular hours"* or *"Show my timesheets this week."*
162
+
163
+ ## Use as a CLI
164
+
165
+ ```bash
166
+ export VTIGER_URL=https://yourcrmdomain.com
167
+ export VTIGER_USERNAME=your.username
168
+ export VTIGER_ACCESS_KEY=your-access-key # or put these in a .env file
169
+
170
+ vtiger whoami
171
+ vtiger modules
172
+ vtiger describe TimeControl
173
+ vtiger query "SELECT tc_code, date_start, totaltime FROM TimeControl LIMIT 5;"
174
+ vtiger log-timesheet --task "Website Redesign" --start 10:00 --end 13:00 --type "Regular Hours" --activity "API work"
175
+ vtiger my-timesheets --from 2026-07-01 --to 2026-07-31
176
+ vtiger create ProjectTask --set projecttaskname="Write docs" --set projectid=<id>
177
+ vtiger update 17x1234 --set description="Revised notes"
178
+ ```
179
+
180
+ ## Tools exposed to the AI agent
181
+
182
+ **Any module (scoped to your access):**
183
+
184
+ | Tool | What it does |
185
+ |---|---|
186
+ | `list_modules` | Modules you can access |
187
+ | `describe_module` | Live fields of a module (names, mandatory, picklists, references) |
188
+ | `query` | Read-only VTQL `SELECT` |
189
+ | `retrieve_record` | Fetch one record by id |
190
+ | `create_record` | Create a record in any writable module |
191
+ | `update_record` | Partial update of a record |
192
+ | `delete_record` | Delete (only if `VTIGER_ALLOW_DELETE=true`) |
193
+
194
+ **Timesheet helpers (the time-tracking module):**
195
+
196
+ | Tool | What it does |
197
+ |---|---|
198
+ | `whoami` | Your vtiger user id / profile |
199
+ | `list_my_projects` | Projects you can access |
200
+ | `list_my_tasks` | Project tasks (for the `related_to` link) |
201
+ | `log_timesheet` | Add a daily entry (resolves task, defaults date/owner, computes total) |
202
+ | `list_my_timesheets` | Your entries in a date range |
203
+ | `update_timesheet` | Edit an existing entry |
204
+
205
+ ## Notes & tips
206
+
207
+ - **Field names vary per install.** vtiger schemas are customizable, so
208
+ always `describe_module` (or `vtiger describe <Module>`) first to learn
209
+ the exact field names before creating/updating.
210
+ - **Ids** are vtiger "webservice ids" like `17x1234`
211
+ (`<moduleId>x<recordId>`). Reference fields (owner, `related_to`,
212
+ `projectid`) expect these ids; the timesheet helpers resolve task names
213
+ to ids for you.
214
+ - **The timesheet module is configurable** (see below). It defaults to
215
+ `TimeControl`; point it at your module without touching code.
216
+ - **Deletes are off by default.** Set `VTIGER_ALLOW_DELETE=true` only if you
217
+ want the agent/CLI to delete records (and your account has that right).
218
+ - **Security.** Your access key is a secret — keep it in your local `.env`
219
+ or client config only. Use HTTPS. Nothing is centralized; each user runs
220
+ their own copy with their own key.
221
+
222
+ ## Configuring the timesheet module (other vtiger installs)
223
+
224
+ The timesheet helpers default to the `TimeControl` module with
225
+ `ProjectTask`/`Project` links. If your install uses different module or
226
+ field names, set these env vars (all optional) — no code changes needed:
227
+
228
+ | Variable | Default | Purpose |
229
+ |---|---|---|
230
+ | `VTIGER_TIMESHEET_MODULE` | `TimeControl` | Time-entry module |
231
+ | `VTIGER_TASK_MODULE` | `ProjectTask` | Module linked from an entry |
232
+ | `VTIGER_PROJECT_MODULE` | `Project` | Project module |
233
+
234
+ Advanced field-name overrides (rarely needed): `VTIGER_TS_DATE_START_FIELD`,
235
+ `VTIGER_TS_DATE_END_FIELD`, `VTIGER_TS_TIME_START_FIELD`,
236
+ `VTIGER_TS_TIME_END_FIELD`, `VTIGER_TS_RELATED_FIELD`, `VTIGER_TS_DESC_FIELD`,
237
+ `VTIGER_TS_HOURSTYPE_FIELD`, `VTIGER_TS_TOTAL_FIELD`, `VTIGER_TS_OWNER_FIELD`,
238
+ `VTIGER_TASK_NAME_FIELD`, `VTIGER_TASK_PROJECT_FIELD`,
239
+ `VTIGER_PROJECT_NAME_FIELD`. See [.env.example](.env.example) for the full
240
+ list and defaults.
241
+
242
+ > Whatever your modules are named, the generic `create_record`,
243
+ > `update_record`, `query`, and `describe_module` tools always work.
244
+
245
+ ## License
246
+
247
+ [MIT](LICENSE) © ViralP17
@@ -31,7 +31,7 @@ function fail(err) {
31
31
  const message = err instanceof Error ? err.message : String(err);
32
32
  return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
33
33
  }
34
- const server = new McpServer({ name: "vtiger-mcp", version: "0.2.0" });
34
+ const server = new McpServer({ name: "vtiger-mcp", version: "0.2.1" });
35
35
  /**
36
36
  * Register a tool with uniform error handling. `server.tool` is cast to
37
37
  * sidestep the SDK's heavily-overloaded typings; the runtime contract
package/package.json CHANGED
@@ -1,56 +1,58 @@
1
- {
2
- "name": "vtiger-mcp",
3
- "version": "0.2.0",
4
- "description": "MCP server + CLI for vtiger CRM — log timesheets and create/update records in any module via an AI agent, using each user's own webservice access key (row-level access preserved).",
5
- "type": "module",
6
- "bin": {
7
- "vtiger": "dist/cli/index.js",
8
- "vtiger-mcp": "dist/mcp/server.js"
9
- },
10
- "main": "dist/mcp/server.js",
11
- "files": [
12
- "dist",
13
- "examples",
14
- "SETUP.md"
15
- ],
16
- "scripts": {
17
- "build": "tsc",
18
- "watch": "tsc --watch",
19
- "mcp": "node dist/mcp/server.js",
20
- "cli": "node dist/cli/index.js",
21
- "typecheck": "tsc --noEmit",
22
- "prepublishOnly": "npm run build"
23
- },
24
- "engines": {
25
- "node": ">=18"
26
- },
27
- "keywords": [
28
- "vtiger",
29
- "vtiger-crm",
30
- "mcp",
31
- "model-context-protocol",
32
- "crm",
33
- "timesheet",
34
- "cli",
35
- "ai",
36
- "claude"
37
- ],
38
- "author": "ViralP17",
39
- "license": "MIT",
40
- "repository": {
41
- "type": "git",
42
- "url": "git+https://github.com/ViralP17/vtiger-mcp.git"
43
- },
44
- "homepage": "https://github.com/ViralP17/vtiger-mcp#readme",
45
- "bugs": {
46
- "url": "https://github.com/ViralP17/vtiger-mcp/issues"
47
- },
48
- "dependencies": {
49
- "@modelcontextprotocol/sdk": "^1.12.0",
50
- "zod": "^3.23.8"
51
- },
52
- "devDependencies": {
53
- "@types/node": "^22.0.0",
54
- "typescript": "^5.6.0"
55
- }
56
- }
1
+ {
2
+ "name": "vtiger-mcp",
3
+ "version": "0.2.1",
4
+ "description": "MCP server + CLI for vtiger CRM — log timesheets and create/update records in any module via an AI agent, using each user's own webservice access key (row-level access preserved).",
5
+ "type": "module",
6
+ "bin": {
7
+ "vtiger": "dist/cli/index.js",
8
+ "vtiger-mcp": "dist/mcp/server.js"
9
+ },
10
+ "main": "dist/mcp/server.js",
11
+ "files": [
12
+ "dist",
13
+ "examples",
14
+ "SETUP.md",
15
+ "CLIENTS.md",
16
+ "CHANGELOG.md"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "watch": "tsc --watch",
21
+ "mcp": "node dist/mcp/server.js",
22
+ "cli": "node dist/cli/index.js",
23
+ "typecheck": "tsc --noEmit",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "keywords": [
30
+ "vtiger",
31
+ "vtiger-crm",
32
+ "mcp",
33
+ "model-context-protocol",
34
+ "crm",
35
+ "timesheet",
36
+ "cli",
37
+ "ai",
38
+ "claude"
39
+ ],
40
+ "author": "ViralP17",
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/ViralP17/vtiger-mcp.git"
45
+ },
46
+ "homepage": "https://github.com/ViralP17/vtiger-mcp#readme",
47
+ "bugs": {
48
+ "url": "https://github.com/ViralP17/vtiger-mcp/issues"
49
+ },
50
+ "dependencies": {
51
+ "@modelcontextprotocol/sdk": "^1.12.0",
52
+ "zod": "^3.23.8"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^22.0.0",
56
+ "typescript": "^5.6.0"
57
+ }
58
+ }