Είμαι αρκετά εθισμένος στη σειρά Last Of Us. Συγγνώμη για το εξώφυλλο.
😉 Οι MCP είναι παντού και για καλό λόγο. είναι το επόμενο βήμα στην εξέλιξη των εφαρμογών.
Being able to use everything from a single chat without accessing any app. It feels native for Postiz to schedule all your social posts from the chat! So, I started to dig into the Postiz code and added to it!
Postiz
Το αποθετήριο MCP είναι λίγο παράξενο
Κάθε MCP έχει μια μεταφορά, η οποία είναι η μέθοδος που χρησιμοποιούν οι LLMs για να μιλήσουν στο σύστημά μας.
Υπάρχουν δύο κύριες μέθοδοι αυτή τη στιγμή: Stdio, η οποία είναι βασικά μια γραμμή εντολών, και SSE.
Υπάρχουν δύο κύριες μέθοδοι αυτή τη στιγμή
Δεν καταλαβαίνω πραγματικά γιατί επέλεξαν το SSE – είναι βασικά ένα μακρύ αίτημα που δεν τελειώνει ποτέ και μεταδίδει γεγονότα στον πελάτη.
Θα χρησιμοποιούσα WebSockets. Έχουν ενσωματωμένη λειτουργία ύπνου και δεν χρειάζεται να διατηρήσετε μια κατάσταση γι 'αυτό.
«Χρ»Ανακατεύθυνση
Έχω σκάψει στο SDK ανθρωποειδών γραμματοσειρών και δεν ήμουν έκπληκτος. Αισθάνεται σκανδαλώδης. Πολλά πράγματα δεν χρησιμοποιούνται στην παραγωγή, όπως "Resources". Ο τρόπος με τον οποίο απαιτούν να κρατάτε τα πάντα παγκοσμίως στη μνήμη είναι μια καταστροφή που περιμένει να συμβεί.
Είναι επίσης δύσκολο να εφαρμόσουμε την επαλήθευση ταυτότητας και να βγάλουμε τον χρήστη από το πλαίσιο, ώστε να μπορέσουμε να πάρουμε τις λεπτομέρειες τους.
import EventEmitter από 'events'; import {finalize, fromEvent, startWith } από 'rxjs'; @Injectable() export class McpService { static event = new EventEmitter(); constructor( private _mainMcp: MainMcp ) { } async runServer(apiKey: string, organization: string) { const server = 'endpoint', data.envoice.load(organization, this._mainMcp).server(); const transport = new McpTransport(organization); const observer = fromEvent(McP: MainMcp.event), `transport-${McService.event, `transport_transport_############# import EventEmitter from 'events'; import { finalize, fromEvent, startWith } from 'rxjs'; @Injectable() export class McpService { static event = new EventEmitter(); constructor( private _mainMcp: MainMcp ) { } async runServer(apiKey: string, organization: string) { const server = McpSettings.load(organization, this._mainMcp).server(); const transport = new McpTransport(organization); const observer = fromEvent( McpService.event, `organization-${organization}` ).pipe( startWith({ type: 'endpoint', data: process.env.NEXT_PUBLIC_BACKEND_URL + '/mcp/' + apiKey + '/messages', }), finalize(() => { transport.close(); }) ); console.log('MCP transport started'); await server.connect(transport); return observer; } async processPostBody(organization: string, body: object) { const server = McpSettings.load(organization, this._mainMcp).server(); const message = JSONRPCMessageSchema.parse(body); const transport = new McpTransport(organization); await server.connect(transport); transport.handlePostMessage(message); return {}; } }
Καθημερινή ️
Αυτό είναι για εσάς αν είστε μεγάλος οπαδός των frameworks OOP όπως το NestJS/Laravel/Spring.[επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε] [επεξεργαστείτε]
@McpTool({ toolName: 'POSTIZ_GET_CONFIG_ID' }) async preRun() { return [ { type: 'text', text: `id: ${makeId(10)} Today date is ${dayjs.utc().format()}`, }, ]; } @McpTool({ toolName: 'POSTIZ_PROVIDERS_LIST' }) async listOfProviders(organization: string) { const list = ( await this._integrationService.getIntegrationsList(organization) ).map((org) => ({ id: org.id, name: org.name, identifier: org.providerIdentifier, picture: org.picture, disabled: org.disabled, profile: org.profile, customer: org.customer ? { id: org.customer.id, name: org.customer.name, } : undefined, })); return [{ type: 'text', text: JSON.stringify(list) }]; } @McpTool({ toolName: 'POSTIZ_SCHEDULE_POST', zod: { type: eenum(['draft', 'scheduled']), configId: string(), generatePictures: boolean(), date: string().describe('UTC TIME'), providerId: string().describe('Use POSTIZ_PROVIDERS_LIST to get the id'), posts: array(object({ text: string(), images: array(string()) })), }, }) async schedulePost( organization: string, obj: { type: 'draft' | 'schedule'; generatePictures: boolean; date: string; providerId: string; posts: { text: string }[]; } ) { const create = await this._postsService.createPost(organization, { date: obj.date, type: obj.type, tags: [], posts: [ { group: makeId(10), value: await Promise.all( obj.posts.map(async (post) => ({ content: post.text, id: makeId(10), image: !obj.generatePictures ? [] : [ { id: makeId(10), path: await this._openAiService.generateImage( post.text, true ), }, ], })) ), // @ts-ignore settings: {}, integration: { id: obj.providerId, }, }, ], }); return [ { type: 'text', text: `Post created successfully, check it here: ${process.env.FRONTEND_URL}/p/${create[0].postId}`, }, ]; }
All the code can be found in Postiz here: https://github.com/gitroomhq/postiz-app/tree/main/libraries/nestjs-libraries/src/mcp
https://github.com/gitroomhq/postiz-app/tree/main/libraries/nestjs-libraries/src/mcp
And here: https://github.com/gitroomhq/postiz-app/tree/main/apps/backend/src/mcp
https://github.com/gitroomhq/postiz-app/tree/main/apps/backend/src/mcp«Χρ»Αναγκάστε το LLM να κάνει πράγματα 💪🏻
Θα ήταν ωραίο να έχουμε μια ενσωματωμένη επιλογή για να αναγκάσουμε το LLM να κάνει διαφορετικά πράγματα πριν αποκτήσει πρόσβαση στα πράγματα μας.
Κάθε φορά που έλεγα στον Cursor να προγραμματίσει μια θέση για μένα, προσπάθησε να την προγραμματίσει για το 2024.
Έπρεπε να περάσω κάποιες λεπτομέρειες διαμόρφωσης, οπότε δημιούργησα το εργαλείο
POSTIZ_CONFIGURATION_PRERUN
.POSTIZ_CONFIGURATION_PRERUN
Στο
POSTIZ_SCHEDULE_POST
, προσέθεσα μια νέα ιδιότητα που ονομάζεταιconfigId
και άλλαξα το όνομα του εργαλείου διαμόρφωσης σεPOSTIZ_GET_CONFIG_ID.
Η έξοδο της διαμόρφωσης είναι:id: ${makeId(10)} Η σημερινή ημερομηνία είναι ${day.jsutc().format()}
POSTIZ_SCHEDULE_POST
configId
POSTIZ_GET_CONFIG_ID.
id: ${makeId(10)} Today date is ${dayjs.utc().format()}
Αναγκάστηκε το LLM να το καλεί πάντα νωρίτερα, και η ημερομηνία ήταν σταθερή! :)
Ήταν ακόμα καλύτερο για μένα επειδή ήξερα ότι θα μου στέλνει ημερομηνίες UTC από τώρα και στο εξής.
«Χρ»Χρήσιμες περιπτώσεις
Νομίζω ότι λειτουργεί καλύτερα όταν συνδυάζεται με πολλαπλά σύνολα εργαλείων, για παράδειγμα:
- Connect it to Cursor and ask it to schedule a post about your work today.
- Connect it to Notion and ask to schedule all the team's latest work on social media - check out Composio MCPs.
- Connect it to any SaaS that has CopilotKit and schedule posts based on the app.
Συνδέστε το στο Cursor και ζητήστε του να προγραμματίσει μια θέση για το έργο σας σήμερα. Connect it to Notion and ask to schedule all the team's latest work on social media - check out Composio MCPs. Composio MCPsConnect it to any SaaS that has CopilotKit and schedule posts based on the app. CopilotKit«Χρ»Ανακατεύθυνση MCP
Postiz is the most robust open-source social media scheduling tool - and now the only scheduler that offers MCP (natively, not with Zapier or something like that)
Postiz
Με το νέο MCP, μπορείτε να προγραμματίσετε όλες τις δημοσιεύσεις σας από τους πελάτες Cursor/Windsurf και Anthropic.
Όλα είναι 100% δωρεάν, φυσικά. :)
If you like it, please don't forget to star us ⭐️https://github.com/gitroomhq/postiz-app
https://github.com/gitroomhq/postiz-app
«ΒΡ»