# Authentication Source: https://docs.mcpfy.ai/api-reference/authentication Learn how to authenticate with the MCPfy API and generate MCP tokens ## Overview The MCPfy API uses Bearer token authentication for secure access to all endpoints. You'll need to obtain an API key from your dashboard and use it to generate MCP tokens for your applications. ## Getting Your API Key Navigate to [mcpfy.ai](https://mcpfy.ai) and log in to your account. In the sidebar, go to **API Keys** section. Either create a new API key or use an existing one from the list. Store your API key securely and never expose it in client-side code or public repositories. ## Using MCP Tokens Once you have generated an MCP token, use it in subsequent API calls: ```bash curl --location 'https://api.mcpfy.ai/dev/v1/your-endpoint' \ --header 'Authorization: Bearer mcp_token_abc123xyz789' \ --header 'Content-Type: application/json' ``` # Generate MCP URL Source: https://docs.mcpfy.ai/api-reference/endpoint/generate-url POST /generate-mcp-token Generate a new MCP URL for a specific server and customer ```bash cURL - Basic Request curl --location 'https://api.mcpfy.ai/dev/v1/generate-mcp-token' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data-raw '{ "mcpServerId": "63re68ca47d201fa9d2974fa", "customerDetails": { "primaryIdentity": "user@example.com" } }' ``` ```bash cURL - With Full Metadata curl --location 'https://api.mcpfy.ai/dev/v1/generate-mcp-token' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --data-raw '{ "mcpServerId": "63re68ca47d201fa9d2974fa", "customerDetails": { "primaryIdentity": "john.doe@acme.com", "metadata": { "name": "John Doe", "company": "Acme Corp", "department": "Engineering", "role": "Senior Developer", "region": "US-East" } } }' ``` ```javascript Node.js - Fetch API const generateMCPToken = async () => { const response = await fetch('https://api.mcpfy.ai/dev/v1/generate-mcp-token', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' }, body: JSON.stringify({ mcpServerId: "63re68ca47d201fa9d2974fa", customerDetails: { primaryIdentity: "user@example.com", metadata: { name: "John Doe", company: "Acme Corp", department: "Engineering" } } }) }); const data = await response.json(); return data; }; // Usage generateMCPToken() .then(result => console.log(result)) .catch(error => console.error('Error:', error)); ``` ```javascript Node.js - Axios const axios = require('axios'); const generateMCPToken = async () => { try { const response = await axios.post('https://api.mcpfy.ai/dev/v1/generate-mcp-token', { mcpServerId: "63re68ca47d201fa9d2974fa", customerDetails: { primaryIdentity: "user@example.com", metadata: { name: "John Doe", company: "Acme Corp", department: "Engineering" } } }, { headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } }); return response.data; } catch (error) { console.error('Error generating MCP token:', error.response?.data || error.message); throw error; } }; // Usage generateMCPToken() .then(result => console.log('Token generated:', result)) .catch(error => console.error('Failed to generate token')); ``` ```python Python - Requests import requests import json def generate_mcp_token(): url = "https://api.mcpfy.ai/dev/v1/generate-mcp-token" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } payload = { "mcpServerId": "63re68ca47d201fa9d2974fa", "customerDetails": { "primaryIdentity": "user@example.com", "metadata": { "name": "John Doe", "company": "Acme Corp", "department": "Engineering" } } } try: response = requests.post(url, headers=headers, json=payload, timeout=30) response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: print(f"Error generating MCP token: {e}") raise # Usage try: result = generate_mcp_token() print("Token generated:", result) except Exception as error: print(f"Failed to generate token: {error}") ``` ```python Python - HTTPX (Async) import httpx import asyncio async def generate_mcp_token(): url = "https://api.mcpfy.ai/dev/v1/generate-mcp-token" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } payload = { "mcpServerId": "63re68ca47d201fa9d2974fa", "customerDetails": { "primaryIdentity": "user@example.com", "metadata": { "name": "John Doe", "company": "Acme Corp", "department": "Engineering" } } } async with httpx.AsyncClient() as client: try: response = await client.post(url, headers=headers, json=payload, timeout=30) response.raise_for_status() return response.json() except httpx.RequestError as e: print(f"Error generating MCP token: {e}") raise # Usage async def main(): try: result = await generate_mcp_token() print("Token generated:", result) except Exception as error: print(f"Failed to generate token: {error}") # Run the async function asyncio.run(main()) ``` ```php PHP - cURL ' ]; $payload = [ 'mcpServerId' => '63re68ca47d201fa9d2974fa', 'customerDetails' => [ 'primaryIdentity' => 'user@example.com', 'metadata' => [ 'name' => 'John Doe', 'company' => 'Acme Corp', 'department' => 'Engineering' ] ] ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (curl_errno($ch)) { $error = curl_error($ch); curl_close($ch); throw new Exception("cURL error: " . $error); } curl_close($ch); if ($httpCode !== 200) { throw new Exception("HTTP error: " . $httpCode); } return json_decode($response, true); } // Usage try { $result = generateMCPToken(); echo "Token generated: " . json_encode($result, JSON_PRETTY_PRINT) . "\n"; } catch (Exception $e) { echo "Failed to generate token: " . $e->getMessage() . "\n"; } ?> ``` ```go Go package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "time" ) type CustomerDetails struct { PrimaryIdentity string `json:"primaryIdentity"` Metadata map[string]string `json:"metadata,omitempty"` } type MCPTokenRequest struct { MCPServerID string `json:"mcpServerId"` CustomerDetails CustomerDetails `json:"customerDetails"` } type MCPTokenData struct { URL string `json:"url"` Token string `json:"token"` CustomerID string `json:"customerId"` } type MCPTokenResponse struct { Status string `json:"status"` Data *MCPTokenData `json:"data,omitempty"` Error *struct { Code string `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` } func generateMCPToken() (*MCPTokenResponse, error) { url := "https://api.mcpfy.ai/dev/v1/generate-mcp-token" payload := MCPTokenRequest{ MCPServerID: "63re68ca47d201fa9d2974fa", CustomerDetails: CustomerDetails{ PrimaryIdentity: "user@example.com", Metadata: map[string]string{ "name": "John Doe", "company": "Acme Corp", "department": "Engineering", }, }, } jsonData, err := json.Marshal(payload) if err != nil { return nil, fmt.Errorf("failed to marshal JSON: %w", err) } req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer ") client := &http.Client{Timeout: 30 * time.Second} resp, err := client.Do(req) if err != nil { return nil, fmt.Errorf("failed to make request: %w", err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("failed to read response: %w", err) } var result MCPTokenResponse if err := json.Unmarshal(body, &result); err != nil { return nil, fmt.Errorf("failed to unmarshal response: %w", err) } return &result, nil } func main() { result, err := generateMCPToken() if err != nil { fmt.Printf("Failed to generate token: %v\n", err) return } fmt.Printf("Token generated: %+v\n", result) } ``` ```json Success Response { "status": "success", "data": { "url": "https://mcp.mcpfy.ai/5ftIjklywsiC9u6rMG45Xgtxzq1SAsFv/stream", "token": "5ftIjklywsiC9u6rMG45Xgtxzq1SAsFv", "customerId": "68d1a6ccdde500225e8cd70c" } } ``` # List MCP Servers Source: https://docs.mcpfy.ai/api-reference/endpoint/list-servers GET /mcp-servers Retrieve a list of all MCP servers for the authenticated user ```bash cURL curl -X GET https://api.mcpfy.ai/dev/v1/mcp-servers \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" ``` ```javascript Node.js - Fetch API const listMCPServers = async () => { const response = await fetch('https://api.mcpfy.ai/dev/v1/mcp-servers', { method: 'GET', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } }); const data = await response.json(); return data; }; // Usage listMCPServers() .then(result => console.log(result)) .catch(error => console.error('Error:', error)); ``` ```javascript Node.js - Axios const axios = require('axios'); const listMCPServers = async () => { try { const response = await axios.get('https://api.mcpfy.ai/dev/v1/mcp-servers', { headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } }); return response.data; } catch (error) { console.error('Error listing MCP servers:', error.response?.data || error.message); throw error; } }; // Usage listMCPServers() .then(result => console.log('MCP Servers:', result)) .catch(error => console.error('Failed to list servers')); ``` ```python Python - Requests import requests def list_mcp_servers(): url = "https://api.mcpfy.ai/dev/v1/mcp-servers" headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } try: response = requests.get(url, headers=headers, timeout=30) response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: print(f"Error listing MCP servers: {e}") raise # Usage try: result = list_mcp_servers() print("MCP Servers:", result) except Exception as error: print(f"Failed to list servers: {error}") ``` ```python Python - HTTPX (Async) import httpx import asyncio async def list_mcp_servers(): url = "https://api.mcpfy.ai/dev/v1/mcp-servers" headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' } async with httpx.AsyncClient() as client: try: response = await client.get(url, headers=headers, timeout=30) response.raise_for_status() return response.json() except httpx.RequestError as e: print(f"Error listing MCP servers: {e}") raise # Usage async def main(): try: result = await list_mcp_servers() print("MCP Servers:", result) except Exception as error: print(f"Failed to list servers: {error}") # Run the async function asyncio.run(main()) ``` ```php PHP - cURL getMessage() . "\n"; } ?> ``` ```go Go package main import ( "encoding/json" "fmt" "io" "net/http" "time" ) type MCPServer struct { ID string `json:"id"` Name string `json:"name"` URL string `json:"url"` Status string `json:"status"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } type MCPServersResponse struct { Status string `json:"status"` Data []MCPServer `json:"data"` Error *struct { Code string `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` } func listMCPServers() (*MCPServersResponse, error) { url := "https://api.mcpfy.ai/dev/v1/mcp-servers" req, err := http.NewRequest("GET", url, nil) if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json") client := &http.Client{Timeout: 30 * time.Second} resp, err := client.Do(req) if err != nil { return nil, fmt.Errorf("failed to make request: %w", err) } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("failed to read response: %w", err) } var result MCPServersResponse if err := json.Unmarshal(body, &result); err != nil { return nil, fmt.Errorf("failed to unmarshal response: %w", err) } return &result, nil } func main() { result, err := listMCPServers() if err != nil { fmt.Printf("Failed to list servers: %v\n", err) return } fmt.Printf("MCP Servers: %+v\n", result) } ``` ```json Success Response [ { "id": "64f8a1b2c3d4e5f6a7b8c9d0", "name": "My MCP Server", "isActive": true, "createdAt": "2023-09-06T10:30:00.000Z", "updatedAt": "2023-09-06T10:30:00.000Z" } ] ``` # Create a Server Source: https://docs.mcpfy.ai/create-server Step-by-step guide to creating your MCP server using MCPfy platform ## Overview Creating an MCP (Model Context Protocol) server is easy with the MCPfy platform. This guide walks you through the entire process from login to deployment. ## Prerequisites Before creating a server, ensure you have: * An active MCPfy account * API endpoints you want to integrate as tools * Authentication details for your APIs Server creation typically takes 1-2 minutes depending on the number of API endpoints you're adding. ## Creating Your MCP Server Navigate to [mcpfy.ai/login](https://mcpfy.ai/login) and sign in to your account. If you don't have an account yet, you can create one during the login process. Once logged in, look for the **"Generate MCP"** option in the sidebar and click on it. Paste the cURL commands of the APIs that you need to add as tools. ```bash # Example API endpoint curl --location 'https://api.example.com/endpoint' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data-raw '{ "parameter": "value" }' ``` You can add multiple API endpoints by pasting multiple cURL commands. Add authentication details for your APIs. Use the **"Test API"** button to verify that your endpoints are working correctly. Make sure all your API tests return successful responses before proceeding. Click on **"Deploy"** to create your MCP server. The deployment process will generate your MCP server URL and make it accessible. ## Your MCP Server is Ready! Once deployment is complete, your MCP server is now ready and can be accessed through the provided URL. # Support Source: https://docs.mcpfy.ai/support Get help and support for MCPfy - we're here to help you succeed 🙏 We welcome all kinds of feedback, feature requests, and help inquiries. We want you to succeed. We are always here to support you. ## Contact Us Get dedicated support from the MCPfy team. Use the chat widget in the bottom-right corner of your screen for instant support. Just click on the chat icon and write us your concern - we'll get back to you as soon as possible. For detailed inquiries or technical issues, reach out to us at **[hello@mcpfy.ai](mailto:hello@mcpfy.ai)** ## How to Get Help Look for the chat icon in the bottom-right corner of your screen (as shown in the image below). Click on it to start a conversation with our support team. MCPfy chat widget located in the bottom-right corner of the dashboard Provide as much detail as possible about your concern: * What you were trying to do * What happened instead * Any error messages you received * Screenshots if applicable Our support team will respond to your chat message and help you resolve your issue quickly. For the fastest response, use the chat widget! Our team monitors chat messages throughout business hours and aims to respond within minutes. ## Response Times | Contact Method | Response Time | | -------------- | ------------------------------------ | | Chat Widget | Within minutes during business hours | | Email Support | Within 24 hours | Business hours: Monday - Friday, 9 AM - 6 PM PST