@chill-sharp/ui-core 1.1.12 → 1.1.15

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 (69) hide show
  1. package/README.md +103 -103
  2. package/fesm2022/chill-sharp-ui-core.mjs +2446 -2446
  3. package/fesm2022/chill-sharp-ui-core.mjs.map +1 -1
  4. package/lib/lib/chill-form.component.d.ts +1 -1
  5. package/package.json +3 -3
  6. package/service-worker/chill-sharp-service-worker.js +166 -166
  7. package/styles/core-theme.scss +1235 -1235
  8. package/.agents/skills/chillsharp-current-user-preferences/SKILL.md +0 -70
  9. package/.agents/skills/chillsharp-ui-template/SKILL.md +0 -18
  10. package/doc/AIAssistedDevelopment/README.md +0 -185
  11. package/doc/AttachmentModel/README.md +0 -173
  12. package/doc/AuthenticationModel/README.md +0 -213
  13. package/doc/AuthenticationModel/how-to-integreate-auth-minimal-api.md +0 -293
  14. package/doc/ChillSharpClient.md +0 -464
  15. package/doc/ClientGeneration/README.md +0 -172
  16. package/doc/ComplianceGuide/README.md +0 -178
  17. package/doc/Configuration/README.md +0 -94
  18. package/doc/CurrentUserPreferences.md +0 -114
  19. package/doc/DateTimePolicy/README.md +0 -154
  20. package/doc/DateTimeSerialization.md +0 -423
  21. package/doc/Endpoints.md +0 -260
  22. package/doc/HowTo/01-simple-blog-sqlite.md +0 -153
  23. package/doc/HowTo/02-blog-schema-labels.md +0 -140
  24. package/doc/HowTo/03-authentication.md +0 -218
  25. package/doc/HowTo/04-blog-posts-one-to-many.md +0 -194
  26. package/doc/HowTo/05-docker-env-variables.md +0 -274
  27. package/doc/HowTo/06-chunk-transactions-autocomplete.md +0 -196
  28. package/doc/Mcp/ChatGPT.md +0 -291
  29. package/doc/Mcp/README.md +0 -799
  30. package/doc/MenuGuide/README.md +0 -49
  31. package/doc/ModelPreparation.md +0 -255
  32. package/doc/PermissionModel/README.md +0 -277
  33. package/doc/README.md +0 -228
  34. package/doc/ReferenceExistence.md +0 -130
  35. package/doc/RegisterContext.md +0 -217
  36. package/doc/UiCore/CRUD.md +0 -170
  37. package/doc/UiCore/README.md +0 -13
  38. package/doc/ValidationModel/README.md +0 -117
  39. package/doc/it/AIAssistedDevelopment/README.md +0 -185
  40. package/doc/it/AttachmentModel/README.md +0 -173
  41. package/doc/it/AuthenticationModel/README.md +0 -171
  42. package/doc/it/AuthenticationModel/how-to-integreate-auth-minimal-api.md +0 -292
  43. package/doc/it/ChillSharpClient.md +0 -464
  44. package/doc/it/ClientGeneration/README.md +0 -152
  45. package/doc/it/ComplianceGuide/README.md +0 -178
  46. package/doc/it/Configuration/README.md +0 -94
  47. package/doc/it/CurrentUserPreferences.md +0 -114
  48. package/doc/it/DateTimePolicy/README.md +0 -154
  49. package/doc/it/DateTimeSerialization.md +0 -423
  50. package/doc/it/Endpoints.md +0 -260
  51. package/doc/it/HowTo/01-simple-blog-sqlite.md +0 -152
  52. package/doc/it/HowTo/02-blog-schema-labels.md +0 -139
  53. package/doc/it/HowTo/03-authentication.md +0 -221
  54. package/doc/it/HowTo/04-blog-posts-one-to-many.md +0 -193
  55. package/doc/it/HowTo/05-docker-env-variables.md +0 -268
  56. package/doc/it/HowTo/06-chunk-transactions-autocomplete.md +0 -196
  57. package/doc/it/Mcp/ChatGPT.md +0 -291
  58. package/doc/it/Mcp/README.md +0 -799
  59. package/doc/it/MenuGuide/README.md +0 -49
  60. package/doc/it/ModelPreparation.md +0 -254
  61. package/doc/it/PermissionModel/README.md +0 -190
  62. package/doc/it/README.md +0 -172
  63. package/doc/it/ReferenceExistence.md +0 -130
  64. package/doc/it/RegisterContext.md +0 -218
  65. package/doc/it/UiCore/CRUD.md +0 -170
  66. package/doc/it/UiCore/README.md +0 -13
  67. package/doc/it/ValidationModel/README.md +0 -117
  68. package/template-customization/upgrade.ps1.template +0 -342
  69. package/template-customization/upgrade.sh.template +0 -271
