Skip to main content
Glama

Web Proxy MCP Server

by mako10k
index.js2.36 kB
#!/usr/bin/env node /** * Web Proxy MCP Server * HTTP/HTTPS proxy with request/response analysis capabilities */ import { ProxyServer } from './proxy/proxy-server.js'; import { MCPTools } from './tools/mcp-tools.js'; class WebProxyMCPServer { constructor() { this.proxyServer = new ProxyServer(); this.mcpTools = new MCPTools(this.proxyServer); this.running = false; } async start() { try { // MCP Server setup process.stdin.on('data', async (data) => { try { const request = JSON.parse(data.toString()); const response = await this.handleMCPRequest(request); this.sendResponse(response); } catch (error) { console.error('MCP Request error:', error.message); this.sendError(error.message); } }); // Send server info this.sendResponse({ jsonrpc: '2.0', result: { protocolVersion: '2024-11-05', capabilities: { tools: {} }, serverInfo: { name: 'web-proxy-mcp', version: '1.0.0' } } }); this.running = true; console.error('Web Proxy MCP Server started'); } catch (error) { console.error('Failed to start server:', error); process.exit(1); } } async handleMCPRequest(request) { const { method, params } = request; switch (method) { case 'tools/list': return { jsonrpc: '2.0', id: request.id, result: { tools: this.mcpTools.getToolList() } }; case 'tools/call': const result = await this.mcpTools.callTool(params.name, params.arguments); return { jsonrpc: '2.0', id: request.id, result: { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } }; default: throw new Error(`Unknown method: ${method}`); } } sendResponse(response) { process.stdout.write(JSON.stringify(response) + '\n'); } sendError(message) { this.sendResponse({ jsonrpc: '2.0', error: { code: -1, message } }); } } // Start server const server = new WebProxyMCPServer(); server.start().catch(console.error);

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mako10k/mcp-web-proxy'

If you have feedback or need assistance with the MCP directory API, please join our Discord server