@promptpartner/bexio-mcp-server 2.0.0 → 2.0.2

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.
@@ -0,0 +1,186 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Bexio Dashboard</title>
7
+ <style>
8
+ * {
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+ body {
14
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
15
+ line-height: 1.5;
16
+ color: #1a1a1a;
17
+ background: #f3f4f6;
18
+ padding: 1.5rem;
19
+ }
20
+ .dashboard {
21
+ max-width: 900px;
22
+ margin: 0 auto;
23
+ }
24
+ .header {
25
+ margin-bottom: 1.5rem;
26
+ }
27
+ .header h1 {
28
+ font-size: 1.5rem;
29
+ font-weight: 600;
30
+ color: #111827;
31
+ }
32
+ .header .subtitle {
33
+ color: #6b7280;
34
+ font-size: 0.875rem;
35
+ }
36
+ .grid {
37
+ display: grid;
38
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
39
+ gap: 1rem;
40
+ }
41
+ .card {
42
+ background: #fff;
43
+ border-radius: 0.75rem;
44
+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
45
+ padding: 1.25rem;
46
+ }
47
+ .card-header {
48
+ display: flex;
49
+ align-items: center;
50
+ margin-bottom: 0.75rem;
51
+ }
52
+ .card-icon {
53
+ width: 40px;
54
+ height: 40px;
55
+ border-radius: 0.5rem;
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ margin-right: 0.75rem;
60
+ }
61
+ .card-icon svg {
62
+ width: 24px;
63
+ height: 24px;
64
+ }
65
+ .card-icon.blue { background: #dbeafe; color: #2563eb; }
66
+ .card-icon.yellow { background: #fef3c7; color: #d97706; }
67
+ .card-icon.green { background: #d1fae5; color: #059669; }
68
+ .card-title {
69
+ font-size: 0.875rem;
70
+ font-weight: 500;
71
+ color: #6b7280;
72
+ }
73
+ .card-value {
74
+ font-size: 2rem;
75
+ font-weight: 700;
76
+ color: #111827;
77
+ margin-bottom: 0.25rem;
78
+ }
79
+ .card-subtitle {
80
+ font-size: 0.875rem;
81
+ color: #6b7280;
82
+ }
83
+ .contacts-list {
84
+ margin-top: 0.5rem;
85
+ }
86
+ .contact-item {
87
+ display: flex;
88
+ align-items: center;
89
+ padding: 0.5rem 0;
90
+ border-bottom: 1px solid #f3f4f6;
91
+ }
92
+ .contact-item:last-child {
93
+ border-bottom: none;
94
+ }
95
+ .contact-avatar {
96
+ width: 32px;
97
+ height: 32px;
98
+ border-radius: 50%;
99
+ background: #e5e7eb;
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ font-size: 0.75rem;
104
+ font-weight: 600;
105
+ color: #6b7280;
106
+ margin-right: 0.75rem;
107
+ }
108
+ .contact-name {
109
+ font-size: 0.875rem;
110
+ color: #374151;
111
+ }
112
+ .loading {
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ min-height: 200px;
117
+ color: #6b7280;
118
+ }
119
+ .empty-state {
120
+ text-align: center;
121
+ color: #6b7280;
122
+ padding: 1rem;
123
+ font-size: 0.875rem;
124
+ }
125
+ </style>
126
+ <script type="module" crossorigin>import{g as r}from"./app-CW49uSHM.js";const t=document.getElementById("app"),o=new r({name:"Bexio Dashboard",version:"1.0.0"});o.ontoolresult=e=>{var n,s;const a=(s=(n=e.content)==null?void 0:n.find(i=>i.type==="text"))==null?void 0:s.text;if(a)try{const i=JSON.parse(a);l(i)}catch{t.innerHTML='<div class="loading">Error parsing dashboard data</div>'}};o.connect();function c(e,a){return`${a} ${e.toLocaleString("de-CH",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function d(e,a){return[e,a].filter(Boolean).map(s=>s.charAt(0).toUpperCase()).join("").slice(0,2)||"?"}function l(e){t.className="dashboard",t.innerHTML=`
127
+ <div class="header">
128
+ <h1>Bexio Dashboard</h1>
129
+ <p class="subtitle">Overview of your invoices and recent contacts</p>
130
+ </div>
131
+
132
+ <div class="grid">
133
+ <div class="card">
134
+ <div class="card-header">
135
+ <div class="card-icon blue">
136
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
137
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
138
+ </svg>
139
+ </div>
140
+ <span class="card-title">Open Invoices</span>
141
+ </div>
142
+ <div class="card-value">${e.open_invoices_count}</div>
143
+ <div class="card-subtitle">${c(e.open_invoices_total,e.currency)} total</div>
144
+ </div>
145
+
146
+ <div class="card">
147
+ <div class="card-header">
148
+ <div class="card-icon yellow">
149
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
150
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
151
+ </svg>
152
+ </div>
153
+ <span class="card-title">Overdue</span>
154
+ </div>
155
+ <div class="card-value">${e.overdue_count}</div>
156
+ <div class="card-subtitle">${c(e.overdue_total,e.currency)} outstanding</div>
157
+ </div>
158
+
159
+ <div class="card">
160
+ <div class="card-header">
161
+ <div class="card-icon green">
162
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
163
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
164
+ </svg>
165
+ </div>
166
+ <span class="card-title">Recent Contacts</span>
167
+ </div>
168
+ <div class="contacts-list">
169
+ ${e.recent_contacts.length>0?e.recent_contacts.slice(0,5).map(a=>`
170
+ <div class="contact-item">
171
+ <div class="contact-avatar">${d(a.name_1,a.name_2)}</div>
172
+ <span class="contact-name">${[a.name_1,a.name_2].filter(Boolean).join(" ")}</span>
173
+ </div>
174
+ `).join(""):`
175
+ <div class="empty-state">No recent contacts</div>
176
+ `}
177
+ </div>
178
+ </div>
179
+ </div>
180
+ `}</script>
181
+ <link rel="modulepreload" crossorigin href="../../app-CW49uSHM.js">
182
+ </head>
183
+ <body>
184
+ <div id="app" class="loading">Loading dashboard...</div>
185
+ </body>
186
+ </html>
@@ -0,0 +1,196 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Invoice Preview</title>
7
+ <style>
8
+ * {
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+ body {
14
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
15
+ line-height: 1.5;
16
+ color: #1a1a1a;
17
+ background: #fff;
18
+ padding: 1.5rem;
19
+ }
20
+ .invoice {
21
+ max-width: 800px;
22
+ margin: 0 auto;
23
+ }
24
+ .header {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ align-items: flex-start;
28
+ margin-bottom: 2rem;
29
+ padding-bottom: 1.5rem;
30
+ border-bottom: 2px solid #e5e7eb;
31
+ }
32
+ .header-left h1 {
33
+ font-size: 1.75rem;
34
+ font-weight: 600;
35
+ color: #111827;
36
+ margin-bottom: 0.25rem;
37
+ }
38
+ .header-left .title {
39
+ color: #6b7280;
40
+ font-size: 0.95rem;
41
+ }
42
+ .header-right {
43
+ text-align: right;
44
+ }
45
+ .header-right .dates {
46
+ font-size: 0.875rem;
47
+ color: #6b7280;
48
+ }
49
+ .status-badge {
50
+ display: inline-block;
51
+ padding: 0.25rem 0.75rem;
52
+ border-radius: 9999px;
53
+ font-size: 0.75rem;
54
+ font-weight: 600;
55
+ text-transform: uppercase;
56
+ margin-top: 0.5rem;
57
+ }
58
+ .status-draft { background: #e5e7eb; color: #374151; }
59
+ .status-pending { background: #fef3c7; color: #92400e; }
60
+ .status-sent { background: #dbeafe; color: #1e40af; }
61
+ .status-paid { background: #d1fae5; color: #065f46; }
62
+ .status-overdue { background: #fee2e2; color: #991b1b; }
63
+ .status-cancelled { background: #f3f4f6; color: #6b7280; }
64
+ .contact-section {
65
+ background: #f9fafb;
66
+ padding: 1rem 1.25rem;
67
+ border-radius: 0.5rem;
68
+ margin-bottom: 1.5rem;
69
+ }
70
+ .contact-section h2 {
71
+ font-size: 0.75rem;
72
+ font-weight: 600;
73
+ text-transform: uppercase;
74
+ color: #6b7280;
75
+ margin-bottom: 0.5rem;
76
+ }
77
+ .contact-section .name {
78
+ font-weight: 600;
79
+ color: #111827;
80
+ }
81
+ .contact-section .email {
82
+ color: #6b7280;
83
+ font-size: 0.875rem;
84
+ }
85
+ .line-items {
86
+ width: 100%;
87
+ border-collapse: collapse;
88
+ margin-bottom: 1.5rem;
89
+ }
90
+ .line-items th {
91
+ text-align: left;
92
+ padding: 0.75rem 1rem;
93
+ font-size: 0.75rem;
94
+ font-weight: 600;
95
+ text-transform: uppercase;
96
+ color: #6b7280;
97
+ background: #f9fafb;
98
+ border-bottom: 1px solid #e5e7eb;
99
+ }
100
+ .line-items th:last-child,
101
+ .line-items td:last-child {
102
+ text-align: right;
103
+ }
104
+ .line-items td {
105
+ padding: 0.75rem 1rem;
106
+ border-bottom: 1px solid #f3f4f6;
107
+ }
108
+ .total-section {
109
+ display: flex;
110
+ justify-content: flex-end;
111
+ padding-top: 1rem;
112
+ border-top: 2px solid #e5e7eb;
113
+ }
114
+ .total-row {
115
+ display: flex;
116
+ justify-content: space-between;
117
+ min-width: 200px;
118
+ }
119
+ .total-label {
120
+ font-weight: 600;
121
+ color: #374151;
122
+ }
123
+ .total-amount {
124
+ font-size: 1.25rem;
125
+ font-weight: 700;
126
+ color: #111827;
127
+ }
128
+ .loading {
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ min-height: 200px;
133
+ color: #6b7280;
134
+ }
135
+ </style>
136
+ <script type="module" crossorigin>import{g as o}from"./app-CW49uSHM.js";const r=document.getElementById("app"),i=new o({name:"Invoice Preview",version:"1.0.0"});i.ontoolresult=t=>{var e,n;const a=(n=(e=t.content)==null?void 0:e.find(s=>s.type==="text"))==null?void 0:n.text;if(a)try{const s=JSON.parse(a);m(s)}catch{r.innerHTML='<div class="loading">Error parsing invoice data</div>'}};i.connect();function u(t){switch(t){case 7:return{label:"Draft",className:"status-draft"};case 8:return{label:"Pending",className:"status-pending"};case 9:return{label:"Sent",className:"status-sent"};case 16:return{label:"Paid",className:"status-paid"};case 17:return{label:"Overdue",className:"status-overdue"};case 19:return{label:"Cancelled",className:"status-cancelled"};default:return{label:`Status ${t}`,className:"status-draft"}}}function c(t,a){const e=typeof t=="string"?parseFloat(t):t;return`${a===1?"CHF":a===2?"EUR":"USD"} ${e.toFixed(2)}`}function d(t){return t?new Date(t).toLocaleDateString("de-CH",{day:"2-digit",month:"2-digit",year:"numeric"}):""}function m(t){var n,s;const a=u(t.kb_item_status_id),e=t.positions||[];r.className="invoice",r.innerHTML=`
137
+ <div class="header">
138
+ <div class="header-left">
139
+ <h1>Invoice ${t.document_nr}</h1>
140
+ <p class="title">${t.title||""}</p>
141
+ </div>
142
+ <div class="header-right">
143
+ <div class="dates">
144
+ <div>Issue: ${d(t.is_valid_from)}</div>
145
+ <div>Due: ${d(t.is_valid_to)}</div>
146
+ </div>
147
+ <span class="status-badge ${a.className}">${a.label}</span>
148
+ </div>
149
+ </div>
150
+
151
+ <div class="contact-section">
152
+ <h2>Bill To</h2>
153
+ <div class="name">${((n=t.contact_address)==null?void 0:n.split(`
154
+ `)[0])||`Contact #${t.contact_id}`}</div>
155
+ <div class="email">${((s=t.contact_address)==null?void 0:s.split(`
156
+ `).slice(1).join(", "))||""}</div>
157
+ </div>
158
+
159
+ <table class="line-items">
160
+ <thead>
161
+ <tr>
162
+ <th>Description</th>
163
+ <th>Qty</th>
164
+ <th>Price</th>
165
+ <th>Amount</th>
166
+ </tr>
167
+ </thead>
168
+ <tbody>
169
+ ${e.length>0?e.map(l=>`
170
+ <tr>
171
+ <td>${l.text}</td>
172
+ <td>${l.amount}</td>
173
+ <td>${c(l.unit_price,t.currency_id)}</td>
174
+ <td>${c(l.amount*l.unit_price*(1-(l.discount_in_percent||0)/100),t.currency_id)}</td>
175
+ </tr>
176
+ `).join(""):`
177
+ <tr>
178
+ <td colspan="4" style="text-align: center; color: #6b7280;">No line items available</td>
179
+ </tr>
180
+ `}
181
+ </tbody>
182
+ </table>
183
+
184
+ <div class="total-section">
185
+ <div class="total-row">
186
+ <span class="total-label">Total:</span>
187
+ <span class="total-amount">${c(t.total_gross,t.currency_id)}</span>
188
+ </div>
189
+ </div>
190
+ `}</script>
191
+ <link rel="modulepreload" crossorigin href="../../app-CW49uSHM.js">
192
+ </head>
193
+ <body>
194
+ <div id="app" class="loading">Loading invoice...</div>
195
+ </body>
196
+ </html>
@@ -22,8 +22,8 @@ const DASHBOARD_URI = "ui://bexio/dashboard.html";
22
22
  * @param client - BexioClient for API calls
23
23
  */
24
24
  export function registerUIResources(server, client) {
25
- // Path to built UI files (vite outputs to dist/ui/ui/<name>/<name>.html)
26
- const uiBasePath = path.join(import.meta.dirname, "../dist/ui/ui");
25
+ // Path to built UI files (vite outputs to src/dist/ui/ui/<name>/<name>.html)
26
+ const uiBasePath = path.join(import.meta.dirname, "ui/ui");
27
27
  // ===== INVOICE PREVIEW =====
28
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
29
  registerAppTool(server, "preview_invoice", {
@@ -30,7 +30,7 @@ export default defineConfig({
30
30
  root: ".",
31
31
  base: "./",
32
32
  build: {
33
- outDir: "../dist/ui",
33
+ outDir: "./dist/ui",
34
34
  emptyOutDir: true,
35
35
  // Inline all assets
36
36
  assetsInlineLimit: () => true,
package/package.json CHANGED
@@ -1,78 +1,78 @@
1
- {
2
- "name": "@promptpartner/bexio-mcp-server",
3
- "version": "2.0.0",
4
- "description": "Model Context Protocol server for Bexio API integration",
5
- "main": "dist/index.js",
6
- "type": "module",
7
- "bin": {
8
- "bexio-mcp-server": "dist/index.js"
9
- },
10
- "files": [
11
- "dist",
12
- "README.md",
13
- "LICENSE"
14
- ],
15
- "scripts": {
16
- "build": "tsc && npm run build:ui",
17
- "build:ui": "node -e \"const fs=require('fs'); if(fs.existsSync('ui')){const{execSync}=require('child_process');execSync('npx vite build',{stdio:'inherit'})}else{console.log('Skipping UI build - ui/ not found')}\"",
18
- "dev": "tsx watch src/index.ts",
19
- "dev:ui": "vite build --watch",
20
- "start": "node dist/index.js",
21
- "test": "vitest",
22
- "type-check": "tsc --noEmit",
23
- "clean": "node -e \"const fs=require('fs'); if(fs.existsSync('dist')){fs.rmSync('dist',{recursive:true}); console.log('Cleaned dist/')}\"",
24
- "prebuild": "npm run clean",
25
- "pack:mcpb": "npm run build && npm run copy:bundle && cd .. && mcpb pack",
26
- "copy:bundle": "node -e \"const fs=require('fs'); const path=require('path'); function copyDir(src,dest){fs.mkdirSync(dest,{recursive:true});fs.readdirSync(src).forEach(f=>{const srcPath=path.join(src,f);const destPath=path.join(dest,f);fs.statSync(srcPath).isDirectory()?copyDir(srcPath,destPath):fs.copyFileSync(srcPath,destPath)})} const rootDist=path.join(__dirname,'..','dist'); if(fs.existsSync(rootDist))fs.rmSync(rootDist,{recursive:true}); copyDir('dist',rootDist); console.log('Copied dist/ to root for MCPB bundling')\"",
27
- "validate:mcpb": "cd .. && mcpb validate manifest.json",
28
- "prepublishOnly": "npm run build"
29
- },
30
- "author": {
31
- "name": "Lukas Hertig",
32
- "email": "lukas@promptpartner.ai"
33
- },
34
- "repository": {
35
- "type": "git",
36
- "url": "https://github.com/promptpartner/bexio-mcp-server.git"
37
- },
38
- "homepage": "https://github.com/promptpartner/bexio-mcp-server#readme",
39
- "bugs": {
40
- "url": "https://github.com/promptpartner/bexio-mcp-server/issues"
41
- },
42
- "keywords": [
43
- "mcp",
44
- "bexio",
45
- "api",
46
- "typescript",
47
- "model-context-protocol",
48
- "claude",
49
- "accounting",
50
- "invoices",
51
- "swiss"
52
- ],
53
- "license": "MIT",
54
- "dependencies": {
55
- "@modelcontextprotocol/sdk": "^1.25.2",
56
- "@modelcontextprotocol/ext-apps": "^1.0.1",
57
- "axios": "^1.7.0",
58
- "zod": "3.25.76",
59
- "dotenv": "^16.3.0",
60
- "fastify": "^4.28.0",
61
- "@fastify/cors": "^9.0.0"
62
- },
63
- "devDependencies": {
64
- "@types/node": "^20.8.0",
65
- "typescript": "^5.5.0",
66
- "tsx": "^4.0.0",
67
- "vitest": "^2.0.0",
68
- "vite": "^6.0.0",
69
- "vite-plugin-singlefile": "^2.3.0",
70
- "concurrently": "^8.0.0"
71
- },
72
- "engines": {
73
- "node": ">=18.0.0"
74
- },
75
- "publishConfig": {
76
- "access": "public"
77
- }
78
- }
1
+ {
2
+ "name": "@promptpartner/bexio-mcp-server",
3
+ "version": "2.0.2",
4
+ "description": "Model Context Protocol server for Bexio API integration",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "bexio-mcp-server": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc && npm run build:ui",
17
+ "build:ui": "node -e \"const fs=require('fs'); if(fs.existsSync('ui')){const{execSync}=require('child_process');execSync('npx vite build',{stdio:'inherit'})}else{console.log('Skipping UI build - ui/ not found')}\"",
18
+ "dev": "tsx watch src/index.ts",
19
+ "dev:ui": "vite build --watch",
20
+ "start": "node dist/index.js",
21
+ "test": "vitest",
22
+ "type-check": "tsc --noEmit",
23
+ "clean": "node -e \"const fs=require('fs'); if(fs.existsSync('dist')){fs.rmSync('dist',{recursive:true}); console.log('Cleaned dist/')}\"",
24
+ "prebuild": "npm run clean",
25
+ "pack:mcpb": "npm run build && npm run copy:bundle && cd .. && mcpb pack",
26
+ "copy:bundle": "node -e \"const fs=require('fs'); const path=require('path'); function copyDir(src,dest){fs.mkdirSync(dest,{recursive:true});fs.readdirSync(src).forEach(f=>{const srcPath=path.join(src,f);const destPath=path.join(dest,f);fs.statSync(srcPath).isDirectory()?copyDir(srcPath,destPath):fs.copyFileSync(srcPath,destPath)})} const rootDist=path.join(__dirname,'..','dist'); if(fs.existsSync(rootDist))fs.rmSync(rootDist,{recursive:true}); copyDir('dist',rootDist); console.log('Copied dist/ to root for MCPB bundling')\"",
27
+ "validate:mcpb": "cd .. && mcpb validate manifest.json",
28
+ "prepublishOnly": "npm run build"
29
+ },
30
+ "author": {
31
+ "name": "Lukas Hertig",
32
+ "email": "lukas@promptpartner.ai"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/promptpartner/bexio-mcp-server.git"
37
+ },
38
+ "homepage": "https://github.com/promptpartner/bexio-mcp-server#readme",
39
+ "bugs": {
40
+ "url": "https://github.com/promptpartner/bexio-mcp-server/issues"
41
+ },
42
+ "keywords": [
43
+ "mcp",
44
+ "bexio",
45
+ "api",
46
+ "typescript",
47
+ "model-context-protocol",
48
+ "claude",
49
+ "accounting",
50
+ "invoices",
51
+ "swiss"
52
+ ],
53
+ "license": "MIT",
54
+ "dependencies": {
55
+ "@modelcontextprotocol/sdk": "^1.25.2",
56
+ "@modelcontextprotocol/ext-apps": "^1.0.1",
57
+ "axios": "^1.7.0",
58
+ "zod": "3.25.76",
59
+ "dotenv": "^16.3.0",
60
+ "fastify": "^4.28.0",
61
+ "@fastify/cors": "^9.0.0"
62
+ },
63
+ "devDependencies": {
64
+ "@types/node": "^20.8.0",
65
+ "typescript": "^5.5.0",
66
+ "tsx": "^4.0.0",
67
+ "vitest": "^2.0.0",
68
+ "vite": "^6.0.0",
69
+ "vite-plugin-singlefile": "^2.3.0",
70
+ "concurrently": "^8.0.0"
71
+ },
72
+ "engines": {
73
+ "node": ">=18.0.0"
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ }
78
+ }
@@ -1 +0,0 @@
1
- export {};
@@ -1,108 +0,0 @@
1
- import { App } from "@modelcontextprotocol/ext-apps";
2
- const appEl = document.getElementById("app");
3
- const app = new App({ name: "Contact Card", version: "1.0.0" });
4
- app.ontoolresult = (result) => {
5
- const text = result.content?.find((c) => c.type === "text")?.text;
6
- if (text) {
7
- try {
8
- const contact = JSON.parse(text);
9
- renderContact(contact);
10
- }
11
- catch (e) {
12
- appEl.innerHTML = `<div class="loading">Error parsing contact data</div>`;
13
- }
14
- }
15
- };
16
- app.connect();
17
- function getInitials(name1, name2) {
18
- const parts = [name1, name2].filter(Boolean);
19
- return parts.map(p => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
20
- }
21
- function getCountryName(countryId) {
22
- const countries = {
23
- 1: "Switzerland",
24
- 2: "Germany",
25
- 3: "Austria",
26
- 4: "France",
27
- 5: "Italy",
28
- 6: "Liechtenstein",
29
- };
30
- return countryId ? countries[countryId] || `Country #${countryId}` : "";
31
- }
32
- function renderContact(contact) {
33
- const fullName = [contact.name_1, contact.name_2].filter(Boolean).join(" ");
34
- const initials = getInitials(contact.name_1, contact.name_2);
35
- const isCompany = contact.contact_type_id === 1;
36
- const typeBadge = isCompany ? "Company" : "Person";
37
- const typeClass = isCompany ? "type-company" : "type-person";
38
- const addressParts = [
39
- contact.address,
40
- [contact.postcode, contact.city].filter(Boolean).join(" "),
41
- getCountryName(contact.country_id),
42
- ].filter(Boolean);
43
- const hasContactInfo = contact.mail || contact.phone_fixed || contact.phone_mobile || contact.fax;
44
- const hasAddress = addressParts.length > 0;
45
- appEl.className = "card";
46
- appEl.innerHTML = `
47
- <div class="card-header">
48
- <div class="avatar">${initials}</div>
49
- <h1>${fullName}</h1>
50
- ${contact.url ? `<div class="company">${contact.url}</div>` : ""}
51
- <span class="type-badge ${typeClass}">${typeBadge}</span>
52
- </div>
53
- <div class="card-body">
54
- ${hasContactInfo ? `
55
- <div class="info-section">
56
- <div class="info-label">Contact Information</div>
57
- ${contact.mail ? `
58
- <div class="info-row">
59
- <svg class="info-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
60
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
61
- </svg>
62
- <span class="info-value"><a href="mailto:${contact.mail}">${contact.mail}</a></span>
63
- </div>
64
- ` : ""}
65
- ${contact.phone_fixed ? `
66
- <div class="info-row">
67
- <svg class="info-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
68
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"/>
69
- </svg>
70
- <span class="info-value"><a href="tel:${contact.phone_fixed}">${contact.phone_fixed}</a></span>
71
- </div>
72
- ` : ""}
73
- ${contact.phone_mobile ? `
74
- <div class="info-row">
75
- <svg class="info-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
76
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/>
77
- </svg>
78
- <span class="info-value"><a href="tel:${contact.phone_mobile}">${contact.phone_mobile}</a></span>
79
- </div>
80
- ` : ""}
81
- ${contact.fax ? `
82
- <div class="info-row">
83
- <svg class="info-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
84
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
85
- </svg>
86
- <span class="info-value">${contact.fax}</span>
87
- </div>
88
- ` : ""}
89
- </div>
90
- ` : ""}
91
-
92
- ${hasAddress ? `
93
- <div class="info-section">
94
- <div class="info-label">Address</div>
95
- <div class="address-block">
96
- ${addressParts.map(p => `<div>${p}</div>`).join("")}
97
- </div>
98
- </div>
99
- ` : ""}
100
-
101
- ${!hasContactInfo && !hasAddress ? `
102
- <div class="info-section" style="text-align: center; color: #6b7280;">
103
- No contact details available
104
- </div>
105
- ` : ""}
106
- </div>
107
- `;
108
- }
@@ -1 +0,0 @@
1
- export {};