projoflow-mcp-server 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/index.js +34 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -79,7 +79,26 @@ async function authenticate() {
79
79
  }
80
80
  console.error(`Raw projectIds response: ${JSON.stringify(projectIds)}`);
81
81
 
82
- authContext.accessible_project_ids = Array.isArray(projectIds) ? projectIds : [];
82
+ // Handle different return formats from Supabase RPC:
83
+ // - Direct array: ["uuid1", "uuid2"]
84
+ // - Wrapped: [{"get_client_project_ids": ["uuid1"]}]
85
+ // - Single value: "uuid1"
86
+ // - Null: null
87
+ let parsedProjectIds = [];
88
+ if (Array.isArray(projectIds)) {
89
+ if (projectIds.length > 0 && typeof projectIds[0] === 'object' && projectIds[0].get_client_project_ids) {
90
+ // Wrapped format from SQL query
91
+ parsedProjectIds = projectIds[0].get_client_project_ids || [];
92
+ } else {
93
+ // Direct array format
94
+ parsedProjectIds = projectIds;
95
+ }
96
+ } else if (typeof projectIds === 'string') {
97
+ parsedProjectIds = [projectIds];
98
+ }
99
+
100
+ authContext.accessible_project_ids = parsedProjectIds;
101
+ console.error(`Parsed project IDs: ${JSON.stringify(parsedProjectIds)}`);
83
102
  console.error(`Authenticated as CLIENT via API key (${authContext.accessible_project_ids.length} projects accessible)`);
84
103
  } else {
85
104
  console.error(`Authenticated via API key for workspace ${authContext.workspace_id}`);
@@ -111,7 +130,20 @@ async function authenticate() {
111
130
  p_user_id: authContext.user_id,
112
131
  p_client_id: authContext.client_id
113
132
  });
114
- authContext.accessible_project_ids = projectIds || [];
133
+
134
+ // Handle different return formats (same as above)
135
+ let parsedProjectIds = [];
136
+ if (Array.isArray(projectIds)) {
137
+ if (projectIds.length > 0 && typeof projectIds[0] === 'object' && projectIds[0].get_client_project_ids) {
138
+ parsedProjectIds = projectIds[0].get_client_project_ids || [];
139
+ } else {
140
+ parsedProjectIds = projectIds;
141
+ }
142
+ } else if (typeof projectIds === 'string') {
143
+ parsedProjectIds = [projectIds];
144
+ }
145
+
146
+ authContext.accessible_project_ids = parsedProjectIds;
115
147
  console.error(`Authenticated as CLIENT via API key (${authContext.accessible_project_ids.length} projects accessible)`);
116
148
  } else {
117
149
  // Update last_used_at
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projoflow-mcp-server",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "MCP server for ProjoFlow project management - connect AI tools to your projects",
5
5
  "main": "index.js",
6
6
  "type": "module",