MCP Factory Platform Server - AI Agent interface layer for platform management functions
Converts the mcp-factory-platform backend REST API into MCP tools, enabling AI Agents (such as Claude) to manage users, wallets, billing and other platform functions through natural language conversation.
get_oauth_login_url()- Get OAuth login URLexplain_authentication()- Detailed authentication configuration instructionscreate_api_key()- Create new API Key β NEWlist_api_keys()- List all API Keys β NEWdelete_api_key()- Delete API Key β NEWget_api_key_stats()- Get API Key usage statistics β NEW
get_user_profile()- Get user profileupdate_user_profile()- Update user profileget_user_account()- Get account summaryget_user_analytics()- User revenue analytics
register_mcp_service()- Register new MCP service β NEWlist_my_services()- List all my services β NEWupdate_mcp_service()- Update service information β NEWdelete_mcp_service()- Delete service β NEWget_service_revenue()- View service revenue statistics β NEW
get_consumer_wallet()- Get consumer wallet detailsget_provider_wallet()- Get provider wallet detailscreate_charge()- Create charge ordertransfer_credits()- Transfer credits between usersget_transactions()- Get transaction records
request_withdrawal()- Request withdrawal β NEWlist_withdrawals()- List withdrawal records β NEWget_withdrawal_detail()- View withdrawal details β NEW
consume_service()- Consume service and billlist_services()- List available MCP servicesget_service_endpoint()- Get service endpoint detailscheck_server_balance()- Check server balanceget_server_analytics()- Get server usage analytics
test_platform_connection()- Test platform connection
Total: 28 MCP Tools β¨ Complete bilateral market closed loop!
- Python >= 3.10
mcp-factory-platformbackend service (Production: https://mcp-factory-beta.up.railway.app)
-
Visit login page
https://mcp-factory-beta.up.railway.app/auth/login -
Authorize with GitHub account
- Automatically receive 1000 Beta credits after authorization
-
Generate API Key
- Visit: https://mcp-factory-beta.up.railway.app/auth/api-keys
- Click "Create API Key"
- Configuration example:
- Name: "My MCP Server"
- Scopes: ["read", "write"]
- Expires: 30 days
-
Copy generated API Key
- Format:
mcp_key_xxxxxxxxxxxxxxxxx
- Format:
# 1. Copy environment configuration template
cp env.example .env
# 2. Edit .env file
nano .envAdd the following content:
# Platform backend address (production)
PLATFORM_API_BASE=https://mcp-factory-beta.up.railway.app
# API authentication key (obtained from platform)
PLATFORM_API_KEY=mcp_key_your_api_key_here
# API timeout
API_TIMEOUT=30.0# Install dependencies
uv sync
# Test server
uv run python server.pyAdd to .cursor/mcp.json:
{
"mcpServers": {
"mcp-factory-platform-server": {
"command": "/absolute/path/to/project/.venv/bin/python",
"args": ["/absolute/path/to/project/server.py"],
"cwd": "/absolute/path/to/mcp-factory-platform-server"
}
}
}Add to claude_desktop_config.json:
{
"mcpServers": {
"mcp-factory-platform-server": {
"command": "uv",
"args": ["run", "python", "server.py"],
"cwd": "/path/to/mcp-factory-platform-server"
}
}
}You: "Test platform connection"
Claude:
β
Platform connection test successful
Health status: healthy
Service: mcp-factory-platform-foundation-early-access
Version: 0.9.0
You: "Get my user profile"
Claude: Calling get_user_profile() ...
You: "Check my wallet balance"
Claude: Calling get_consumer_wallet() and get_provider_wallet() ...
You: "What MCP services are available"
Claude: Calling list_services() ...
mcp-factory-platform-server/
βββ Dockerfile # Docker image configuration
βββ .dockerignore # Docker build exclusions
βββ docker-compose.yml # Docker Compose orchestration
βββ config.yaml # Server configuration
βββ pyproject.toml # Python project configuration
βββ server.py # Server entry file
βββ .env # Environment configuration (need to create)
βββ env.example # Environment configuration example
βββ README.md # This document
βββ CHANGELOG.md # Version changelog
βββ tools/ # Tools implementation directory
β βββ auth_management.py # Authentication management tools (2)
β βββ api_key_management.py # API Key management tools (4)
β βββ user_management.py # User management tools (4)
β βββ service_management.py # MCP service management tools (5)
β βββ wallet_management.py # Wallet management tools (5)
β βββ withdrawal_management.py # Withdrawal management tools (3)
β βββ billing_management.py # Billing management tools (5)
β βββ platform_api_adapter.py # Platform API adapter
βββ resources/ # Resources implementation directory
βββ prompts/ # Prompt template directory
- Create a new file or edit existing file in
tools/directory - Define tools using
@server.tool()decorator - Call platform API using
httpx - Add
Authorizationheader for authentication
Example:
import httpx
import os
PLATFORM_API_BASE = os.getenv("PLATFORM_API_BASE", "http://localhost:8001")
PLATFORM_API_KEY = os.getenv("PLATFORM_API_KEY", "")
def _get_headers() -> dict:
headers = {"Content-Type": "application/json"}
if PLATFORM_API_KEY:
headers["Authorization"] = PLATFORM_API_KEY
return headers
async def my_new_tool(param: str) -> str:
"""Tool description"""
async with httpx.AsyncClient(timeout=30.0) as client:
response = await client.get(
f"{PLATFORM_API_BASE}/api/endpoint",
headers=_get_headers()
)
if response.status_code == 200:
return f"Success: {response.json()}"
return f"Failed: HTTP {response.status_code}"# Ruff check
uv run ruff check .
# Auto-fix
uv run ruff check --fix .
# Format
uv run ruff format .# Build and start
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down# Build image
docker build -t mcp-factory-platform-server .
# Run container
docker run -d \
--name mcp-platform-server \
--env-file .env \
mcp-factory-platform-server- User visits
/auth/loginin browser - Redirects to GitHub OAuth authorization page
- After user authorization, platform creates account and grants 1000 Beta credits
- User generates API Key on platform management page
All MCP tools require API Key authentication:
- Configure
PLATFORM_API_KEYin.envfile - API Key format:
mcp_key_xxx - Restart MCP server to take effect
- β Available: All query and read functions
- β Available: Use platform's 1000 complimentary credits
β οΈ Limited: Recharge function (not available in Beta)β οΈ Limited: Withdrawal function (not available in Beta)
- Platform Backend: mcp-factory-platform
- Factory Framework: mcp-factory
- API Documentation: https://mcp-factory-beta.up.railway.app/docs
- Beta Guide: https://mcp-factory-beta.up.railway.app/beta-guide
Solution:
- Ensure
.envfile is created - Check if
PLATFORM_API_KEYis correctly filled in - Restart MCP server
Solution:
- Check if
PLATFORM_API_BASEis correct - Confirm platform backend is running
- Check network connection
Solution:
- API Key may have expired or been revoked
- Regenerate API Key
- Update
.envfile and restart
Use MCP tools to view help:
explain_authentication()- Detailed authentication instructionstest_platform_connection()- Test connectionplatform_status()- View platform status
MIT License
See CHANGELOG.md for version history.
Version: 1.3.0
Last Updated: 2025-10-18
Author: MCP Factory Team
Now mcp-factory-platform-server supports complete bilateral market business processes:
Service Provider Workflow:
Register Service β Set Pricing β Earn Revenue β Request Withdrawal
Service Consumer Workflow:
Browse Services β Recharge Wallet β Consume Services β View Transactions
- π Self-service API Key Management - No need to depend on web pages, AI Agent can directly create and manage API Keys
- π₯οΈ MCP Service Registration - Service providers can register and manage their own MCP services through AI Agent
- πΈ Withdrawal Function - Service providers can withdraw earnings to bank account/Alipay/WeChat
These features complete the platform's core business loop, making mcp-factory-platform a true bilateral market platform!