@idealyst/mcp-server 1.0.91 → 1.0.93

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/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import iconsData from "./data/icons.json" with { type: "json" };
11
11
  import { getComponentTypes, getThemeTypes, getNavigationTypes, getAvailableComponents, getComponentExamples, } from "./tools/get-types.js";
12
12
  const server = new Server({
13
13
  name: "@idealyst/mcp-server",
14
- version: "1.0.87",
14
+ version: "1.0.92",
15
15
  }, {
16
16
  capabilities: {
17
17
  tools: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/mcp-server",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "MCP server providing documentation and examples for the Idealyst framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -29,9 +29,9 @@
29
29
  "author": "Idealyst",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@idealyst/components": "^1.0.91",
33
- "@idealyst/navigation": "^1.0.91",
34
- "@idealyst/theme": "^1.0.91",
32
+ "@idealyst/components": "^1.0.93",
33
+ "@idealyst/navigation": "^1.0.93",
34
+ "@idealyst/theme": "^1.0.93",
35
35
  "@modelcontextprotocol/sdk": "^1.0.4"
36
36
  },
37
37
  "devDependencies": {
@@ -37,7 +37,7 @@ async function main() {
37
37
 
38
38
  // Create output structure
39
39
  const output = {
40
- version: '1.0.90',
40
+ version: '1.0.93',
41
41
  extractedAt: new Date().toISOString(),
42
42
  components,
43
43
  theme: themeTypes,
@@ -589,5 +589,308 @@ workspace/
589
589
  6. **Documentation**: Add README files to packages
590
590
  7. **Git**: Use conventional commits
591
591
  8. **Dependencies**: Share dependencies across packages when possible
592
+ `,
593
+
594
+ "idealyst://framework/api-overview": `# API Architecture Overview
595
+
596
+ Idealyst provides a dual API architecture with both tRPC and GraphQL, giving you flexibility for different use cases.
597
+
598
+ ## When to Use Each
599
+
600
+ ### tRPC (Type-Safe RPC)
601
+ - **Best for**: Internal clients, same-team consumption
602
+ - **Benefits**: End-to-end type safety, no code generation, fast development
603
+ - **Use when**: Your frontend and backend are TypeScript
604
+
605
+ ### GraphQL
606
+ - **Best for**: Public APIs, third-party integrations, mobile apps
607
+ - **Benefits**: Flexible queries, schema documentation, wide ecosystem
608
+ - **Use when**: You need schema introspection or have non-TypeScript clients
609
+
610
+ ## Architecture
611
+
612
+ Both APIs run on the same Express server:
613
+
614
+ \`\`\`
615
+ Server (port 3000)
616
+ ├── /trpc/* → tRPC handlers
617
+ ├── /graphql → GraphQL Yoga endpoint
618
+ └── Shared context (database, auth)
619
+ \`\`\`
620
+
621
+ ## File Structure
622
+
623
+ \`\`\`
624
+ packages/api/src/
625
+ ├── routers/ # tRPC routers
626
+ │ ├── index.ts # Root router
627
+ │ └── test.ts # Example router
628
+ ├── graphql/ # GraphQL setup
629
+ │ ├── builder.ts # Pothos schema builder
630
+ │ ├── index.ts # Yoga server setup
631
+ │ └── types/ # GraphQL type definitions
632
+ │ └── test.ts # Example types
633
+ ├── context.ts # Shared context
634
+ ├── server.ts # Express server
635
+ └── index.ts # Entry point
636
+ \`\`\`
637
+
638
+ ## Shared Context
639
+
640
+ Both APIs share the same context:
641
+
642
+ \`\`\`typescript
643
+ // context.ts
644
+ export interface Context {
645
+ db: PrismaClient;
646
+ // Add auth, session, etc.
647
+ }
648
+
649
+ export async function createContext(): Promise<Context> {
650
+ return {
651
+ db: prisma,
652
+ };
653
+ }
654
+ \`\`\`
655
+
656
+ ## Client Setup
657
+
658
+ The shared package provides clients for both:
659
+
660
+ \`\`\`typescript
661
+ // In your App component
662
+ import { createTRPCClient, createGraphQLClient } from '@your-app/shared';
663
+
664
+ // tRPC - automatic type inference
665
+ const trpcClient = createTRPCClient({ apiUrl: 'http://localhost:3000/trpc' });
666
+
667
+ // GraphQL - manual queries with graphql-request
668
+ createGraphQLClient({ apiUrl: 'http://localhost:3000/graphql' });
669
+ \`\`\`
670
+
671
+ ## Migration Path
672
+
673
+ Start with tRPC for rapid development, add GraphQL when you need:
674
+ - Public API documentation
675
+ - Third-party integrations
676
+ - Schema-first development
677
+ - Non-TypeScript clients
678
+ `,
679
+
680
+ "idealyst://framework/graphql-setup": `# GraphQL Setup Guide
681
+
682
+ Idealyst uses Pothos (code-first schema) with GraphQL Yoga server, integrated with Prisma.
683
+
684
+ ## Server Setup
685
+
686
+ ### 1. Schema Builder (builder.ts)
687
+
688
+ \`\`\`typescript
689
+ import SchemaBuilder from '@pothos/core';
690
+ import PrismaPlugin from '@pothos/plugin-prisma';
691
+ import type PrismaTypes from './generated';
692
+ import { prisma } from '@your-app/database';
693
+
694
+ export const builder = new SchemaBuilder<{
695
+ PrismaTypes: PrismaTypes;
696
+ Context: { db: typeof prisma };
697
+ }>({
698
+ plugins: [PrismaPlugin],
699
+ prisma: {
700
+ client: prisma,
701
+ },
702
+ });
703
+
704
+ // Initialize Query and Mutation types
705
+ builder.queryType({});
706
+ builder.mutationType({});
707
+ \`\`\`
708
+
709
+ ### 2. Generate Prisma Types
710
+
711
+ \`\`\`bash
712
+ # In packages/api
713
+ npx prisma generate --generator pothos
714
+ \`\`\`
715
+
716
+ Add to your prisma schema:
717
+
718
+ \`\`\`prisma
719
+ generator pothos {
720
+ provider = "prisma-pothos-types"
721
+ output = "../src/graphql/generated.ts"
722
+ }
723
+ \`\`\`
724
+
725
+ ### 3. Define Types (types/example.ts)
726
+
727
+ \`\`\`typescript
728
+ import { builder } from '../builder';
729
+
730
+ // Object type from Prisma model
731
+ builder.prismaObject('Test', {
732
+ fields: (t) => ({
733
+ id: t.exposeID('id'),
734
+ name: t.exposeString('name'),
735
+ message: t.exposeString('message'),
736
+ status: t.exposeString('status'),
737
+ createdAt: t.expose('createdAt', { type: 'DateTime' }),
738
+ }),
739
+ });
740
+
741
+ // Input type for mutations
742
+ const CreateTestInput = builder.inputType('CreateTestInput', {
743
+ fields: (t) => ({
744
+ name: t.string({ required: true }),
745
+ message: t.string({ required: true }),
746
+ status: t.string({ required: true }),
747
+ }),
748
+ });
749
+
750
+ // Query
751
+ builder.queryField('tests', (t) =>
752
+ t.prismaField({
753
+ type: ['Test'],
754
+ args: {
755
+ take: t.arg.int(),
756
+ skip: t.arg.int(),
757
+ },
758
+ resolve: async (query, _root, args, ctx) =>
759
+ ctx.db.test.findMany({
760
+ ...query,
761
+ take: args.take ?? 10,
762
+ skip: args.skip ?? 0,
763
+ orderBy: { createdAt: 'desc' },
764
+ }),
765
+ })
766
+ );
767
+
768
+ // Mutation
769
+ builder.mutationField('createTest', (t) =>
770
+ t.prismaField({
771
+ type: 'Test',
772
+ args: {
773
+ input: t.arg({ type: CreateTestInput, required: true }),
774
+ },
775
+ resolve: async (query, _root, args, ctx) =>
776
+ ctx.db.test.create({
777
+ ...query,
778
+ data: args.input,
779
+ }),
780
+ })
781
+ );
782
+ \`\`\`
783
+
784
+ ### 4. Yoga Server (index.ts)
785
+
786
+ \`\`\`typescript
787
+ import { createYoga } from 'graphql-yoga';
788
+ import { builder } from './builder';
789
+ import './types/test'; // Import all type definitions
790
+
791
+ export const yoga = createYoga({
792
+ schema: builder.toSchema(),
793
+ graphqlEndpoint: '/graphql',
794
+ });
795
+ \`\`\`
796
+
797
+ ### 5. Mount in Express (server.ts)
798
+
799
+ \`\`\`typescript
800
+ import express from 'express';
801
+ import { yoga } from './graphql';
802
+
803
+ const app = express();
804
+
805
+ // GraphQL endpoint
806
+ app.use('/graphql', yoga);
807
+
808
+ // tRPC endpoint
809
+ app.use('/trpc', trpcMiddleware);
810
+ \`\`\`
811
+
812
+ ## Client Setup
813
+
814
+ ### 1. GraphQL Client (shared/src/graphql/client.ts)
815
+
816
+ \`\`\`typescript
817
+ import { GraphQLClient } from 'graphql-request';
818
+
819
+ let client: GraphQLClient | null = null;
820
+
821
+ export function createGraphQLClient(config: { apiUrl: string }) {
822
+ client = new GraphQLClient(config.apiUrl);
823
+ return client;
824
+ }
825
+
826
+ export function getGraphQLClient(): GraphQLClient {
827
+ if (!client) throw new Error('GraphQL client not initialized');
828
+ return client;
829
+ }
830
+
831
+ export { gql } from 'graphql-request';
832
+ \`\`\`
833
+
834
+ ### 2. Using with React Query
835
+
836
+ \`\`\`typescript
837
+ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
838
+ import { getGraphQLClient, gql } from '../graphql/client';
839
+
840
+ const TESTS_QUERY = gql\`
841
+ query GetTests($take: Int) {
842
+ tests(take: $take) {
843
+ id
844
+ name
845
+ message
846
+ }
847
+ }
848
+ \`;
849
+
850
+ const CREATE_TEST = gql\`
851
+ mutation CreateTest($input: CreateTestInput!) {
852
+ createTest(input: $input) {
853
+ id
854
+ name
855
+ }
856
+ }
857
+ \`;
858
+
859
+ // Query hook
860
+ const { data, isLoading } = useQuery({
861
+ queryKey: ['graphql', 'tests'],
862
+ queryFn: () => getGraphQLClient().request(TESTS_QUERY, { take: 10 }),
863
+ });
864
+
865
+ // Mutation hook
866
+ const queryClient = useQueryClient();
867
+ const mutation = useMutation({
868
+ mutationFn: (input) => getGraphQLClient().request(CREATE_TEST, { input }),
869
+ onSuccess: () => {
870
+ queryClient.invalidateQueries({ queryKey: ['graphql', 'tests'] });
871
+ },
872
+ });
873
+ \`\`\`
874
+
875
+ ## GraphQL Playground
876
+
877
+ Access the GraphQL playground at:
878
+ \`\`\`
879
+ http://localhost:3000/graphql
880
+ \`\`\`
881
+
882
+ Features:
883
+ - Schema explorer
884
+ - Query autocompletion
885
+ - Documentation browser
886
+ - Query history
887
+
888
+ ## Best Practices
889
+
890
+ 1. **Use Input Types**: Always use input types for mutations
891
+ 2. **Pagination**: Implement cursor-based pagination for lists
892
+ 3. **Error Handling**: Use Pothos error types
893
+ 4. **Authorization**: Add auth checks in resolvers
894
+ 5. **N+1 Prevention**: Use Prisma's query optimization
592
895
  `,
593
896
  };
package/src/index.ts CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  const server = new Server(
26
26
  {
27
27
  name: "@idealyst/mcp-server",
28
- version: "1.0.90",
28
+ version: "1.0.93",
29
29
  },
30
30
  {
31
31
  capabilities: {