Creating MCP Servers
Learn the three ways to create MCP servers in MA²D.
Creation Methods
MA²D offers three approaches to create MCP servers:
- From URL - Import from existing MCP server
- From OpenAPI - Convert OpenAPI/Swagger spec
- From Scratch - Build manually with mock data
Method 1: From URL
Import an existing MCP server by providing its endpoint URL.
When to Use
- You have an existing MCP server
- Want to test or modify a live server
- Need to quickly prototype against real endpoints
Steps
- Navigate to MCP Servers page
- Click “New Server”
- Select “From URL”
- Enter server details:
- Name: Descriptive name
- Description: What the server does
- URL: MCP endpoint URL (e.g.,
https://api.example.com/mcp)
- Click “Import & Introspect”
What Happens
MA²D will:
- Connect to the URL
- Call
initializeto get server info - Call
tools/listto discover tools - Call
resources/listto discover resources - Call
prompts/listto discover prompts - Create server with all components
Example URL Import
Name: Weather API
Description: Real-time weather data for cities worldwide
URL: https://weather-mcp.example.com/mcpAfter import, you’ll have:
- ✅ Server created
- ✅ All tools imported with schemas
- ✅ All resources imported
- ✅ All prompts imported
- ⚠️ No mock scenarios (add manually)
Adding Authentication
If the target server requires auth:
- Enable “Requires Authentication”
- Select auth type:
- Bearer Token: OAuth/JWT tokens
- Basic Auth: Username/password
- API Key: Custom API key header
- Configure credentials
Troubleshooting URL Import
“Failed to connect”:
- Check URL is accessible
- Verify it’s a valid MCP endpoint
- Test with
curlfirst - Check for CORS issues
“No tools found”:
- Server may not have tools
- Check server implements
tools/list - Verify server is MCP-compliant
“Timeout”:
- Server may be slow to respond
- Try again with better network
- Check server status
Method 2: From OpenAPI
Convert an OpenAPI (Swagger) specification into an MCP server.
When to Use
- You have an OpenAPI/Swagger spec
- Want to expose REST API as MCP
- Need to create tools from existing API documentation
Steps
- Navigate to MCP Servers page
- Click “New Server”
- Select “From OpenAPI”
- Provide spec:
- Upload File: Upload
.jsonor.yaml - Paste JSON: Copy/paste spec
- URL: Link to hosted spec
- Upload File: Upload
- Configure conversion:
- Base URL: API base URL
- Auth: Configure if needed
- Click “Convert & Create”
What Happens
MA²D will:
- Parse OpenAPI spec
- Convert each endpoint to an MCP tool
- Map request parameters to tool input schema
- Create tool descriptions from spec
- Generate server with all tools
Conversion Rules
| OpenAPI | MCP Tool |
|---|---|
| Path + Method | Tool name (e.g., get_weather) |
| Summary/Description | Tool description |
| Parameters | Input schema properties |
| Responses | Output schema (documentation only) |
| Security | Authentication config |
Example OpenAPI Import
OpenAPI Spec:
paths:
/weather:
get:
summary: Get current weather
description: Returns current weather for a city
parameters:
- name: city
in: query
required: true
schema:
type: string
responses:
200:
description: Weather dataResulting MCP Tool:
{
"name": "get_weather",
"description": "Get current weather. Returns current weather for a city",
"inputSchema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "city parameter"
}
},
"required": ["city"]
}
}Customization After Import
After importing from OpenAPI:
- Review tool names: Edit for clarity
- Enhance descriptions: Add AI-friendly details
- Add mock scenarios: Create test responses
- Configure auth: Set up authentication
- Test endpoints: Verify everything works
Supported OpenAPI Versions
- ✅ OpenAPI 3.0.x
- ✅ OpenAPI 3.1.x
- ✅ Swagger 2.0
- ⚠️ Some extensions may not be supported
Method 3: From Scratch (Mock)
Build an MCP server from scratch with mock data - no code required!
When to Use
- Prototyping a new API design
- Creating test servers for development
- Building examples or demos
- Designing MCP servers before implementation
Steps
- Navigate to MCP Servers page
- Click “New Server”
- Select “From Scratch”
- Enter server details:
- Name: Server name
- Description: Detailed description (200+ chars recommended)
- Version: Semantic version (e.g., 1.0.0)
- Click “Create Server”
- Add components:
- Tools: Functions agents can call
- Resources: Data agents can read
- Prompts: Message templates
Building Your First Mock Server
Let’s build a simple weather server:
Step 1: Create Server
Name: Weather API
Description: Provides current weather information for cities worldwide.
Returns temperature, conditions, humidity, and wind speed.
Version: 1.0.0Step 2: Add a Tool
Click “Add Tool” and configure:
Name: get_weather
Description: Get current weather for any city. Returns temperature in
Fahrenheit, weather conditions (sunny, cloudy, rainy),
humidity percentage, and wind speed in mph.Input Schema:
{
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "City name (e.g., 'San Francisco', 'London')"
}
},
"required": ["city"]
}Step 3: Add Mock Scenarios
Add realistic test data:
Scenario 1: San Francisco
Condition: city equals "San Francisco"
Response:
{
"temperature": 72,
"conditions": "Sunny",
"humidity": 65,
"wind_speed": 10
}Scenario 2: New York
Condition: city equals "New York"
Response:
{
"temperature": 45,
"conditions": "Cloudy",
"humidity": 78,
"wind_speed": 15
}Default Scenario
Condition: (none - default)
Response:
{
"temperature": 70,
"conditions": "Partly Cloudy",
"humidity": 60,
"wind_speed": 8,
"note": "Weather data not available for this city"
}Step 4: Test Your Server
- Copy your MCP endpoint URL
- Use
curlor Postman to test:
curl -X POST YOUR_ENDPOINT_URL \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": {"city": "San Francisco"}
}
}'Expected response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [{
"type": "text",
"text": "{\"temperature\":72,\"conditions\":\"Sunny\",\"humidity\":65,\"wind_speed\":10}"
}]
}
}Adding Resources
Resources provide static data:
URI: weather://cities
Name: Available Cities
Description: List of all cities with weather data
MIME Type: application/json
Content:
["San Francisco", "New York", "London", "Tokyo", "Paris"]Adding Prompts
Prompts are conversation templates:
Name: weather_query
Description: Template for asking about weather
Arguments:
- location (required): City to query
Template:
What's the weather like in {location}? Include temperature and conditions.Design Rules Compliance
MA²D automatically checks your server against 10 design rules:
- ✅ Naming: Clear, descriptive names
- ✅ Descriptions: Detailed (200+ chars)
- ✅ Schemas: Well-defined input schemas
- ✅ Examples: Mock scenarios for testing
- And more…
View compliance score on server details page.
Publishing to Exchange
Once your server is ready:
- Ensure compliance score > 80%
- Click “Publish to Exchange”
- Configure Exchange settings
- Click “Publish”
Your server spec will be published to Anypoint Exchange!
Comparison: Which Method?
| Feature | From URL | From OpenAPI | From Scratch |
|---|---|---|---|
| Speed | ⚡ Fast | ⚡⚡ Medium | ⚡⚡⚡ Slow |
| Customization | Limited | Medium | Full |
| Mocks | Manual | Manual | Built-in |
| Best for | Existing MCP | REST APIs | New designs |
| Learning curve | Easy | Medium | Easy |
Next Steps
After creating your server:
- Managing Tools - Add and configure tools
- Mock Scenarios - Create realistic test data
- Testing - Test your MCP endpoint
- Publishing - Share on Anypoint Exchange
Need help? Check Troubleshooting or ask in Discussions.