@@ -1,291 +0,0 @@
1
- # HOW-TO: Connect ChillSharp MCP to ChatGPT
2
-
3
- Versione italiana: [Italiano](../it/Mcp/ChatGPT.md)
4
-
5
-
6
- This guide shows how to expose a protected ChillSharp MCP server over HTTPS and connect it from ChatGPT using the built-in ChillSharp OAuth flow.
7
-
8
- ## Goal
9
-
10
- Let ChatGPT connect to:
11
-
12
- ```text
13
- https://your-domain.example/api/chill-mcp
14
- ```
15
-
16
- and have every MCP request run under the same ChillSharp user, role, and permission limitations used by the normal bearer-authenticated API.
17
-
18
- ## Requirements
19
-
20
- - A public HTTPS domain that can reach your ASP.NET Core host
21
- - A `DbContext` that supports ChillSharp, schema metadata, and auth
22
- - ASP.NET Core Identity configured for your users
23
- - `ProtectedApi = true`
24
- - At least one MCP-enabled entity or query
25
-
26
- ChatGPT cannot connect directly to `localhost`. For local development, expose the app with a public HTTPS tunnel and use the public URL in ChatGPT.
27
-
28
- ## 1. Prepare the DbContext
29
-
30
- The context must support the normal ChillSharp model, schema metadata for MCP discovery, and auth tables for users, roles, permissions, and token sessions.
31
-
32
- ```csharp
33
- using ChillSharp;
34
- using ChillSharp.Auth;
35
- using ChillSharp.Schema;
36
- using Microsoft.AspNetCore.Identity;
37
- using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
38
- using Microsoft.EntityFrameworkCore;
39
-
40
- namespace MyApp;
41
-
42
- public class AppDbContext : IdentityDbContext<IdentityUser>, IChillContext, IChillAuthDbContext, IChillSchemaDbContext
43
- {
44
- public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
45
- {
46
- }
47
-
48
- public string GetChillTypePrefix() => "MyApp";
49
-
50
- public string GetPrimaryCultureName() => "en-US";
51
-
52
- public string GetSecondaryCultureName() => "it-IT";
53
-
54
- protected override void OnModelCreating(ModelBuilder modelBuilder)
55
- {
56
- base.OnModelCreating(modelBuilder);
57
- modelBuilder.AddChillAuthModel();
58
- modelBuilder.AddChillSchemaModel();
59
- }
60
- }
61
- ```
62
-
63
- If your app also uses i18n or attachments, keep those model registrations too.
64
-
65
- ## 2. Register Identity, bearer auth, ChillSharp, and MCP
66
-
67
- The Identity-backed `AddChillApi<TContext, TUser>()` registration enables the auth endpoints, the MCP module, and the OAuth endpoints that ChatGPT needs.
68
-
69
- ```csharp
70
- using ChillSharp.Api;
71
- using ChillSharp.Auth.Api;
72
- using Microsoft.AspNetCore.Identity;
73
- using Microsoft.EntityFrameworkCore;
74
-
75
- var builder = WebApplication.CreateBuilder(args);
76
-
77
- builder.Services.AddDbContext<AppDbContext>(options =>
78
- options.UseSqlite("Data Source=app.db"));
79
-
80
- builder.Services.AddIdentityCore<IdentityUser>()
81
- .AddEntityFrameworkStores<AppDbContext>()
82
- .AddSignInManager()
83
- .AddDefaultTokenProviders();
84
-
85
- builder.Services.AddAuthentication(ChillAuthIdentityDefaults.AuthenticationScheme)
86
- .AddChillAuthBearer();
87
-
88
- builder.Services.AddAuthorization();
89
-
90
- builder.Services.AddChillApi<AppDbContext, IdentityUser>(options =>
91
- {
92
- options.ProtectedApi = true;
93
-
94
- // Defaults shown explicitly for clarity.
95
- options.EnableMcpApi = true;
96
- options.EnableOAuthEndpoints = true;
97
- options.OAuthBasePath = "/api/chill-auth/oauth";
98
- options.OAuthProtectedResourcePath = "/api/chill-mcp";
99
- options.OAuthAuthorizationCodeLifetime = TimeSpan.FromMinutes(5);
100
- });
101
- ```
102
-
103
- ## 3. Map the API
104
-
105
- Authentication and authorization middleware must run before `MapChillApi()`.
106
-
107
- ```csharp
108
- var app = builder.Build();
109
-
110
- app.UseAuthentication();
111
- app.UseAuthorization();
112
-
113
- using (var scope = app.Services.CreateScope())
114
- {
115
- var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
116
- db.Database.EnsureCreated();
117
- }
118
-
119
- app.MapChillApi();
120
- app.Run();
121
- ```
122
-
123
- With the defaults, this exposes:
124
-
125
- | Purpose | URL |
126
- | --- | --- |
127
- | MCP server | `/api/chill-mcp` |
128
- | OAuth authorization metadata | `/.well-known/oauth-authorization-server` |
129
- | MCP protected-resource metadata | `/.well-known/oauth-protected-resource` |
130
- | Dynamic client registration | `/api/chill-auth/oauth/register` |
131
- | Authorization and consent page | `/api/chill-auth/oauth/authorize` |
132
- | Token endpoint | `/api/chill-auth/oauth/token` |
133
-
134
- ## 4. Create or bootstrap a user
135
-
136
- ChatGPT signs in through the ChillSharp OAuth authorization page using the same ASP.NET Core Identity users used by normal ChillSharp bearer authentication.
137
-
138
- For a first protected system, you can bootstrap a root user:
139
-
140
- ```csharp
141
- builder.Services.AddChillApi<AppDbContext, IdentityUser>(options =>
142
- {
143
- options.ProtectedApi = true;
144
- options.InitializeRootUserOnStartup = true;
145
- options.CreateChillAuthUserForRoot = true;
146
- options.RootUserName = "root";
147
- options.RootPassword = "Pass123$";
148
- options.RootEmail = "root@example.com";
149
- options.RootDisplayName = "Root Administrator";
150
- });
151
- ```
152
-
153
- When `CreateChillAuthUserForRoot = true`, ChillSharp also creates the linked `AuthUser` record used by permission checks.
154
-
155
- ## 5. Enable only safe MCP schemas
156
-
157
- ChatGPT can only see schemas that are MCP-enabled. Mark only the entities and queries that are safe and useful for AI access.
158
-
159
- ```csharp
160
- using ChillSharp.Annotations;
161
- using ChillSharp.EF;
162
-
163
- [ChillEntity(
164
- UniquePropertyKeyString: "4E16F6C0-6B95-4D67-98BC-9F4D0D63EAF1",
165
- PrimaryLanguageLabel: "Invoice",
166
- SecondaryLanguageLabel: "Fattura",
167
- EnableMCP = true,
168
- MCPDescription = "Customer invoice header. Use it to inspect invoice identity, customer, dates, totals, and payment state.")]
169
- public class Invoice : ChillEntity
170
- {
171
- [ChillProperty(
172
- UniquePropertyKeyString: "50B1BB6C-D794-41E4-A85C-D4F9D7A6FA7E",
173
- PrimaryLanguageLabel: "Invoice number",
174
- SecondaryLanguageLabel: "Numero fattura",
175
- MCPDescription = "Human-readable invoice number used by accountants and customers.")]
176
- public string InvoiceNumber { get; set; } = string.Empty;
177
- }
178
- ```
179
-
180
- Use clear `MCPDescription` text on entities, queries, and properties. ChatGPT relies heavily on those descriptions when choosing tools and building query payloads.
181
-
182
- ChatGPT should not invent ChillSharp request objects. The intended workflow is:
183
-
184
- 1. call `ChillSharp get-schema-list`
185
- 2. call `ChillSharp get-schema` for the entity or query
186
- 3. use exact schema property names in `Properties`
187
- 4. match values to each property's `simplePropertyType`
188
-
189
- For example, use JSON strings for `string`, JSON numbers for `int` and `decimal`, JSON booleans for `bool`, and `ChillDtoEntity` references with `ChillType` and `Guid` for `chill-entity` properties. For `ResultProperties`, use objects such as `{ "name": "InvoiceNumber" }` from the returned entity schema.
190
-
191
- For query properties, ChatGPT should read each property's `MCPDescription` to infer the search behavior. If a query property has no description, or the description does not explain matching behavior, assume exact-match equals. Every Chill query also accepts `Properties.FullTextSearch`; use it for broad keyword search when the user is not asking for a specific structured filter.
192
-
193
- `Properties.FullTextSearch` searches against ChillSharp `FullTextContent`. Unquoted text without advanced selectors is normalized, split on whitespace, and AND-matched so every token must be present. Brackets plus standalone `and`/`or` operators outside quotes enable grouped boolean search, for example `[la and nazione] or roma`. Search the literal words `and` or `or` by wrapping them in matching quotes, for example `"and"`. Matching single or double quotes search one normalized phrase with word boundaries: `"la nazione"` matches `bla bla la nazione bla bla` but not `bla bla della nazione bla bla`. A leading or trailing `*` or `%` wildcard inside the quotes relaxes that side of the boundary, for example `"*la nazione"` or `"%la nazione"` can match `della nazione`, and `"la nazione*"` can match a suffix. If `*` or `%` appears in the middle of a quoted phrase, ChillSharp treats it as token separators and applies normal AND token matching.
194
-
195
- ## 6. Connect from ChatGPT
196
-
197
- In ChatGPT, add a custom connector or remote MCP server using your public HTTPS MCP URL:
198
-
199
- ```text
200
- https://your-domain.example/api/chill-mcp
201
- ```
202
-
203
- ChatGPT should discover the OAuth metadata, register itself as a public OAuth client, and open the ChillSharp authorization page.
204
-
205
- After the user signs in and consents:
206
-
207
- 1. ChatGPT receives an authorization code.
208
- 2. ChatGPT exchanges the code and PKCE verifier for a ChillSharp bearer access token.
209
- 3. ChatGPT calls the MCP endpoint with:
210
-
211
- ```http
212
- Authorization: Bearer <access-token>
213
- ```
214
-
215
- OAuth is only the consent and token-acquisition flow. The MCP endpoint still uses normal ChillSharp bearer authentication.
216
-
217
- ## Permission behavior
218
-
219
- OAuth users are not separate users.
220
-
221
- The OAuth flow authenticates an ASP.NET Core Identity user and issues the same ChillSharp bearer token type used by normal login. The token contains the same user identifier claims, so ChillSharp resolves the same `AuthUser.ExternalId` and applies the same roles, permission rules, schema permissions, and API limitations.
222
-
223
- That means:
224
-
225
- - a user blocked from a normal protected ChillSharp operation is also blocked through ChatGPT
226
- - a role-limited user keeps the same limitations through MCP
227
- - MCP visibility still requires `EnableMCP`; query visibility follows the related returned entity
228
- - OAuth scopes do not currently create a separate permission layer
229
-
230
- ## Useful public URLs to test
231
-
232
- Open these from outside your server network:
233
-
234
- ```text
235
- https://your-domain.example/.well-known/oauth-authorization-server
236
- https://your-domain.example/.well-known/oauth-protected-resource
237
- https://your-domain.example/api/chill-mcp
238
- ```
239
-
240
- The MCP URL should reject anonymous access when `ProtectedApi = true`, and the response should advertise OAuth protected-resource metadata in the `WWW-Authenticate` header.
241
-
242
- ## Troubleshooting
243
-
244
- ### ChatGPT cannot reach the server
245
-
246
- Verify that the MCP URL uses public HTTPS and is not a private network or `localhost` address.
247
-
248
- ### ChatGPT does not start OAuth
249
-
250
- Check:
251
-
252
- - `EnableOAuthEndpoints = true`
253
- - `ProtectedApi = true`
254
- - `AddChillAuthBearer()` is registered
255
- - `UseAuthentication()` and `UseAuthorization()` run before `MapChillApi()`
256
- - `/.well-known/oauth-authorization-server` is reachable over HTTPS
257
- - `/.well-known/oauth-protected-resource` is reachable over HTTPS
258
-
259
- ### Login succeeds but MCP actions are forbidden
260
-
261
- The Identity login succeeded, but the linked ChillSharp `AuthUser` or its roles do not allow the requested operation. Check `AuthUser.ExternalId`, role assignments, and permission rules.
262
-
263
- ### ChatGPT sees no useful schemas
264
-
265
- Check that the target entity or query is MCP-enabled and has useful descriptions:
266
-
267
- - `EnableMCP = true`
268
- - entity/query `MCPDescription`
269
- - property-level `MCPDescription`
270
- - focused query types for common AI workflows
271
-
272
- ### Multiple app instances lose OAuth registrations
273
-
274
- The built-in dynamic OAuth client registry is currently in memory. For multi-instance production or restart-stable registrations, persist OAuth client registrations in the auth database.
275
-
276
- ## Production checklist
277
-
278
- - Use HTTPS only
279
- - Keep `ProtectedApi = true`
280
- - Enable MCP only on safe schemas
281
- - Use focused query surfaces instead of exposing everything
282
- - Give ChatGPT a least-privilege user or role
283
- - Review mutating tools such as create, update, delete, and chunk
284
- - Persist OAuth client registrations if running more than one app instance
285
- - Keep access-token lifetimes short
286
-
287
- ## Related documents
288
-
289
- - [MCP module reference](README.md)
290
- - [Authentication how-to](../HowTo/03-authentication.md)
291
- - [Model preparation](../ModelPreparation.md)