MuleSoft Anypoint MCP Server
Create a powerful Model Context Protocol (MCP) server for MuleSoft Anypoint Platform in minutes with our AI Gateway. This guide walks you through setting up seamless integration platform access with API lifecycle management and instant authentication.
About MuleSoft Anypoint Platform API
MuleSoft Anypoint Platform is a unified integration platform for SOA, SaaS, and APIs. It provides a complete solution to design, build, deploy, manage, and monitor APIs and integrations, enabling organizations to connect applications, data, and devices.
Key Capabilities
- API Design: Design-first API development
- Integration Development: Anypoint Studio IDE
- API Management: Full lifecycle management
- Runtime Management: Deploy and monitor applications
- Exchange: Asset repository and marketplace
- DataWeave: Powerful data transformation
- Connectors: 300+ pre-built connectors
- CloudHub: Managed cloud runtime
API Features
- Platform APIs: Manage the platform itself
- REST APIs: RESTful service interfaces
- OAuth 2.0: Secure authentication
- Connected Apps: Application integration
- Monitoring APIs: Runtime analytics
- Asset APIs: Exchange management
- Policy Management: Security and governance
- Deployment APIs: CI/CD integration
What You Can Do with MuleSoft Anypoint MCP Server
The MCP server transforms MuleSoft Anypoint API into a natural language interface, enabling AI agents to:
API Design & Development
-
Design Center
- "Create new REST API specification"
- "Import OpenAPI spec"
- "Generate RAML from examples"
- "Validate API design"
-
API Fragments
- "Create reusable data type"
- "Define security scheme"
- "Build trait library"
- "Share API patterns"
-
Mock Services
- "Generate mock endpoint"
- "Test API responses"
- "Simulate error scenarios"
- "Share mock with team"
Integration Development
-
Mule Applications
- "Create new Mule project"
- "Add database connector"
- "Configure HTTP listener"
- "Deploy to CloudHub"
-
DataWeave Transformations
- "Transform JSON to XML"
- "Map complex structures"
- "Filter and aggregate data"
- "Handle error mappings"
-
Flow Management
- "Create integration flow"
- "Add error handling"
- "Configure routing"
- "Set up schedulers"
Exchange Management
-
Asset Publishing
- "Publish API to Exchange"
- "Version API asset"
- "Add documentation"
- "Tag for discovery"
-
Connector Management
- "Install Salesforce connector"
- "Configure SAP connector"
- "Create custom connector"
- "Share with organization"
-
Template Library
- "Use integration template"
- "Create project archetype"
- "Share best practices"
- "Manage dependencies"
Runtime Management
-
Application Deployment
- "Deploy to CloudHub"
- "Scale application instances"
- "Update runtime version"
- "Configure load balancing"
-
Environment Management
- "Create production environment"
- "Promote from dev to prod"
- "Configure VPC"
- "Set up VPN connection"
-
Monitoring & Alerts
- "View application metrics"
- "Set up CPU alerts"
- "Monitor API usage"
- "Track error rates"
API Management
-
API Proxy Configuration
- "Create API proxy"
- "Apply rate limiting"
- "Configure caching"
- "Enable CORS"
-
Policy Application
- "Add OAuth 2.0 policy"
- "Configure IP whitelist"
- "Set SLA tiers"
- "Apply custom policies"
-
Client Management
- "Create client application"
- "Generate API keys"
- "Manage access tokens"
- "Track client usage"
Analytics & Monitoring
-
API Analytics
- "Show API traffic trends"
- "Analyze response times"
- "Track error patterns"
- "Monitor SLA compliance"
-
Business Insights
- "Generate usage reports"
- "Track adoption metrics"
- "Analyze client behavior"
- "Export analytics data"
-
Custom Dashboards
- "Create KPI dashboard"
- "Build executive view"
- "Set up alerts"
- "Share insights"
CI/CD Integration
-
Pipeline Automation
- "Deploy via Jenkins"
- "Integrate with Git"
- "Automate testing"
- "Manage versions"
-
Environment Promotion
- "Promote to staging"
- "Deploy to production"
- "Rollback deployment"
- "Track releases"
Prerequisites
- Access to Cequence AI Gateway
- MuleSoft Anypoint Platform account
- Organization administrator access
- Connected App credentials
Step 1: Configure MuleSoft Anypoint Access
1.1 Create Connected App
- Log in to Anypoint Platform
- Navigate to Access Management Connected Apps
- Click Create App
- Configure:
- Name: "AI Gateway Integration"
- Grant Types: Client Credentials
- Scopes: Select required scopes
1.2 Configure Permissions
- Assign app to business groups
- Set environment permissions
- Configure API access levels
- Grant necessary roles
1.3 Get Credentials
Note down:
- Client ID
- Client Secret
- Organization ID
- Environment ID
1.4 Configure OAuth Endpoints
- Authorization:
https://anypoint.mulesoft.com/accounts/oauth2/authorize
- Token:
https://anypoint.mulesoft.com/accounts/oauth2/token
Step 2-4: Standard Setup
Follow standard steps to access AI Gateway, find MuleSoft Anypoint API, and create MCP server.
Step 5: Configure API Endpoints
- Control Plane:
https://anypoint.mulesoft.com
- API Manager: Configure management plane
- CloudHub: Runtime endpoints
- Click Next
Step 6: MCP Server Configuration
- Name: "MuleSoft Anypoint"
- Description: "Integration platform management"
- Timeout: 120 seconds
- Click Next
Step 7: Configure Authentication
- Authentication Type: OAuth 2.0 Client Credentials
- Token URL:
https://anypoint.mulesoft.com/accounts/oauth2/token
- Client ID & Secret: From Connected App
- Additional Parameters:
- Organization ID
- Environment ID (if specific)
Available MuleSoft Anypoint API Scopes
Design Center
- API Design
- Design Center Designer
- API specifications
- Fragments management
- Mock services
Exchange
- Asset Management
- Read assets
- Publish assets
- Manage versions
- Download content
Management Center
-
API Manager
- Manage APIs
- Apply policies
- Configure alerts
- Track contracts
-
Runtime Manager
- Deploy applications
- Manage servers
- Monitor performance
- Configure VPCs
Access Management
- Organization
- Manage users
- Configure roles
- Set permissions
- Audit access
Step 8-10: Complete Setup
Configure security settings, choose deployment options, and deploy your server.
Using Your MuleSoft Anypoint MCP Server
With Claude Desktop
{
"servers": {
"mulesoft": {
"url": "your-mcp-server-url",
"auth": {
"type": "oauth2-client-credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret",
"org_id": "your-org-id"
}
}
}
}
Natural Language Commands
- "Create a REST API for customer management"
- "Deploy the order processing app to production"
- "Show me API usage statistics for last month"
- "Apply rate limiting to the payment API"
- "Create a DataWeave transformation for JSON to XML"
API Integration Example
// Initialize MCP client
const mcpClient = new MCPClient({
serverUrl: 'your-mcp-server-url',
auth: {
type: 'oauth2-client-credentials',
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
orgId: 'your-org-id'
}
});
// Create API specification
const apiSpec = await mcpClient.mulesoft.createAPISpecification({
name: 'Customer Management API',
version: '1.0.0',
format: 'RAML',
spec: `#%RAML 1.0
title: Customer Management API
version: v1
baseUri: https://api.company.com/customers
mediaType: application/json
types:
Customer:
type: object
properties:
id: string
name: string
email: string
phone?: string
address?:
type: object
properties:
street: string
city: string
state: string
zipCode: string
/customers:
get:
description: Get all customers
queryParameters:
limit:
type: integer
default: 20
offset:
type: integer
default: 0
responses:
200:
body:
type: Customer[]
post:
description: Create new customer
body:
type: Customer
responses:
201:
body:
type: Customer
/customers/{customerId}:
get:
description: Get customer by ID
responses:
200:
body:
type: Customer
404:
body:
type: object
properties:
error: string`
});
console.log(`Created API spec: ${apiSpec.id}`);
// Publish to Exchange
const asset = await mcpClient.mulesoft.publishToExchange({
groupId: 'com.company',
assetId: 'customer-management-api',
version: '1.0.0',
name: 'Customer Management API',
description: 'REST API for customer management operations',
type: 'rest-api',
files: [
{
classifier: 'raml',
packaging: 'zip',
content: apiSpec.content
}
],
categories: ['System APIs'],
tags: ['customer', 'management', 'rest']
});
// Create Mule application
const muleApp = await mcpClient.mulesoft.createMuleApplication({
name: 'customer-management-impl',
description: 'Implementation of Customer Management API',
runtime: '4.4.0',
configuration: `<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/db
http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">
<http:listener-config name="HTTP_Listener" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<db:config name="Database_Config">
<db:my-sql-connection host="localhost"
port="3306"
user="root"
password="password"
database="customers" />
</db:config>
<flow name="get-customers">
<http:listener config-ref="HTTP_Listener" path="/customers" allowedMethods="GET"/>
<db:select config-ref="Database_Config">
<db:sql>SELECT * FROM customers LIMIT :limit OFFSET :offset</db:sql>
<db:input-parameters>
#[{
limit: attributes.queryParams.limit default 20,
offset: attributes.queryParams.offset default 0
}]
</db:input-parameters>
</db:select>
<ee:transform>
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
payload map {
id: $.id,
name: $.name,
email: $.email,
phone: $.phone,
address: if ($.street != null) {
street: $.street,
city: $.city,
state: $.state,
zipCode: $.zip_code
} else null
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
</mule>`
});
// Deploy to CloudHub
const deployment = await mcpClient.mulesoft.deployToCloudHub({
applicationName: 'customer-management-api-v1',
environment: 'Production',
runtime: '4.4.0',
workerSize: '0.2',
workers: 2,
region: 'us-east-1',
properties: {
'http.port': '8081',
'db.host': '${DB_HOST}',
'db.password': '${DB_PASSWORD}'
},
secureProperties: {
'db.password': 'encrypted-password-value'
},
file: muleApp.package
});
console.log(`Deployment started: ${deployment.id}`);
// Wait for deployment
const status = await mcpClient.mulesoft.waitForDeployment({
applicationName: 'customer-management-api-v1',
environment: 'Production',
timeout: 600000 // 10 minutes
});
// Create API instance in API Manager
const apiInstance = await mcpClient.mulesoft.createAPIInstance({
name: 'Customer Management API - Prod',
version: '1.0.0',
assetId: asset.id,
environmentId: 'prod-env-id',
endpoint: `https://customer-management-api-v1.cloudhub.io`,
isPublic: false
});
// Apply policies
const rateLimitPolicy = await mcpClient.mulesoft.applyPolicy({
apiInstanceId: apiInstance.id,
policyTemplateId: 'rate-limiting',
configuration: {
rateLimits: [{
maximumRequests: 1000,
timePeriodInMilliseconds: 60000 // 1 minute
}],
clusterizable: true,
exposeHeaders: true
}
});
const oauthPolicy = await mcpClient.mulesoft.applyPolicy({
apiInstanceId: apiInstance.id,
policyTemplateId: 'oauth2-access-token-enforcement',
configuration: {
scopes: ['read:customers', 'write:customers'],
tokenUrl: 'https://auth.company.com/oauth/token',
validateTokenUrl: 'https://auth.company.com/oauth/validate'
}
});
// Create SLA tiers
const basicTier = await mcpClient.mulesoft.createSLATier({
apiInstanceId: apiInstance.id,
name: 'Basic',
description: 'Basic access tier',
limits: [{
maximumRequests: 100,
timePeriodInMilliseconds: 60000
}],
autoApprove: true
});
const premiumTier = await mcpClient.mulesoft.createSLATier({
apiInstanceId: apiInstance.id,
name: 'Premium',
description: 'Premium access tier',
limits: [{
maximumRequests: 10000,
timePeriodInMilliseconds: 60000
}],
autoApprove: false
});
// Create client application
const clientApp = await mcpClient.mulesoft.createClientApplication({
name: 'Mobile App Client',
description: 'iOS and Android mobile application',
url: 'https://company.com/mobile',
redirectUris: ['com.company.mobile://oauth/callback'],
grantTypes: ['authorization_code', 'refresh_token']
});
// Request API access
const contract = await mcpClient.mulesoft.requestAPIAccess({
applicationId: clientApp.id,
apiInstanceId: apiInstance.id,
tierName: 'Premium',
acceptedTerms: true
});
// Monitor application
const metrics = await mcpClient.mulesoft.getApplicationMetrics({
applicationName: 'customer-management-api-v1',
environment: 'Production',
duration: '1h',
metrics: ['cpu', 'memory', 'requests']
});
console.log('Application Metrics:');
console.log(`CPU Usage: ${metrics.cpu.average}%`);
console.log(`Memory: ${metrics.memory.average}MB`);
console.log(`Requests: ${metrics.requests.total}`);
// Create DataWeave transformation
const transformation = await mcpClient.mulesoft.createDataWeaveScript({
name: 'JSON to XML Customer Transform',
description: 'Transform customer JSON to XML format',
script: `%dw 2.0
output application/xml
---
customers: {
(payload map {
customer @(id: $.id): {
name: $.name,
email: $.email,
phone: $.phone default "N/A",
(address: {
street: $.address.street,
city: $.address.city,
state: $.address.state,
zipCode: $.address.zipCode
}) if ($.address != null)
}
})
}`,
inputMimeType: 'application/json',
outputMimeType: 'application/xml',
sampleInput: JSON.stringify([
{
id: '123',
name: 'John Doe',
email: 'john@example.com',
address: {
street: '123 Main St',
city: 'Boston',
state: 'MA',
zipCode: '02101'
}
}
])
});
// Set up monitoring alert
const alert = await mcpClient.mulesoft.createAlert({
name: 'High CPU Alert',
severity: 'Critical',
condition: {
type: 'cpu',
operator: 'GREATER_THAN',
value: 80,
duration: 300000 // 5 minutes
},
actions: [{
type: 'email',
emails: ['ops@company.com'],
subject: 'High CPU Usage Alert'
}],
applicationName: 'customer-management-api-v1',
environment: 'Production'
});
// Create VPC
const vpc = await mcpClient.mulesoft.createVPC({
name: 'production-vpc',
region: 'us-east-1',
cidrBlock: '10.0.0.0/16',
environments: ['Production'],
dnsServers: ['10.0.0.2'],
firewallRules: [
{
protocol: 'tcp',
fromPort: 443,
toPort: 443,
source: '0.0.0.0/0'
}
]
});
// Set up VPN
const vpn = await mcpClient.mulesoft.createVPN({
name: 'office-vpn',
vpcId: vpc.id,
remoteIpAddress: '203.0.113.12',
remoteNetworks: ['192.168.0.0/16'],
tunnelConfigs: [{
psk: 'secure-pre-shared-key',
pointToPointCidr: '169.254.0.0/30'
}]
});
// API Analytics
const apiAnalytics = await mcpClient.mulesoft.getAPIAnalytics({
apiInstanceId: apiInstance.id,
fromDate: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days
toDate: new Date(),
metrics: ['requests', 'response_time', 'errors']
});
console.log('API Analytics (Last 30 days):');
console.log(`Total Requests: ${apiAnalytics.requests.total}`);
console.log(`Average Response Time: ${apiAnalytics.response_time.average}ms`);
console.log(`Error Rate: ${apiAnalytics.errors.percentage}%`);
// Export analytics report
const report = await mcpClient.mulesoft.generateAnalyticsReport({
type: 'api_usage',
format: 'pdf',
dateRange: {
from: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000),
to: new Date()
},
groupBy: 'application',
includeCharts: true
});
console.log(`Report generated: ${report.downloadUrl}`);
Common Use Cases
API-Led Connectivity
- System APIs
- Process APIs
- Experience APIs
- API governance
Integration Patterns
- ESB patterns
- Microservices
- Event-driven
- Batch processing
Hybrid Deployments
- CloudHub hosting
- On-premise runtime
- Hybrid cloud
- Edge computing
DevOps Integration
- CI/CD pipelines
- Automated testing
- Environment promotion
- Version control
Best Practices
-
API Design:
- Design-first approach
- Reuse fragments
- Version properly
- Document thoroughly
-
Security:
- Apply policies consistently
- Use OAuth 2.0
- Encrypt sensitive data
- Monitor access
-
Performance:
- Right-size workers
- Use caching
- Optimize DataWeave
- Monitor metrics
Troubleshooting
Common Issues
-
Authentication Errors
- Verify Connected App setup
- Check permissions
- Validate org/env IDs
- Review token expiry
-
Deployment Issues
- Check runtime compatibility
- Verify resource limits
- Review application logs
- Validate properties
-
API Management
- Ensure API is tracked
- Verify policy order
- Check client credentials
- Review SLA limits
Getting Help
- Documentation: AI Gateway Docs
- Support: support@cequence.ai
- MuleSoft Help: help.mulesoft.com