gregra81/mcp-server-remote-architecture
If you are the rightful owner of mcp-server-remote-architecture and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server provides a modular and dynamic architecture for integrating local and remote tools, offering a seamless experience for developers and users.
MCP Tools Demo
A Model Context Protocol (MCP) implementation showcasing clean, modular tool architecture with local and remote tools support and an interactive browser client.
๐ Features
- ๐๏ธ Clean Architecture: Modular tool design with
MCPToolsManager
- ๐ง 8 Demo Tools: 4 local + 4 remote tools working seamlessly together
- ๐ Remote Tools Support: Load tools dynamically from external APIs
- ๐ Browser Client: Interactive web interface for testing all tools
- ๐ง Admin Panel: Powerful web-based tool management with on/off toggles
- โก Tool Configuration: JSON-based tool state management with persistence
- ๐ก Multiple Server Options: Stdio, Simple HTTP, and Remote Tools servers
- ๐ Type Safety: Full TypeScript implementation with Zod validation
๐ Quick Start
1. Installation
git clone <your-repo-url>
cd mcp-hello-world
npm install
2. Full Demo (Local + Remote Tools)
Start both servers for the complete experience:
# Terminal 1: Start remote tools server (4 remote tools)
npm run start:remote
# Terminal 2: Start HTTP server (4 local + 4 remote = 8 total tools)
npm run start:http
Then open:
- Client Interface: http://localhost:3000/examples/client.html
- Admin Panel: http://localhost:3000/examples/admin.html
3. Local Tools Only
# Just local tools (4 tools)
REMOTE_TOOLS_ENABLED=false npm run start:http
4. Command Line Usage (Cursor/Claude)
npm run build
node dist/index.js # Stdio MCP server
๐๏ธ Architecture
Modular Structure
mcp-hello-world/
โโโ src/
โ โโโ index.ts # Main MCP stdio server
โ โโโ mcp-tools-manager.ts # Generic tools manager (local + remote)
โ โโโ simple-http-server.ts # HTTP wrapper with remote tools support
โ โโโ tool-config.ts # ๐ง Tool configuration manager
โ โโโ tools/ # ๐ Local tools directory
โ โ โโโ index.ts # Tools exports and registry
โ โ โโโ greg-test-tool.ts # Mood testing tool
โ โ โโโ http-post-tool.ts # Generic HTTP POST
โ โ โโโ weather-tool.ts # Weather API integration
โ โ โโโ create-post-tool.ts # JSONPlaceholder posts
โ โโโ types/mcp.ts # TypeScript definitions
โโโ examples/
โ โโโ client.html # ๐ Interactive browser client
โ โโโ admin.html # ๐ง Admin panel for tool management
โ โโโ remote-tools-api-example.json # Remote tools definition
โ โโโ remote-tool-server-example.js # ๐ Remote tools server
โโโ tool-config.json # โก Tool configuration state
โโโ dist/ # Compiled JavaScript
Key Design Principles
- Single Source of Truth: Local tools in
src/tools/
, remote tools via API - Generic Manager:
MCPToolsManager
automatically loads all tools - Tool Configuration: JSON-based persistent tool state management
- Hot-loadable: Remote tools can be added/updated without restart
- Multiple Interfaces: Same tools work with stdio, HTTP, and browser
- Admin Control: Web-based tool management with real-time toggles
๐ง Available Tools
๐ Local Tools (4)
- ๐ญ Greg Test (
greg-test
) - Mood testing tool - ๐ HTTP POST (
http_post
) - Generic HTTP requests - ๐ค๏ธ Weather (
get_weather
) - Weather API with OpenWeatherMap - ๐ Create Post (
create_post
) - JSONPlaceholder integration
๐ Remote Tools (4)
- ๐งฎ Calculate Tax (
calculate_tax
) - Tax calculations - ๐ง Send Email (
send_email
) - Mock email sending - ๐ผ๏ธ Image OCR (
image_ocr
) - Mock text extraction - ๐๏ธ Database Query (
database_query
) - Mock SQL queries
๐ Remote Tools Support
Load tools dynamically from external APIs alongside local tools.
Quick Configuration
const toolsManager = new MCPToolsManager({
enabled: true,
toolsUrl: 'http://localhost:3001/mcp/tools',
timeout: 5000,
retryAttempts: 2,
});
await toolsManager.initialize();
Remote Tools API Format
Your remote API should return:
{
"tools": [
{
"name": "calculate_tax",
"description": "Calculate tax for given amount",
"executeUrl": "https://api.example.com/tools/calculate-tax",
"method": "POST",
"inputSchema": {
"type": "object",
"properties": {
"amount": { "type": "number" },
"rate": { "type": "number" }
},
"required": ["amount", "rate"]
}
}
]
}
Environment Configuration
export REMOTE_TOOLS_ENABLED=true # Enable/disable remote tools
export REMOTE_TOOLS_URL=http://localhost:3001/mcp/tools
export REMOTE_TOOLS_TIMEOUT=5000
export REMOTE_TOOLS_RETRY_ATTEMPTS=2
๐ง Admin Panel
Powerful web-based tool management interface for controlling tool availability:
Features
- ๐๏ธ Tool Toggles: Enable/disable individual tools with visual switches
- ๐ Real-time Statistics: Live dashboard showing enabled/disabled counts
- โก Bulk Operations: Enable All / Disable All tools at once
- ๐ Auto-refresh: Automatically syncs with server every 30 seconds
- ๐จ Modern UI: Beautiful, responsive interface with visual feedback
- ๐พ Persistent State: Tool configurations saved to
tool-config.json
Default Behavior
All tools are disabled by default - you must enable them via the admin panel.
Usage
- Start server:
npm run start:http
- Open admin panel: http://localhost:3000/examples/admin.html
- Toggle tools on/off as needed
- Use client interface to test: http://localhost:3000/examples/client.html
Tool Configuration File
The admin panel manages tool-config.json
with this structure:
[
{
"toolName": "greg-test",
"enabled": true
},
{
"toolName": "http_post",
"enabled": false
}
]
๐ Browser Client
The interactive web client dynamically loads and displays ONLY enabled tools:
Features
- ๐ Auto-Discovery: Loads enabled tools from server (local + remote)
- ๐ฏ Quick Tests: One-click testing for enabled tools
- ๐ Tool Statistics: Shows local vs remote breakdown
- โ Health Monitoring: Real-time server status
- ๐ Dynamic Updates: Reflects tool availability in real-time
Usage
- Start servers:
npm run start:remote && npm run start:http
- Enable tools in admin panel: http://localhost:3000/examples/admin.html
- Use client interface: http://localhost:3000/examples/client.html
- Click "Load Available Tools" to see enabled tools
- Use quick test buttons or detailed tool information
๐ Running the Servers
HTTP Server (Browser Demo)
npm run start:http # Local tools only
# OR with remote tools:
npm run start:remote # Terminal 1: Remote tools server
npm run start:http # Terminal 2: HTTP server (8 tools total)
Stdio Server (Cursor/Claude Integration)
npm run build
node dist/index.js
Then add to your MCP configuration:
{
"mcpServers": {
"demo-tools": {
"command": "node",
"args": ["path/to/mcp-server-remote-architecture/dist/index.js"]
}
}
}
Important for Cursor/Claude:
- All tools are disabled by default - you'll see 0 tools initially
- Enable tools first: Use the admin panel to enable desired tools
- Run:
npm run start:http
- Open: http://localhost:3000/examples/admin.html
- Enable tools you want to use
- Restart Cursor's MCP connection to see tools
- Run:
- Tool state persists across server restarts
๐ง Admin API Endpoints
The server provides dedicated admin endpoints for tool management:
GET /admin/tools
Get all tool configurations (enabled and disabled):
{
"success": true,
"tools": [
{
"toolName": "greg-test",
"enabled": true,
"type": "local",
"description": "amazing tool"
}
],
"count": 4
}
POST /admin/tools/:toolName/toggle
Toggle a tool's enabled/disabled state:
curl -X POST http://localhost:3000/admin/tools/greg-test/toggle \
-H "Content-Type: application/json" \
-d '{"enabled": true}'
Response:
{
"success": true,
"message": "Tool 'greg-test' enabled",
"toolName": "greg-test",
"enabled": true,
"timestamp": "2025-06-21T18:29:38.323Z"
}
๐ง Troubleshooting
Cursor/Claude Shows 0 Tools
Problem: MCP server shows red dot and 0 tools in Cursor Solution:
- Tools are disabled by default - enable them via admin panel
- Ensure tool configuration file exists in project directory
- Restart Cursor's MCP connection after enabling tools
Tool Configuration Not Found
Problem: Server creates new config with all tools disabled Solution: Tool config uses absolute paths - works regardless of working directory
๐งช Testing
Quick API Tests
# Test tool endpoints
curl http://localhost:3000/mcp/tools # Enabled tools only
curl http://localhost:3000/mcp/tools/local # Enabled local tools only
curl http://localhost:3000/mcp/tools/remote # Enabled remote tools only
# Test admin endpoints
curl http://localhost:3000/admin/tools # All tool configurations
curl -X POST http://localhost:3000/admin/tools/greg-test/toggle \
-H "Content-Type: application/json" \
-d '{"enabled": true}' # Enable a tool
# Test specific tools (only if enabled)
curl http://localhost:3000/mcp/test/greg-test
curl http://localhost:3000/mcp/test/calculate_tax # Remote tool
Tool Calls
# Note: Tools must be enabled first via admin panel
curl -X POST http://localhost:3000/mcp/call-tool \
-H "Content-Type: application/json" \
-d '{"tool": "calculate_tax", "parameters": {"amount": 100, "rate": 0.08}}'
๐ง Adding New Tools
Local Tools
- Create
src/tools/my-tool.ts
- Export from
src/tools/index.ts
- Restart server to load new tool
- Enable the tool via admin panel (disabled by default)
Remote Tools
- Add tool definition to your remote API
- Implement the execution endpoint
- Refresh remote tools or restart server
- Enable the tool via admin panel (disabled by default)
Tool State Management
- All new tools are disabled by default
- Use the admin panel to enable/disable tools
- Tool states persist in
tool-config.json
- Only enabled tools appear in
/mcp/tools
endpoints
๐ License
MIT License - see LICENSE file for details.