feat: complete MCP Bridge implementation

- Add @tpmjs/mcp-client package for connecting to MCP servers
- Add @tpmjs/bridge CLI for bridging local MCP servers to TPMJS
- Add @tpmjs/test-file-writer test MCP server
- Add BridgeConnection and CollectionBridgeTool database models
- Add /api/bridge endpoints for bridge communication
- Add /api/collections/[id]/bridge-tools API for managing bridge tools
- Update MCP handlers to include bridge tools in tools/list
- Add bridge status UI at /dashboard/settings/bridge
- Add interactive bridge tutorial at /docs/tutorials/bridge
This commit is contained in:
Ajax Davis 2026-01-13 00:59:34 +10:00
parent 490d76a50b
commit c8c1a12f22
37 changed files with 7318 additions and 23 deletions

View file

@ -67,6 +67,22 @@ export const ReorderToolsSchema = z.object({
toolIds: z.array(z.string().min(1)),
});
// ============================================================================
// Bridge Tool Schemas
// ============================================================================
export const AddBridgeToolToCollectionSchema = z.object({
serverId: z.string().min(1, 'Server ID is required').max(100),
toolName: z.string().min(1, 'Tool name is required').max(100),
displayName: z.string().max(100).optional(),
note: z.string().max(500, 'Note must be 500 characters or less').optional(),
});
export const UpdateCollectionBridgeToolSchema = z.object({
displayName: z.string().max(100).nullable().optional(),
note: z.string().max(500, 'Note must be 500 characters or less').nullable().optional(),
});
// ============================================================================
// Clone Schemas
// ============================================================================
@ -127,6 +143,8 @@ export type AddToolToCollectionInput = z.infer<typeof AddToolToCollectionSchema>
export type UpdateCollectionToolInput = z.infer<typeof UpdateCollectionToolSchema>;
export type ReorderToolsInput = z.infer<typeof ReorderToolsSchema>;
export type CloneCollectionInput = z.infer<typeof CloneCollectionSchema>;
export type AddBridgeToolToCollectionInput = z.infer<typeof AddBridgeToolToCollectionSchema>;
export type UpdateCollectionBridgeToolInput = z.infer<typeof UpdateCollectionBridgeToolSchema>;
export type Collection = z.infer<typeof CollectionSchema>;
export type CollectionTool = z.infer<typeof CollectionToolSchema>;
export type CollectionWithTools = z.infer<typeof CollectionWithToolsSchema>;
@ -138,6 +156,7 @@ export type CollectionWithTools = z.infer<typeof CollectionWithToolsSchema>;
export const COLLECTION_LIMITS = {
MAX_COLLECTIONS_PER_USER: 50,
MAX_TOOLS_PER_COLLECTION: 100,
MAX_BRIDGE_TOOLS_PER_COLLECTION: 50,
MAX_NAME_LENGTH: 100,
MAX_DESCRIPTION_LENGTH: 500,
MAX_NOTE_LENGTH: 500,