Skip to content

Commit

Permalink
Initial commit: WebPerfect MCP Server
Browse files Browse the repository at this point in the history
  • Loading branch information
splendasucks committed Dec 20, 2024
0 parents commit cf454c3
Show file tree
Hide file tree
Showing 8 changed files with 888 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Dependencies
node_modules/
package-lock.json
yarn.lock

# Build output
build/
dist/

# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
.DS_Store

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Environment variables
.env
.env.local
.env.*.local

# Test coverage
coverage/

# Temporary files
tmp/
temp/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 WebPerfect-MCP

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions LICENSE.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p>MIT License</p>
<p>Copyright (c) 2024 WebPerfect-MCP</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &quot;Software&quot;), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</p>
168 changes: 168 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<h1 id="webperfect-mcp-server">WebPerfect MCP Server</h1>
<p>An intelligent MCP server with a fully automated batch pipeline for web-ready images. Features include noise reduction, auto levels/curves, JPEG artifact removal, 4K resizing, smart sharpening with shadow/highlight enhancement, and advanced WebP conversion. Optimized compression delivers smaller files without sacrificing quality.</p>
<h2 id="features">Features</h2>
<h3 id="advanced-image-processing-pipeline">Advanced Image Processing Pipeline</h3>
<ol>
<li>Strong noise reduction using median filtering</li>
<li>Intelligent auto levels and curves based on image entropy</li>
<li>Advanced texture enhancement with modulation and sharpening</li>
<li>Smart resolution optimization (up to 4K)</li>
<li>Optimized WebP conversion</li>
</ol>
<h3 id="tools">Tools</h3>
<h4 id="process_images"><code>process_images</code></h4>
<p>Process and optimize a batch of images with advanced enhancements.</p>
<pre><code class="language-typescript">{
<span class="hljs-attr">inputDir</span>: <span class="hljs-built_in">string</span>; <span class="hljs-comment">// Directory containing input images</span>
<span class="hljs-attr">outputDir</span>: <span class="hljs-built_in">string</span>; <span class="hljs-comment">// Directory for optimized output</span>
}
</code></pre>
<h3 id="resources">Resources</h3>
<h4 id="resource-templates">Resource Templates</h4>
<ul>
<li>
<p><code>logs/{date}</code>: Access processing logs by date (YYYY-MM-DD)</p>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;date&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;2024-01-20&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;entries&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;timestamp&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;2024-01-20T10:00:00Z&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;imagesProcessed&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">15</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;totalInputSize&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;5.2MB&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;totalOutputSize&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;1.1MB&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;compressionRatio&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;78.8%&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;averageProcessingTime&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;1.2s&quot;</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>
</code></pre>
</li>
<li>
<p><code>stats/monthly/{month}</code>: Monthly statistics (YYYY-MM)</p>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;month&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;2024-01&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;totalImagesProcessed&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">450</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;averageCompressionRatio&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;82%&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;popularFormats&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;input&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;JPEG&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;PNG&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;output&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;WebP&quot;</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;totalStorageSaved&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;150MB&quot;</span>
<span class="hljs-punctuation">}</span>
</code></pre>
</li>
</ul>
<h4 id="static-resources">Static Resources</h4>
<ul>
<li>
<p><code>stats/summary</code>: Overall processing statistics</p>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;totalImagesProcessed&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">5280</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;averageCompressionRatio&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;81%&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;totalStorageSaved&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;1.8GB&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;popularEnhancements&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-string">&quot;noise_reduction&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">&quot;auto_levels_curves&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">&quot;texture_enhancement&quot;</span>
<span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;performanceMetrics&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;averageProcessingTime&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;1.5s&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;peakThroughput&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;45 images/minute&quot;</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
</code></pre>
</li>
<li>
<p><code>config/optimization-presets</code>: Available optimization presets</p>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;presets&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;web_standard&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;maxWidth&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">1920</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;format&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;webp&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;quality&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">85</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;enhancements&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;noise_reduction&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;auto_levels_curves&quot;</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;web_high_quality&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;maxWidth&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">3840</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;format&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;webp&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;quality&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">90</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;enhancements&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-string">&quot;noise_reduction&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">&quot;auto_levels_curves&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">&quot;texture_enhancement&quot;</span>
<span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;thumbnail&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;maxWidth&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">400</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;format&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;webp&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;quality&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">80</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;enhancements&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;noise_reduction&quot;</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
</code></pre>
</li>
</ul>
<h2 id="installation">Installation</h2>
<ol>
<li>Clone the repository:</li>
</ol>
<pre><code class="language-bash">git <span class="hljs-built_in">clone</span> https://github.com/splendasucks/webperfect-mcp-server.git
<span class="hljs-built_in">cd</span> webperfect-mcp-server
</code></pre>
<ol start="2">
<li>Install dependencies:</li>
</ol>
<pre><code class="language-bash">npm install
</code></pre>
<ol start="3">
<li>Build the server:</li>
</ol>
<pre><code class="language-bash">npm run build
</code></pre>
<h2 id="usage-with-claude">Usage with Claude</h2>
<ol>
<li>Add the server to your Claude MCP settings (typically in <code>claude_desktop_config.json</code>):</li>
</ol>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;mcpServers&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;webperfect&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;command&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;node&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;args&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;/path/to/webperfect-mcp-server/build/index.js&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;env&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span><span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
</code></pre>
<ol start="2">
<li>
<p>Restart Claude to load the MCP server.</p>
</li>
<li>
<p>The server will be available through Claude's MCP tools and resources:</p>
</li>
</ol>
<pre><code class="language-typescript"><span class="hljs-comment">// Process a batch of images</span>
&lt;use_mcp_tool&gt;
<span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">server_name</span>&gt;</span>webperfect<span class="hljs-tag">&lt;/<span class="hljs-name">server_name</span>&gt;</span></span>
<span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">tool_name</span>&gt;</span>process_images<span class="hljs-tag">&lt;/<span class="hljs-name">tool_name</span>&gt;</span></span>
<span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">arguments</span>&gt;</span>
{
&quot;inputDir&quot;: &quot;/path/to/input&quot;,
&quot;outputDir&quot;: &quot;/path/to/output&quot;
}
<span class="hljs-tag">&lt;/<span class="hljs-name">arguments</span>&gt;</span></span>
&lt;/use_mcp_tool&gt;

<span class="hljs-comment">// Access processing statistics</span>
<span class="language-xml"><span class="hljs-tag">&lt;<span class="hljs-name">access_mcp_resource</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">server_name</span>&gt;</span>webperfect<span class="hljs-tag">&lt;/<span class="hljs-name">server_name</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">uri</span>&gt;</span>stats/summary<span class="hljs-tag">&lt;/<span class="hljs-name">uri</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">access_mcp_resource</span>&gt;</span></span>
</code></pre>
<h2 id="requirements">Requirements</h2>
<ul>
<li>Node.js &gt;= 16</li>
<li>Sharp image processing library</li>
<li>Model Context Protocol SDK</li>
</ul>
<h2 id="license">License</h2>
<p>MIT</p>
Loading

0 comments on commit cf454c3

Please sign in to comment.