Skip to content

Added Resource Handling and File management#19

Open
Btran1291 wants to merge 4 commits intoTypingMind:mainfrom
Btran1291:main
Open

Added Resource Handling and File management#19
Btran1291 wants to merge 4 commits intoTypingMind:mainfrom
Btran1291:main

Conversation

@Btran1291
Copy link

I added a couple of things:

  • Resource Handling: Added support for the EmbeddedResource type, which some MCP servers use to return file contents. This fixes the "Unsupported content type" error when using tools like the GitHub MCP server to read code files. Now typingmind users can use Github MCP server to edit code. Text-based files (e.g., *.js, *.py) will be converted to text in a line-prefixed format that allows precise line-by-line edits. Blobs (PDFs, images, etc.) are saved to a downloads/ folder and a download link will be returned (useful for those who hosted the connector remotely like myself).
  • File Management: This is an update from my last PR. I added a file management system that allows users to create plugins to interact with the server's filesystem. This is important for people like me who host the MCP connector remotely on GCR when working with MCP servers that create and modify files. This allows users to upload files directly to the server's filesystem, as well as retrieving and deleting them, even when the MCP server does not provide such tools.
    • Upload (POST /upload): Handles raw stream uploads. I’ve made this flexible so it automatically creates subdirectories if users provide a nested path (e.g., projects/web-app/index.js).
    • Download (GET /files/*): Uses a wildcard route to support downloading files from any nested directory.
    • Delete (DELETE /files/*): Allows for easy deletion of files or folders.
    • Security: I implemented a getSafePath helper with path traversal protection. This ensures that all file operations stay strictly within the designated storage root and prevents any ../ exploits.

… traversal protection, and hybrid MCP resource transformation (text numbering + binary download links).
…idge

Implement cloud-native protocol detection, flexible storage with path…
Added a new endpoint to list files in a directory, excluding hidden and system directories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant