CTeaminfo/mcp_superiorapis_remote
If you are the rightful owner of mcp_superiorapis_remote 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 MCP SuperiorAPIs Server allows dynamic integration of Superior API through HTTP/SSE protocols, providing MCP tools for AI clients.
MCP SuperiorAPIs Remote
By deploying this MCP Remote project, you can dynamically integrate Superior API via HTTP/SSE protocols and provide it externally as an MCP tool for AI clients to call.
If you need to integrate using stdio
mode, please refer to: CTeaminfo/mcp_superiorapis_local
š Project Structure
mcp_superiorapis_remote/
āāā src/mcp_superiorapis_remote/ # Main program
ā āāā __init__.py # Package initialization
ā āāā config.py # Configuration management
ā āāā mcp_server_http.py # HTTP JSON-RPC 2.0 server
ā āāā mcp_server_sse.py # SSE server
āāā tests/ # Test files
āāā .env.example # Environment variable example
āāā .gitignore # Git ignore file
āāā mcp_config_example.json # MCP client config example
āāā test_mcp_config.py # Config test script
āāā pyproject.toml # Project config & dependencies
āāā README.md # Project documentation (this file)
š Quick Start
1. Environment Preparation
Prerequisites:
- Python 3.12+
- Superior APIs Token (How to get)
2. Clone the Project
# Using HTTPS
git clone https://github.com/CTeaminfo/mcp_superiorapis_remote.git
# Using SSH
git clone git@github.com:CTeaminfo/mcp_superiorapis_remote.git
cd mcp_superiorapis_remote
3. Install uv (if not installed)
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or use pip
pip install uv
4. Install Dependencies
# Create virtual environment
uv venv --python 3.12
# Install production dependencies
uv sync
# Or install development dependencies (includes test tools)
uv sync --dev
If you encounter virtual environment errors, try:
# Windows (run in cmd or PowerShell)
rmdir /s /q .venv
uv venv --python 3.12
uv sync
# Windows (WSL or Git Bash)
# If unable to delete, restart terminal or use a different name
uv venv .venv_new --python 3.12
rm -rf .venv && mv .venv_new .venv
uv sync
# macOS/Linux
rm -rf .venv
uv venv --python 3.12
uv sync
5. Configure Environment Variables (Optional)
# Copy environment variable example file (optional)
cp .env.example .env
# Edit the .env file for custom configuration (optional)
nano .env # Or use your preferred editor
Token Authentication Instructions:
# MCP server acts as a proxy, token is provided by the client request
# Authenticate via HTTP header: token: YOUR_TOKEN
Optional settings (with defaults):
HTTP_SERVER_PORT=8000
SSE_SERVER_PORT=8080
LOG_LEVEL=INFO
DEV_MODE=false
6. Start the Server
# Using uv scripts (recommended)
uv run start-http # HTTP server (port 8000)
uv run start-sse # SSE server (port 8080)
# Or run directly
uv run mcp-superiorapis-http
uv run mcp-superiorapis-sse
7. Verify Deployment
# Check server configuration
uv run config
# Check HTTP server health
curl http://localhost:8000/health
# Basic function test (no token required)
uv run test-config
# Full function test (requires Superior APIs token)
uv run test-config --token YOUR_SUPERIOR_APIS_TOKEN
š§ Development Commands
Use uv
built-in scripts:
# Server startup
uv run start-http # Start HTTP server
uv run start-sse # Start SSE server
# Development tools
uv run test # Run tests
uv run lint # Lint code
uv run format # Format code
uv run typecheck # Type check
# Config check
uv run config # Check configuration
uv run test-config # Test server connection
ā ļø Troubleshooting
-
Invalid Token Error
- Make sure you obtained the correct token from Superior APIs
- Token should be provided in the client request, not set on the server
-
Port Occupied Error
- Change
HTTP_SERVER_PORT
orSSE_SERVER_PORT
in.env
- Or use
lsof -i :8000
to check port usage
- Change
-
Dependency Installation Failure
- Ensure Python 3.12+ is installed:
python --version
- Ensure uv is installed:
uv --version
- Virtual environment issues: On Windows use
rmdir /s /q .venv
in cmd/PowerShell, or refer to the WSL solution above - Try clearing cache:
uv cache clean
- Ensure Python 3.12+ is installed:
-
Server Startup Failure
- Check configuration:
uv run config
- View detailed errors: set
LOG_LEVEL=DEBUG
in.env
- Check configuration:
š MCP Client Integration
Multi-Instance Deployment Scenario
Users may need to configure multiple MCP server instances with different tokens to access different Superior APIs toolsets:
# Start multiple server instances with different ports
HTTP_SERVER_PORT=8000 uv run start-http &
HTTP_SERVER_PORT=8001 uv run start-http &
SSE_SERVER_PORT=8080 uv run start-sse &
Claude Desktop
Configure MCP server using environment variables:
{
"mcpServers": {
"mcp-superiorapis-main": {
"command": "uv",
"args": ["run", "mcp-superiorapis-http"],
"env": {
"TOKEN": "your_main_superior_apis_token_here"
}
}
}
}
Cursor (SSE Mode)
# Start SSE server
uv run start-sse
# Cursor connects to: http://localhost:8080/sse
HTTP Client
# Start HTTP server
uv run start-http
# Send JSON-RPC 2.0 request to: http://localhost:8000/mcp
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-H "token: YOUR_SUPERIOR_APIS_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
š ļø Development
Testing
Unit Tests
# Run unit tests (no need to start server)
uv run test
Integration Tests
# Start server first
uv run start-http &
# Basic function test
uv run test-config
# Full function test (requires Superior APIs token)
uv run test-config --token YOUR_TOKEN
# Check configuration
uv run test-config --config
Code Quality
# Format code
uv run format
# Static checks
uv run lint
uv run typecheck
š Architecture Overview
Dynamic Tool Generation Flow
- Token Authentication ā Superior APIs
- Fetch Plugin List ā
plugin list
- Parse OpenAPI Spec ā Auto-generate MCP tool definitions
- Cache Tool List ā Improve performance
- Handle Tool Calls ā Proxy to Superior APIs
Supported MCP Methods
initialize
- Initialize connectiontools/list
- Get available tool listtools/call
- Call specific tool
Error Handling
- Automatic retry on network errors
- Clear prompt on token authentication failure
- Detailed logs for JSON parsing errors
- Complete JSON-RPC 2.0 error responses
šÆ Dify Integration (Latest Update)
Dify MCP Standalone Server
A specialized server specifically designed for Dify 1.7.0 MCP integration:
# Start Dify-specific MCP server (port 9000)
python3 dify_mcp_standalone.py
Key Features:
- OpenAPI Format Preservation: Maintains original Superior APIs OpenAPI structure
- Method-Specific Parsing: Correctly handles GET (parameters array) vs POST (requestBody)
- Dify-Optimized: Designed specifically for Dify MCP SSE plugin compatibility
- Enhanced Debugging: Comprehensive logging for troubleshooting
Configuration:
{
"name": "Superior APIs",
"url": "http://your-server:9000/mcp",
"headers": {
"token": "your_superior_apis_token"
}
}
Testing:
# Test Dify MCP endpoint
curl -X POST http://localhost:9000/mcp \
-H "Content-Type: application/json" \
-H "token: YOUR_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Recent Fixes:
- ā Fixed 'properties' access error in parameter parsing
- ā
Corrected OpenAPI path structure (
plugin.interface
vsplugin_item.openapi
) - ā Implemented proper GET/POST method differentiation
- ā Enhanced parameter type allocation (query/path/header/body)
š§ Configuration Options
For full configuration options, see .env.example
:
Variable Name | Default | Description |
---|---|---|
HTTP_SERVER_PORT | 8000 | HTTP server port |
SSE_SERVER_PORT | 8080 | SSE server port |
LOG_LEVEL | INFO | Log level |
DEV_MODE | false | Development mode (hot reload) |
SERVER_HOST | 0.0.0.0 | Server host address |
CACHE_EXPIRY | 3600 | Tool cache expiry (seconds) |
Token Authentication Note: Superior APIs Token is provided by the client in the HTTP header, not set on the server. Use the token: YOUR_TOKEN
header for authentication.