Publish MCP Server
Publish an MCP server to the registry or update an existing one.
The MCP Registry Publish Server utility provides essential capabilities for publishing and managing Model Context Protocol (MCP) server registrations within ServiceNow. With this utility, users can create new registry entries and update existing ones, while ensuring that each change is tracked through version history.
Script include utility function
Creates a new MCP server registry entry or updates an existing one based on source record and version.
/* Payload format
{
source_record: "string (required)",
source_table: "string (required for create)",
server_name: "string (required for create)",
description: "string (required for create)",
version: "string (required for create)",
internal_name: "string (optional)",
is_latest: "boolean (optional)",
status: "string (optional), // default: inactive",
remotes: "array or string (optional)"
}
*/
const payload = {
server_name: 'Github testing 1',
internal_name: 'io.github.user/testing 1',
description: 'github testing 1',
version: '1.0.0',
remotes: [
{
type: 'streamable-http',
url: 'https://analytics.example.com/mcp',
headers: [
{
name: 'X-API-Key',
description: 'API key for authentication',
isRequired: true,
isSecret: true
}
]
}
],
status: 'active',
is_latest: 'true',
source_table: 'incident',
source_record: '57af7aec73d423002728660c4cf6a71c'
};
const response = new sn_mcp_registry.MCPRegistryServers().publishMCPServer(payload);
| Field | Type | Required | Description |
|---|---|---|---|
| source_record | String | Yes | Unique identifier of the source record |
| source_table | String | Yes (create) | Source table name |
| server_name | String | Yes (create) | Display name of the MCP server |
| description | String | Yes (create) | Detailed description of the server |
| version | String | Yes (create) | Version number (e.g., "1.0.0") |
| internal_name | String | Optional | Internal identifier/name |
| is_latest | Boolean | Optional | Flag indicating if this is the latest version |
| status | String | Optional | Status of the server (e.g., "active", "inactive"). Default: inactive |
| remotes | Array/String | Optional | Remote connection configurations |
Create new entry
When no existing record is found with the same source_record and version, a new registry entry is created.
Required fields are:
- source_record
- source_table
- server_name
- description
- version
Example:
const payload = {
server_name: 'Github testing 1',
internal_name: 'io.github.user/testing 1',
description: 'github testing 1',
version: '1.0.0',
remotes: [
{
type: 'streamable-http',
url: 'https://analytics.example.com/mcp',
headers: [
{
name: 'X-API-Key',
description: 'API key for authentication',
isRequired: true,
isSecret: true
}
]
}
],
status: 'active',
is_latest: 'true',
source_table: 'incident',
source_record: '57af7aec73d423002728660c4cf6a71c'
};
const response = new sn_mcp_registry.MCPRegistryServers().publishMCPServer(payload);
Success response:
{
"success": true,
"sys_id": "xyz789abc123",
"action": "created",
"message": "Created new version 1.0.0"
}
Update existing entry
When an existing record is found with the same source_record and version, the record is updated with provided fields.
Required fields:
- source_record
- version
Supports partial updates: Only fields included in the request body will be updated.
Example (partial update):
const payload = {
status: 'active',
is_latest: false,
version: '1.0.0',
source_record: '57af7aec73d423002728660c4cf6a71c'
};
const response = new sn_mcp_registry.MCPRegistryServers().publishMCPServer(payload);
Success response:
{
"success": true,
"sys_id": "xyz789abc123",
"action": "updated",
"message": "Updated version 1.0.0"
}
Create new version
When an existing record is found with the same sysId but different version, a new registry entry is created for the new version.
Example:
const payload = {
server_name: 'Github testing 1',
internal_name: 'io.github.user/testing 1',
description: 'github testing 1',
version: '1.0.5',
remotes: [
{
type: 'streamable-http',
url: 'https://analytics.example.com/mcp',
headers: [
{
name: 'X-API-Key',
description: 'API key for authentication',
isRequired: true,
isSecret: true
}
]
}
],
status: 'active',
is_latest: 'true',
source_table: 'incident',
source_record: '57af7aec73d423002728660c4cf6a71c'
};
Success response:
{
"success": true,
"sys_id": "new456xyz789",
"action": "created",
"message": "Created new version 2.0.0"
}
Error responses
Missing required field (sysId):
{
"success": false,
"error": "Missing sysId"
}
Validation failed (create):
{
"success": false,
"error": "Validation failed",
"details": [
"server_name is required",
"server_table is required",
"description is required",
"version is required"
]
}
Validation failed (update):
{
"success": false,
"error": "Validation failed",
"details": [
"server_name cannot be empty"
]
}