{"id":26305881,"url":"https://github.com/seanivore/mcp-file-preview","last_synced_at":"2025-05-12T21:05:43.579Z","repository":{"id":269910109,"uuid":"907327756","full_name":"seanivore/mcp-file-preview","owner":"seanivore","description":"MCP server for HTML file preview and analysis - Has been weird with OS but good on Cline so WIP","archived":false,"fork":false,"pushed_at":"2024-12-27T04:36:41.000Z","size":25,"stargazers_count":13,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-04T06:16:52.460Z","etag":null,"topics":["agentic","cline","css","file-preview","html","mcp","website-development"],"latest_commit_sha":null,"homepage":"https://seanivore.github.io/portfolio/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seanivore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-23T10:37:40.000Z","updated_at":"2025-04-21T03:10:15.000Z","dependencies_parsed_at":"2024-12-27T05:34:02.243Z","dependency_job_id":null,"html_url":"https://github.com/seanivore/mcp-file-preview","commit_stats":null,"previous_names":["seanivore/mcp-file-preview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanivore%2Fmcp-file-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanivore%2Fmcp-file-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanivore%2Fmcp-file-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanivore%2Fmcp-file-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanivore","download_url":"https://codeload.github.com/seanivore/mcp-file-preview/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823412,"owners_count":21969846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic","cline","css","file-preview","html","mcp","website-development"],"created_at":"2025-03-15T09:17:22.645Z","updated_at":"2025-05-12T21:05:43.533Z","avatar_url":"https://github.com/seanivore.png","language":"JavaScript","funding_links":[],"categories":["Browser Automation","File Management","🌐 Web Development"],"sub_categories":["How to Submit"],"readme":"# MCP File Preview Server\n\nA Model Context Protocol (MCP) server that provides HTML file preview and analysis capabilities. This server enables capturing full-page screenshots of local HTML files and analyzing their structure.\n\n## Features\n\n- **File Preview**: Capture full-page screenshots of HTML files with proper CSS styling\n- **Content Analysis**: Analyze HTML structure (headings, paragraphs, images, links)\n- **Local File Support**: Handle local file paths and resources\n- **Screenshot Management**: Save screenshots to a dedicated directory\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/your-username/mcp-file-preview.git\ncd mcp-file-preview\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Build the project:\n```bash\nnpm run build\n```\n\n## Configuration\n\nAdd the server to your Claude or Cline MCP settings:\n\n### Claude Desktop App\nAdd to `~/Library/Application Support/Claude/claude_desktop_config.json`:\n```json\n{\n  \"mcpServers\": {\n    \"file-preview\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/mcp-file-preview/build/index.js\"]\n    }\n  }\n}\n```\n\n### Cline VSCode Extension\nAdd to VSCode's MCP settings:\n```json\n{\n  \"mcpServers\": {\n    \"file-preview\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/mcp-file-preview/build/index.js\"]\n    }\n  }\n}\n```\n\n## Usage\n\nThe server provides two main tools:\n\n### preview_file\nCaptures a screenshot and returns HTML content:\n```typescript\n\u003cuse_mcp_tool\u003e\n\u003cserver_name\u003efile-preview\u003c/server_name\u003e\n\u003ctool_name\u003epreview_file\u003c/tool_name\u003e\n\u003carguments\u003e\n{\n  \"filePath\": \"/path/to/file.html\",\n  \"width\": 1024,  // optional\n  \"height\": 768   // optional\n}\n\u003c/arguments\u003e\n\u003c/use_mcp_tool\u003e\n```\n\nScreenshots are saved to `screenshots/` directory in the project folder.\n\n### analyze_content\nAnalyzes HTML structure:\n```typescript\n\u003cuse_mcp_tool\u003e\n\u003cserver_name\u003efile-preview\u003c/server_name\u003e\n\u003ctool_name\u003eanalyze_content\u003c/tool_name\u003e\n\u003carguments\u003e\n{\n  \"filePath\": \"/path/to/file.html\"\n}\n\u003c/arguments\u003e\n\u003c/use_mcp_tool\u003e\n```\n\nReturns counts of:\n- Headings\n- Paragraphs\n- Images\n- Links\n\n## Development\n\n1. Install dependencies:\n```bash\nnpm install @modelcontextprotocol/sdk puppeteer typescript @types/node @types/puppeteer\n```\n\n2. Make changes in `src/`\n3. Build:\n```bash\nnpm run build\n```\n4. Test locally:\n```bash\nnpm run dev\n```\n\n## Implementation Details\n\nThe server uses the MCP SDK's Server class with proper initialization:\n\n```typescript\nthis.server = new Server(\n  // Metadata object\n  {\n    name: 'file-preview-server',\n    version: '0.1.0'\n  },\n  // Options object with capabilities\n  {\n    capabilities: {\n      tools: {\n        preview_file: {\n          description: 'Preview local HTML file and capture screenshot',\n          inputSchema: {\n            // ... schema definition\n          }\n        }\n      }\n    }\n  }\n);\n```\n\nKey points:\n- Server constructor takes separate metadata and options objects\n- Tools are declared in capabilities.tools\n- Each tool needs a description and inputSchema\n- Screenshots are saved to a local `screenshots/` directory\n\n## Debugging\n\n1. Use the MCP Inspector:\n```bash\nnpx @modelcontextprotocol/inspector\n```\n\n2. Connect with:\n   - Transport Type: STDIO\n   - Command: node\n   - Arguments: /path/to/build/index.js\n\n3. Check Claude OS logs if tools don't appear in the dropdown\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanivore%2Fmcp-file-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanivore%2Fmcp-file-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanivore%2Fmcp-file-preview/lists"}