Génère des API GraphQL, des relations et le stockage de base de données pour MongoDB ou PostgreSQL à partir de types d'objets GraphQL.
Aussi connu sous simtlix/simfinity.js, simfinity-js, @simtlix/simfinity-mcp
- Étoiles
- 11
- Outils
- —
- Téléchargements, 30 jours
- —
- Dernière version
- —
- Dernier commit
- 13 nov. 2026
- Licence
- Apache-2.0
Qu'est-ce que simfinity.js MCP ?
simfinity.js est un serveur MCP. Génère des API GraphQL, des relations et le stockage de base de données pour MongoDB ou PostgreSQL à partir de types d'objets GraphQL.
Résumé généré à partir du README du projet
À propos du MCP server simfinity.js
Les développeurs qui construisent des services backend peuvent utiliser simfinity.js pour transformer des types d'objets GraphQL en API pleinement fonctionnelles. Le framework automatise la création de requêtes, de mutations et de relations, offrant ainsi un pont entre vos modèles de données et le stockage en base de données. Il supporte à la fois MongoDB via une façade Mongoose et PostgreSQL 15+ avec de véritables tables et clés étrangères.
Cet outil est utilisé localement au sein d'environnements Node.js pour gérer la persistance des données et la logique métier. Vous pouvez choisir entre les adaptateurs MongoDB ou PostgreSQL lors du démarrage de l'application pour répondre à différents besoins de stockage. Le système gère des tâches complexes telles que la création automatique d'index pour MongoDB, la génération de méthodes de résolution pour les relations et l'implémentation de machines à états déclaratives.
Pour ceux qui intègrent des workflows d'IA, le framework inclut des capacités de génération MCP. Vous pouvez déployer un MCP server autonome utilisant stdio ou un endpoint MCP via HTTP qui s'exécute aux côtés de votre API GraphQL. Cela permet aux clients IA d'interagir directement avec vos outils, filtres et agrégations générés via le Model Context Protocol.
Ce que vous pouvez faire avec
- 1Automatiser la génération d'API backendUn développeur peut définir un modèle d'objet GraphQL et laisser le framework produire automatiquement toutes les requêtes et mutations nécessaires.
- 2Exposer des outils de données à des clients IAVous pouvez générer des définitions d'outils pour permettre à une IA d'effectuer des opérations sur la base de données via un MCP server.
- 3Implémenter des agrégations de données complexesEffectuez des opérations GROUP BY avec des fonctions mathématiques intégrées comme SUM ou AVG directement via l'API.
Extrait du README du projet. Chaque cas d'utilisation est vérifié par rapport à une citation du document.
Comment installer simfinity.js MCP
Formats vérifiés le 10 nov. 2026Ajouter à CursorAjouter à GooseInstaller simfinity.js MCP dans Claude Code
$ claude mcp add simfinity-js -- npx -y @simtlix/simfinity-mcpInstaller simfinity.js MCP dans Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"simfinity-js": {
"command": "npx",
"args": [
"-y",
"@simtlix/simfinity-mcp"
]
}
}
}Installer simfinity.js MCP dans VS Code
.vscode/mcp.json
{
"servers": {
"simfinity-js": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@simtlix/simfinity-mcp"
]
}
}
}Installer simfinity.js MCP dans VS Code CLI
$ code --add-mcp '{"name":"simfinity-js","type":"stdio","command":"npx","args":["-y","@simtlix/simfinity-mcp"]}'Installer simfinity.js MCP dans Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"simfinity-js": {
"command": "npx",
"args": [
"-y",
"@simtlix/simfinity-mcp"
]
}
}
}Installer simfinity.js MCP dans Codex
$ codex mcp add simfinity-js -- npx -y @simtlix/simfinity-mcpInstaller simfinity.js MCP dans Codex config.toml
~/.codex/config.toml
[mcp_servers.simfinity-js] command = "npx" args = ["-y", "@simtlix/simfinity-mcp"]
Installer simfinity.js MCP dans Gemini CLI
$ gemini mcp add -s user simfinity-js npx -- -y @simtlix/simfinity-mcpInstaller simfinity.js MCP dans Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"simfinity-js": {
"command": "npx",
"args": [
"-y",
"@simtlix/simfinity-mcp"
]
}
}
}Vérifications automatisées
Exécuté le 14 nov. 2026Rapport complet →A passé nos vérifications automatisées. Il ne s'agit pas d'un audit de sécurité : lisez le code et donnez au serveur l'accès le plus restreint dont il a besoin. Fonctionnement des vérifications
- Dépôt source lié et accessiblesimtlix/simfinity.js is public and reachablegithub.com/simtlix/simfinity.js ↗Réussi
- Le nom du package correspond au dépôt source@simtlix/simfinity-mcp names simtlix/simfinity.js as sourcenpmjs.com/package/@simtlix/simfinity-mcp ↗Réussi
- Provenance du build (attestation Sigstore)Sigstore attestation for @simtlix/simfinity-mcpnpmjs.com/package/@simtlix/simfinity-mcp/v/3.19.1#provenance ↗Réussi
- Licence open source (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Réussi
- Commit ou version publiée au cours de l'année écouléeLast commit or release 2026-11-13github.com/simtlix/simfinity.js ↗Réussi
- OpenSSF ScorecardNon vérifié
- Nom du package non proche d'un package populaireNo popular package one edit away from @simtlix/simfinity-mcpRéussi
- Aucun avis critique dans le package ou ses dépendancesNon vérifié
- Aucune instruction cachée destinée au modèle0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersRéussi
- Les outils destructifs sont étiquetésNon vérifié
- Le point de terminaison distant répond à la poignée de main MCPNon vérifié
README
Voir sur GitHub
Simfinity.js
A Node.js framework that turns GraphQL object types into generated queries, mutations, relationships, and database storage. Use the established MongoDB/Mongoose facade or the PostgreSQL 15+ facade with real tables and foreign keys.
Read the documentation website: start with the quick start, explore the guides, or consult the API reference. The website source is in docs/.
For a complete application, run the Barber examples: independent MongoDB and PostgreSQL backends with one shared Next.js frontend, synthetic demo data, Docker setup, and a dedicated CI workflow. Both backends consume released Simfinity 3.8.0 packages from npm. Their shared HTTP matrix verifies filters, aggregates, scopes and nested mutations; see the API test commands and reference-integrity boundary.
Run the documentation website locally with Node.js 22.12.0+:
npm run docs:install
npm run docs:dev
For builds and hosting, see the website maintainer guide. The website documents the current source; some older examples later in this README retain historical conventions.
Documentation for both databases: The public website now covers MongoDB and PostgreSQL, including shared APIs, relationships, generated FKs, scopes, and MCP. Both adapters are available on npm and released together. Follow the quick starts for installation, or download the runnable starters and verified release archives.
📑 Table of Contents
- Features
- Installation
- PostgreSQL support
- Quick Start
- Core Concepts
- Basic Usage
- Relationships
- Validations
- Optimistic concurrency
- State Machines
- Controllers & Lifecycle Hooks
- Query Scope
- Authorization
- Middlewares
- Advanced Features
- MCP Generation
- Aggregation Queries
- Complete Example
- Resources
- License
- Contributing
✨ Features
- Automatic Schema Generation: Define your object model, and Simfinity.js generates all queries and mutations
- MongoDB or PostgreSQL: Choose the database facade once during application startup
- Powerful Querying: Typed filters, nested paths, pagination, sorting, and aggregations across the supported contract
- Aggregation Queries: Built-in support for GROUP BY queries with aggregation operations (SUM, COUNT, AVG, MIN, MAX)
- Auto-Generated Resolvers: Automatically generates resolve methods for relationship fields
- Automatic Index Creation: Generates MongoDB indexes for ObjectId fields and single references, including leaves inside embedded objects and embedded arrays. The top-level
idindex is unused, since the record key is_id;onModelCreated: (model) => model.schema.removeIndex({ id: 1 })removes it from aconnect()type. See the index reference - Business Logic: Implement business logic and domain validations declaratively
- State Machines: Built-in support for declarative state machine workflows
- Lifecycle Hooks: Controller methods for granular control over operations
- Custom Validation: Field-level and type-level custom validations
- Relationship Management: Support for embedded and referenced relationships
- Authorization: Production-grade GraphQL authorization with RBAC/ABAC, function-based rules, declarative policy expressions, and native Envelop/Yoga plugin support
📦 Installation
npm install mongoose@^8.24.2 graphql@^16.11.0 @simtlix/simfinity-js@3.16.0
Prerequisites: Simfinity.js requires mongoose and graphql as peer dependencies. Keep them within the ranges above so your application and Simfinity share a single Mongoose and GraphQL instance; npm reports an out-of-range version as a peer conflict. The MCP transports need the optional peer @modelcontextprotocol/sdk@^1.31.0, which is not installed automatically, and graphql-middleware is not a Simfinity dependency.
PostgreSQL support
Simfinity releases @simtlix/simfinity-core, @simtlix/simfinity-sql, @simtlix/simfinity-mcp, @simtlix/simfinity-postgres, and the MongoDB facade in lockstep. Install the selected adapter from npm; shared dependencies resolve automatically. PostgreSQL runs the shared GraphQL query/mutation engine, including scopes, controllers, validators, state transitions and nested writes. It generates and validates tables, indexes, and real foreign keys, including inverse relations, explicit many-to-many linking entities, and references inside embedded objects. PostgreSQL installation does not pull Mongoose, MongoDB, or MCP dependencies.
Version 3.3.0 separates the driver-free relational runtime into @simtlix/simfinity-sql. PostgreSQL supplies the first SQL plugin; it owns physical SQL, types, schema initialization and pg. Existing createPostgres and namespace imports remain compatible, with unchanged generated PostgreSQL storage and FKs. Use the explicit composition API when you want to select a plugin:
import { createSQL } from '@simtlix/simfinity-sql';
import { postgresPlugin } from '@simtlix/simfinity-postgres';
const simfinity = createSQL({ plugin: postgresPlugin({ pool, schema: 'app' }) });
Install both packages directly when importing both. Only PostgreSQL is supported initially; see the SQL plugin guide for the contract, capabilities, dependency boundaries and extension requirements.
All publishable libraries live under packages/:
| Directory | npm package |
|---|---|
packages/core |
@simtlix/simfinity-core |
packages/sql |
@simtlix/simfinity-sql |
packages/mongodb |
@simtlix/simfinity-js |
packages/postgres |
@simtlix/simfinity-postgres |
packages/mcp |
@simtlix/simfinity-mcp |
packages/descriptor |
@simtlix/simfinity-descriptor |
packages/client |
@simtlix/simfinity-js-client |
The browser/Node HTTP client is maintained at packages/client as @simtlix/simfinity-js-client, with its existing default import and JavaScript API. Since 3.19.0 it supports descriptor initialization, exact views/custom queries, current filters, managed versions and transactions; see the client guide. It has no server or driver dependencies.
The repository root is a private npm workspace for shared tests, documentation and release tooling. MongoDB retains its existing package name, public API and deep imports such as @simtlix/simfinity-js/src/auth/rules.js. Its legacy src/ modules that re-export public API (src/index.js, src/auth/index.js, src/auth/errors.js, src/auth/expressions.js, src/auth/rules.js, src/plugins.js, src/scalars.js, src/validators.js, src/mcp.js, src/const/*.js, src/errors/*.js, and their extensionless aliases) ship TypeScript declarations with the types of the package root and the matching @simtlix/simfinity-core subpaths; src/mongo/* is internal and undeclared. New code should still import auth, plugins, scalars and validators from the package root. The typed @simtlix/simfinity-core subpaths, such as @simtlix/simfinity-core/auth, need @simtlix/simfinity-core as a direct dependency pinned to the facade's exact version. Run development commands from the root; pack MongoDB with npm pack --workspace @simtlix/simfinity-js or use the release scripts to pack all seven libraries. Pushing a release tag (vX.Y.Z) or publishing a GitHub release automatically publishes all seven packages with GitHub Actions, attaches verified archives to the release, and deploys the stable documentation. Version changes and merges to master do not publish; the tag must match the aligned package versions and point to source already merged into master. See the release and OIDC setup guide.
The shared development and publication contract applies to contributors and coding agents: when a task includes publication, completion requires the GitHub tag and published release, verified packages in both registries, and the applicable documentation deployment. This rule is tracked in AGENTS.md and the always-applied Cursor workflow rule.
Enum filters resolve member names first, then declared internal values by strict equality, on both backends. For example, with ONE: { value: 'TWO' } and TWO: { value: 'two' }, filter "TWO" selects member TWO. Numeric internal values require numbers, not numeric strings. This applies to scalar lists, embedded/reference leaves and state filters across EQ, NE, LT, LTE, GT, GTE, BTW, IN and NIN. LIKE accepts string fields only. PostgreSQL writes and state guards continue to use internal enum values. Generated MongoDB models store numeric and boolean enum values as numbers and booleans, so MongoDB range filters, sorts and aggregate groupId values follow that type while PostgreSQL uses their text form ("10" before "2"); convert documents written by earlier versions as described in the schema guide.
The shared runtime preserves the v3.1 contract: generated relationships run target middleware/scopes with protected identity and parent filters; nested mutations enforce child middleware and persisted ownership; standalone saveObject() wraps the complete workflow in a transaction. Accepted empty strings are preserved. Both facades expose configureQueryLimits() for bounded pagination and configureMutationLimits() for bounded nested writes.
Choose the backend at application setup. The existing package continues to use MongoDB; PostgreSQL uses createPostgres({ pool, schema }), the same connect(null, Type, ...)/createSchema() signatures, and an awaited initializeDatabase() before serving requests. See the canonical PostgreSQL quick start, detailed storage reference, and compatibility contract before adopting this version.
Both database facades expose the same auth, validators, scalars, and plugins helper objects. PostgreSQL keeps MCP optional; install the database-independent integration and its transport SDK only when needed:
npm install @simtlix/simfinity-mcp@3.16.0 @modelcontextprotocol/sdk@^1.31.0
Import generateMCPTools, createMCPServer, or the transport helpers from @simtlix/simfinity-mcp and pass the schema returned by createPostgres().createSchema().
Compatibility tests run the same GraphQL schemas and query corpus against both databases. IDs use UUIDs on PostgreSQL, native model/session APIs differ, and some mappings remain explicitly unsupported, including whole embedded-object uniqueness and whole-object sorting/grouping. Nested embedded scalar-list filters/sorts, ragged array group keys and array aggregate facts now match the supported Mongo query contract. Native embedded writes retain explicit nulls, apply descendant list defaults and minimize empty inline objects; historical Date parameters use UTC. PostgreSQL enforces scalar/list multikey uniqueness within embedded trees through typed owner-key tables, validates JSONB embedded shapes, and checks owned marker/row consistency with deferred database triggers. MongoDB fixes also cover list nullability wrappers, scalar-ID inverse relations, inverse aggregation paths, embedded array replacement after clearing, and isolation of mutation input across transaction retries. Existing API signatures remain unchanged.
🚀 Quick Start
The complete quick start includes MongoDB setup, installation, and working create, read, update, and delete operations. Simfinity uses ES modules and named exports.
npm install @simtlix/simfinity-js graphql@^16.11.0 mongoose@^8.24.2 graphql-yoga@^5
Set "type": "module" in your application's package.json, then create server.js:
import { createServer } from 'node:http';
import { GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
import { createYoga } from 'graphql-yoga';
import mongoose from 'mongoose';
import * as simfinity from '@simtlix/simfinity-js';
const SerieType = new GraphQLObjectType({
name: 'Serie',
fields: {
id: { type: GraphQLID },
name: { type: new GraphQLNonNull(GraphQLString) },
},
});
await mongoose.connect(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/series?replicaSet=rs0&directConnection=true');
simfinity.connect(null, SerieType, 'serie', 'series');
const schema = simfinity.createSchema();
const yoga = createYoga({ schema });
createServer(yoga).listen(4000, '127.0.0.1', () => {
console.log('GraphQL ready at http://127.0.0.1:4000/graphql');
});
Generated mutations require a MongoDB replica set or sharded cluster. Follow the local MongoDB setup, then run node server.js and open http://127.0.0.1:4000/graphql:
mutation {
addserie(input: { name: "The Expanse" }) {
id
name
}
}
query {
series {
id
name
}
}
For a full working application, see the Barber examples, with MongoDB and PostgreSQL backends, a shared frontend, relationships, state machines, controllers, and authorization.
🔧 Core Concepts
Connecting Models
The simfinity.connect() method links your GraphQL types to Simfinity's automatic schema generation:
simfinity.connect(
mongooseModel, // Optional: Custom Mongoose model (null for auto-generation)
graphQLType, // Required: Your GraphQLObjectType
singularEndpointName, // Required: Singular name for mutations (e.g., 'book')
pluralEndpointName, // Required: Plural name for queries (e.g., 'books')
controller, // Optional: Controller with lifecycle hooks
onModelCreated, // Optional: Callback when Mongoose model is created
stateMachine // Optional: State machine configuration
);
Creating Schemas
Generate your complete GraphQL schema with optional type filtering:
const schema = simfinity.createSchema(
includedQueryTypes, // Optional: Array of types to include in queries
includedMutationTypes, // Optional: Array of types to include in mutations
includedCustomMutations, // Optional: Array of custom mutation names to include
{ includedCustomQueries, transaction } // Optional: Options object; custom query names to include and the transaction mutation
);
buildClientDescriptor(schema) now provides immutable JSON metadata for the exact schema returned by createSchema(), including actual operation names, inputs, relations, virtual fields and state transitions. Import it from the optional @simtlix/simfinity-descriptor package, aligned with the facade version. Available since 3.15.0. Mount createClientDescriptorHandler(schema, { authorize: 'public' }) explicitly to serve it; both functions are named exports of the descriptor package. For example:
import { buildClientDescriptor, createClientDescriptorHandler } from '@simtlix/simfinity-descriptor';
const descriptor = buildClientDescriptor(schema);
console.log(descriptor.operations.query);
app.all('/graphql-metadata', simfinity.createClientDescriptorHandler(schema, { authorize: 'public' }));
The __Field.extensions introspection metadata is deprecated in favour of the descriptor; its 3.x default stays enabled. A public @simtlix/simfinity-core/introspection subpath exports configureIntrospection({ fieldExtensions: false }), which requires core as a direct dependency pinned to the facade's exact version and must execute before importing the runtime or facades and never removes installed metadata. Current legacy metadata clients need migration before using the opt-out. See the client descriptor reference for bootstrap ordering, protected HTTP access, format and composition limits.
Importing Simfinity initializes its global __Field.extensions introspection field safely whether GraphQL's fields have already been materialized or a schema already exists. Repeated module evaluation with the same GraphQL peer reuses the existing extension field and metadata types. Application field metadata is preserved.
The extension remains shared by every schema using that GraphQL peer; Simfinity's type and middleware registries belong to each runtime instance. A GraphQLObjectType belongs to the first runtime whose schema generates its relation resolvers, or reaches it while one of its non-embedded relation fields has no resolver, such as an unregistered custom mutation result. Registering it in another runtime, reaching it from another runtime's schema, or copying its relation fields with toConfig() after that runtime generated them, throws TYPE_BOUND_TO_OTHER_RUNTIME. Give each runtime its own type objects, for example from a factory function. Types without non-embedded relation fields, and types whose relations all have your own resolvers, can be shared; see types belong to one runtime. Schemas constructed after import include FieldExtensionsType and RelationType in their type maps, or their fallback names SimfinityFieldExtensionsType and SimfinityRelationType once an application type with one of those names was in the process's first Simfinity schema; see what gets generated. Earlier schemas keep their original type maps: ordinary operations and direct metadata selections work, but named fragments on the new metadata types require a schema constructed after import.
Schema-cloning tools remain unsupported. In a process that has imported Simfinity, buildClientSchema() on a post-import schema's introspection result can also fail with duplicate metadata type names. Use Envelop plugins and in-place resolver wrapping; see the introspection metadata reference.
MongoDB Reference Integrity
Opt into reference checks when creating the MongoDB adapter. The default remains 'off', preserving existing applications:
import { createMongoAdapter, createRuntime } from '@simtlix/simfinity-js';
const adapter = createMongoAdapter({ referentialIntegrity: 'transactional' });
const simfinity = createRuntime(adapter);
await mongoose.connect(process.env.MONGODB_URI);
simfinity.connect(null, SerieType, 'serie', 'series');
const schema = simfinity.createSchema();
await adapter.initialize();
Register the complete type graph and await initialization before serving HTTP or MCP. Initialization audits existing references and verifies a transaction-capable MongoDB deployment. Protected writes reject missing targets and restrict deletion of referenced documents, including references within embedded lists, inferred/private inverse keys and explicit many-to-many links. Target-document writes coordinate concurrent creation/deletion. Failures return REFERENCE_CONSTRAINT_VIOLATION (409) and roll back the mutation.
The mode is fixed at startup. All writers must share the same graph/mode; raw Mongoose/driver writes bypass this protection. PostgreSQL retains native database FKs. See MongoDB reference integrity for snapshot/majority sessions, reserved lock metadata, contention and existing-data migration.
Questions sur simfinity.js MCP
Comment ajouter simfinity.js MCP à Claude Code ?
Exécutez claude mcp add simfinity-js -- npx -y @simtlix/simfinity-mcp dans votre terminal. Ajoutez --scope user pour le rendre disponible dans tous les projets.
Comment ajouter simfinity.js MCP à Cursor ?
Ouvrez ~/.cursor/mcp.json et ajoutez le serveur sous mcpServers, avec la configuration Cursor indiquée dans la section d'installation ci-dessus.
Quelles bases de données sont supportées par Simfinity.js ?
Il supporte MongoDB via la façade Mongoose et PostgreSQL 15+ avec de véritables tables et clés étrangères.