The CreatorCon Call for Content is officially open! Get started here.

VaranAwesomenow
Mega Sage

Using Neo4j with Claude Desktop and chat with ServiceNow scoped application

 

Understanding ServiceNow scoped applications can get complex and time taking, we can leverage the power of GEN AI and Agentic AI (MCP server and MCP clients) to efficiently interact with a ServiceNow scoped application. This work product / blog provides steps on how it can be achieved.

Pre-requisites

Local desktop setup

Install Neoj4 desktop client

Create a new local instance

VaranAwesomenow_0-1751009368037.png

Working Claude desktop setup

ServiceNow export

Export sys_metadata from sys_metadata table from ServiceNow for a given scoped application, sample url is provided below

Application Files | ServiceNow

Personalize columns to have following 4 columns

  • Display name
  • Update name
  • Class
  • Application

Export data as csv name the file as sys_metadata.csv

Save the file to Neo4j import folder sample path : C:\Users\XXXXXXXXXXXX\.Neo4jDesktop2\Data\dbmss\dbms-0c4f3390-53eb-4ae4-a3d2-8801f701bbfe\import

VaranAwesomenow_1-1751009368039.png

 

Load file to neo4j

Open neo4j desktop client and load the file

VaranAwesomenow_2-1751009368064.png

 

Cypher to load the file

:param {

  // Define the file path root and the individual file names required for loading.

  // https://neo4j.com/docs/operations-manual/current/configuration/file-locations/

  file_path_root: 'file:///', // Change this to the folder your script can access the files at.

  file_0: 'sys_metadata2.csv'

};

 

// CONSTRAINT creation

// -------------------

//

// Create node uniqueness constraints, ensuring no duplicates for the given node label and ID property exist in the database. This also ensures no duplicates are introduced in future.

//

// NOTE: The following constraint creation syntax is generated based on the current connected database version 2025.5.0.

CREATE CONSTRAINT `sys_update_name_Metadata_uniq` IF NOT EXISTS

FOR (n: `Metadata`)

REQUIRE (n.`sys_update_name`) IS UNIQUE;

 

:param {

  idsToSkip: []

};

 

// NODE load

// ---------

//

// Load nodes in batches, one node label at a time. Nodes will be created using a MERGE statement to ensure a node with the same label and ID property remains unique. Pre-existing nodes found by a MERGE statement will have their other properties set to the latest values encountered in a load file.

//

// NOTE: Any nodes with IDs in the 'idsToSkip' list parameter will not be loaded.

LOAD CSV WITH HEADERS FROM ($file_path_root + $file_0) AS row

WITH row

WHERE NOT row.`sys_update_name` IN $idsToSkip AND NOT row.`sys_update_name` IS NULL

CALL {

  WITH row

  MERGE (n: `Metadata` { `sys_update_name`: row.`sys_update_name` })

  SET n.`sys_update_name` = row.`sys_update_name`

  SET n.`sys_name` = row.`sys_name`

  SET n.`sys_class_name` = row.`sys_class_name`

  SET n.`sys_scope` = row.`sys_scope`

MERGE (m: `ScopedApp` { `name`: row.`sys_scope` })

MERGE (m)-[r:Object {sys_class_name: row.sys_class_name}]->(n)

} IN TRANSACTIONS OF 10000 ROWS;

// RELATIONSHIP load

// -----------------

//

// Load relationships in batches, one relationship type at a time. Relationships are created using a MERGE statement, meaning only one relationship of a given type will ever be created between a pair of nodes.

Output

VaranAwesomenow_3-1751009368072.png

 

VaranAwesomenow_4-1751009368083.png

 

Configure claude desktop to access neo4j mcp server

Open claude_desktop_config.json file and add below mcp-server

  "local-neo4j": {

      "command": "uvx",

      "args": [ "mcp-neo4j-cypher@0.2.3" ],

      "env": {

        "NEO4J_URI": "neo4j://127.0.0.1:7687",

        "NEO4J_USERNAME": "neo4j",

        "NEO4J_PASSWORD": "xxxxxxxx",

        "NEO4J_DATABASE": "neo4j"

      }

    },

Review local instances to get above details

VaranAwesomenow_5-1751009368087.png

 

VaranAwesomenow_6-1751009368094.png

 

 

Testing

Test: Verify dataload

Open database and select relationship as Object

VaranAwesomenow_7-1751009368115.png

Graph appears as below showing all objects of the scoped application

VaranAwesomenow_8-1751009424674.png

 

Test: Connectivity to neo4j database from claude desktop

Prompt: connect with local neo4j database

VaranAwesomenow_9-1751009424683.png

 

I'll help you connect to your local Neo4j database. Let me start by checking the database schema to see what's available.

L

get_neo4j_schema

Request

{}

Response

Error: {code: Neo.ClientError.Procedure.ProcedureNotFound} {message: There is no procedure with the name `apoc.meta.data` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.}

The connection attempt shows that while we can reach the Neo4j database, the APOC (Awesome Procedures on Cypher) plugin is not installed or enabled. The APOC plugin provides useful procedures for database introspection and operations.

Let me try a basic connection test with a simple Cypher query instead:

L

read_neo4j_cypher

Request

{

  `query`: `MATCH (n) RETURN count(n) as total_nodes LIMIT 1`

}

Response

[{"total_nodes": 16}]

Great! The connection to your local Neo4j database is working. I can see there are 16 nodes in your database.

Let me get some basic information about what's in your database:

L

read_neo4j_cypher

Request

{

  `query`: `MATCH (n) RETURN DISTINCT labels(n) as node_labels, count(n) as count ORDER BY count DESC`

}

Response

[{"node_labels": ["Metadata"], "count": 15}, {"node_labels": ["ScopedApp"], "count": 1}]

L

read_neo4j_cypher

Request

{

  `query`: `MATCH ()-[r]->() RETURN DISTINCT type(r) as relationship_types, count(r) as count ORDER BY count DESC`

}

Response

[{"relationship_types": "Object", "count": 15}, {"relationship_types": "ObjectOf", "count": 1}]

Perfect! Your local Neo4j database connection is established and working. Here's what I found:

Database Summary:

  • Total Nodes: 16
  • Node Types:
    • 15 nodes with label "Metadata"
    • 1 node with label "ScopedApp"
  • Relationships:
    • 15 "Object" relationships
    • 1 "ObjectOf" relationship

The database appears to contain metadata-related information with a scoped application structure.

Test: Chat with scoped application find count of objects by their type

Please show various objects of MCP Client node from my local neo4j database group them by their sys_class_name

VaranAwesomenow_10-1751009424693.png

 

I'll query your Neo4j database to find objects related to MCP Client nodes and group them by their sys_class_name.

 

L

read_neo4j_cypher

Found an MCP Client node! Let me now find objects related to this MCP Client and group them by sys_class_name:

L

read_neo4j_cypher

Now let me group these objects by their sys_class_name for a cleaner view:

L

read_neo4j_cypher

Perfect! Here's a summary of the various objects associated with the MCP Client node in your Neo4j database, grouped by their sys_class_name:

MCP Client Objects by Class Name

Topic (5 objects)

  • "Agentic AI" (appears twice)
  • "_PRVW__987fd1c8cf424fc7892fc2993e1cea1c" (preview object)
  • "_PRVW__04f7ec7e0fac48ffb4d4d6dbe09a4d46" (preview object)
  • "_PRVW__7cb0c2b2e1fb4060a57cb431fb7aeb7e" (preview object)

Published Topic (4 objects)

  • "FlowTopic" (4 instances with different sys_update_names)

Message (3 objects)

  • "agentic ai"
  • "hi welcome to mcp client"
  • "ask your mcp client"

CB Topic Language (1 object)

  • (unnamed object)

CS Topic Language (1 object)

  • (unnamed object)

Action Type (1 object)

  • "Invoke Powershell Script"

The MCP Client appears to be a ServiceNow scoped application focused on AI and automation, containing various topics related to "Agentic AI", flow topics for integration, user interface messages, and PowerShell script execution capabilities. The preview objects (starting with "PRVW_") suggest this application is still in development or testing phase.

Would you like me to explore any specific class of objects in more detail?

Test: Get List of topics

VaranAwesomenow_11-1751009424702.png

 

what are different Topics that are part of my MCP client application in my local neo4j database

Edit

I'll query your Neo4j database to get detailed information about all the Topics that are part of your MCP Client application.

L

read_neo4j_cypher

Let me also check if there are any additional properties or details we can get about these topics:

L

read_neo4j_cypher

Here are the different Topics that are part of your MCP Client application in your local Neo4j database:

Topics in MCP Client Application

  1. Agentic AI (2 instances)
  • CB Topic: sys_cb_topic_8b8435f2839e6a14fbe1c2dfeeaad36f
  • CS Topic: sys_cs_topic_8bbe7d7a8312aa14fbe1c2dfeeaad387

This appears to be the main topic focusing on Agentic AI functionality, with both CB (Conversation Builder) and CS (Customer Service) implementations.

  1. Preview Topics (3 instances)

These appear to be development/preview topics with generated GUIDs:

  • _PRVW__04f7ec7e0fac48ffb4d4d6dbe09a4d46
    • Update Name: sys_cs_topic_4ccebd7a8312aa14fbe1c2dfeeaad349
  • _PRVW__7cb0c2b2e1fb4060a57cb431fb7aeb7e
    • Update Name: sys_cs_topic_8a6e317a8312aa14fbe1c2dfeeaad374
  • _PRVW__987fd1c8cf424fc7892fc2993e1cea1c
    • Update Name: sys_cs_topic_08bef97a8312aa14fbe1c2dfeeaad375

Summary

Your MCP Client application contains 5 total topics:

  1. One main functional topic: "Agentic AI" (with 2 implementations - CB and CS)
  2. Three preview/development topics: With GUID-based names indicating they're likely in development or testing phase

The naming pattern suggests this is a ServiceNow application focused on AI agent functionality, with both Conversation Builder (CB) and Customer Service (CS) topic implementations. The preview topics are likely prototypes or test versions being developed.

Would you like me to explore any specific topic in more detail or look at other aspects of your MCP Client application?

Test: Get list of flow actions

VaranAwesomenow_12-1751009424707.png

 

I'll query your Neo4j database to find all the actions that are part of your MCP Client application.

L

read_neo4j_cypher

Request

{

  `query`: `MATCH (mcp) WHERE mcp.name = 'MCP Client'

MATCH (mcp)-[:Object]-(action)

WHERE action.sys_class_name CONTAINS 'Action'

RETURN action.sys_class_name as class_name,

       action.sys_name as action_name,

       action.sys_update_name as update_name,

       action.sys_scope as scope,

       action

ORDER BY action.sys_class_name, action.sys_name`

}

Response

[{"class_name": "Action Type", "action_name": "Invoke Powershell Script", "update_name": "sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec", "scope": "MCP Client", "action": {"sys_update_name": "sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec", "sys_name": "Invoke Powershell Script", "sys_scope": "MCP Client", "sys_class_name": "Action Type"}}]

Let me also check if there are any other action-related objects or flow actions that might be part of the MCP Client:

L

read_neo4j_cypher

Request

{

  `query`: `MATCH (mcp) WHERE mcp.name = 'MCP Client'

MATCH (mcp)-[:Object]-(obj)

WHERE obj.sys_class_name CONTAINS 'Action' OR

      obj.sys_class_name CONTAINS 'Flow' OR

      obj.sys_class_name CONTAINS 'Script' OR

      obj.sys_name CONTAINS 'action' OR

      obj.sys_name CONTAINS 'script'

RETURN obj.sys_class_name as class_name,

       obj.sys_name as object_name,

       obj.sys_update_name as update_name,

       keys(obj) as available_properties,

       obj

ORDER BY obj.sys_class_name`

}

Response

[{"class_name": "Action Type", "object_name": "Invoke Powershell Script", "update_name": "sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec", "available_properties": ["sys_update_name", "sys_name", "sys_class_name", "sys_scope"], "obj": {"sys_update_name": "sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec", "sys_name": "Invoke Powershell Script", "sys_scope": "MCP Client", "sys_class_name": "Action Type"}}]

Let me also check if there might be any flow-related actions or other executable components:

L

read_neo4j_cypher

Request

{

  `query`: `MATCH (mcp) WHERE mcp.name = 'MCP Client'

MATCH (mcp)-[:Object]-(obj)

WHERE toLower(obj.sys_class_name) CONTAINS 'flow' OR

      toLower(obj.sys_class_name) CONTAINS 'step' OR

      toLower(obj.sys_class_name) CONTAINS 'hub' OR

      toLower(obj.sys_update_name) CONTAINS 'action' OR

      toLower(obj.sys_update_name) CONTAINS 'flow'

RETURN DISTINCT obj.sys_class_name as class_name,

       obj.sys_name as object_name,

       obj.sys_update_name as update_name,

       obj

ORDER BY obj.sys_class_name`

}

Response

[{"class_name": "Action Type", "object_name": "Invoke Powershell Script", "update_name": "sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec", "obj": {"sys_update_name": "sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec", "sys_name": "Invoke Powershell Script", "sys_scope": "MCP Client", "sys_class_name": "Action Type"}}]

Here are the Actions that are part of your MCP Client application in your local Neo4j database:

Actions in MCP Client Application

Action Type (1 action)

  1. Invoke Powershell Script
  • Class: Action Type
  • Update Name: sys_hub_action_type_definition_3d4fcc7283126a14fbe1c2dfeeaad3ec
  • Scope: MCP Client
  • Type: Hub Action Type Definition

Test: A larger scoped application with more than 500 sys_metadata records

Export data from Servicenow and import data to Neo4j

VaranAwesomenow_13-1751009424708.png

 

VaranAwesomenow_14-1751009424722.png

 

Cyper to load data from sys_metdata.csv file

:param {

  // Define the file path root and the individual file names required for loading.

  // https://neo4j.com/docs/operations-manual/current/configuration/file-locations/

  file_path_root: 'file:///', // Change this to the folder your script can access the files at.

  file_0: 'sys_metadata.csv'

};

 

// CONSTRAINT creation

// -------------------

//

// Create node uniqueness constraints, ensuring no duplicates for the given node label and ID property exist in the database. This also ensures no duplicates are introduced in future.

//

// NOTE: The following constraint creation syntax is generated based on the current connected database version 2025.5.0.

CREATE CONSTRAINT `sys_update_name_Metadata_uniq` IF NOT EXISTS

FOR (n: `Metadata`)

REQUIRE (n.`sys_update_name`) IS UNIQUE;

 

:param {

  idsToSkip: []

};

 

// NODE load

// ---------

//

// Load nodes in batches, one node label at a time. Nodes will be created using a MERGE statement to ensure a node with the same label and ID property remains unique. Pre-existing nodes found by a MERGE statement will have their other properties set to the latest values encountered in a load file.

//

// NOTE: Any nodes with IDs in the 'idsToSkip' list parameter will not be loaded.

LOAD CSV WITH HEADERS FROM ($file_path_root + $file_0) AS row

WITH row

WHERE NOT row.`sys_update_name` IN $idsToSkip AND NOT row.`sys_update_name` IS NULL

CALL {

  WITH row

  MERGE (n: `Metadata` { `sys_update_name`: row.`sys_update_name` })

  SET n.`sys_update_name` = row.`sys_update_name`

  SET n.`sys_name` = row.`sys_name`

  SET n.`sys_class_name` = row.`sys_class_name`

  SET n.`sys_scope` = row.`sys_scope`

MERGE (m: `ScopedApp` { `name`: row.`sys_scope` })

MERGE (m)-[r:Object {sys_class_name: row.sys_class_name}]->(n)

} IN TRANSACTIONS OF 10000 ROWS;

 

 

// RELATIONSHIP load

// -----------------

//

// Load relationships in batches, one relationship type at a time. Relationships are created using a MERGE statement, meaning only one relationship of a given type will ever be created between a pair of nodes.

 

Ensure that only relevant classes are in scope of the export

VaranAwesomenow_15-1751009424727.png

 

VaranAwesomenow_16-1751009424730.png

 

Once export is complete below would be the graph

VaranAwesomenow_17-1751009424739.png

 

 

Prompt: What are various business rules that are part of AwesomeNowCreativeWorks in my local neo4j

 

Find out business rules that are part of scoped application  (ex: AwesomeNowCreativeWorks)

 

VaranAwesomenow_22-1751009473552.png

 

VaranAwesomenow_23-1751009473562.png

Test: Build simple design document

Build a simple design document based on objects that are part of AwesomeNowCreativeWorks in my local neo4j include only tables, business rules, UI actions for now

VaranAwesomenow_0-1751010775697.png

 

VaranAwesomenow_1-1751010775711.png

 

AwesomeNow CreativeWorks - Design Document

Application Overview

Application Name: AwesomeNow CreativeWorks
Scope: AwesomeNowCreativeWorks
Purpose: A ServiceNow application for managing creative works, digital assets, and graph-based relationship visualization.

Table Definitions

Core Data Tables

  1. file (x_146833_creativ_0_file)
  • Purpose: Central table for managing file objects and digital assets
  • Key Features: Supports file state management and type classification
  • Relationships: Connected to graph and graphics tables
  1. graph (x_146833_creativ_0_graph)
  • Purpose: Stores graph definitions and configurations for visualization
  • Key Features: Manages graph structures and their associated data
  • Relationships: Parent table for nodes, edges, and graphics
  1. node (x_146833_creativ_0_node)
  • Purpose: Represents individual nodes within graph structures
  • Key Features: Stores node properties and relationships
  • Relationships: Child of graph table, connected to edges
  1. edge (x_146833_creativ_0_edge)
  • Purpose: Defines connections and relationships between nodes
  • Key Features: Manages directional relationships in graphs
  • Relationships: Connects nodes within graphs
  1. graphics (x_146833_creativ_0_graphics)
  • Purpose: Stores graphical representations and visual elements
  • Key Features: Manages visual assets for graph rendering
  • Relationships: Associated with nodes and graphs

Lookup and Reference Tables

  1. LabelGraphics (x_146833_creativ_0_labelgraphics)
  • Purpose: Manages label graphics for visual elements
  • Key Features: Provides graphical label definitions
  • Record Types: Configurable record type classifications
  1. Label Graphics Lookup (x_146833_creativ_0_label_graphics_lookup)
  • Purpose: Lookup table for label graphics relationships
  • Key Features: Maps labels to their graphical representations
  • Record Types: Supports multiple record type configurations
  1. Creativ 0 Hex Color Codes (x_146833_creativ_0_hex_color_codes)
  • Purpose: Centralized color palette management
  • Key Features: Stores hex color codes for consistent theming
  • Usage: Referenced throughout the application for color consistency
  1. Creativ 0 Allowed Classes (x_146833_creativ_0_allowed_classes)
  • Purpose: Defines which ServiceNow classes can be used within the application
  • Key Features: Access control and class validation
  • Usage: Referenced for security and data integrity

Data Loading and Integration Tables

  1. File Application (x_146833_creativ_0_file_application)
  • Purpose: Links files to specific applications
  • Key Features: Manages file-application relationships
  • Usage: Supports multi-application file management
  1. Creativ 0 Appl File (x_146833_creativ_0_creativ_0_appl_file)
  • Purpose: Application-specific file management
  • Key Features: Enhanced file categorization and management
  • Usage: Extends basic file functionality
  1. Creativ 0 Scopedapp Loader (x_146833_creativ_0_creativ_0_scopedapp_loader)
  • Purpose: Manages scoped application loading processes
  • Key Features: Handles application metadata and loading sequences
  • Usage: Data import and application management
  1. Creativ 0 Graphic Lookup Loader (x_146833_creativ_0_creativ_0_graphic_lookup_loader)
  • Purpose: Loads and manages graphic lookup data
  • Key Features: Batch processing of graphic definitions
  • Usage: Data import for graphics management
  1. ACW-Get EdgeData (x_146833_creativ_0_acw_get_edgedata)
  • Purpose: Data source table for edge information
  • Key Features: Manages edge data import and processing
  • Usage: Integration with external graph data sources
  1. Incidentloaderapi (x_146833_creativ_0_incidentloaderapi)
  • Purpose: API interface for incident data loading
  • Key Features: Handles incident data integration
  • Usage: External system integration for incident management

Business Rules

  1. Set Target when missing
  • Table: Applied to edge or node tables
  • Purpose: Automatically sets target values when they are missing
  • Trigger: Before insert/update
  • Logic: Ensures data integrity by populating required target fields
  1. SetIdToNumber
  • Table: Applied to core data tables
  • Purpose: Automatically generates or converts ID fields to numeric format
  • Trigger: Before insert/update
  • Logic: Maintains consistent ID formatting across the application
  1. cascade Delete Nodes Edges and Graphics
  • Table: Applied to graph table
  • Purpose: Maintains referential integrity during deletion operations
  • Trigger: Before delete
  • Logic: Automatically removes dependent records (nodes, edges, graphics) when parent graph is deleted

UI Actions

  1. Create App Digital Twin
  • Purpose: Creates a digital twin representation of an application
  • Location: Application forms or lists
  • Functionality:
    • Generates comprehensive digital representation
    • Creates associated graph structures
    • Initializes visualization components
  • User Experience: One-click digital twin creation
  1. Create CI Digital Twin
  • Purpose: Creates a digital twin representation of a Configuration Item (CI)
  • Location: CI forms or CMDB interfaces
  • Functionality:
    • Maps CI relationships to graph structures
    • Creates visual representation of CI dependencies
    • Generates interactive digital twin
  • User Experience: Seamless CI-to-digital-twin conversion

Data Model Relationships

Primary Relationships

graph (1) → (n) node

graph (1) → (n) edge 

graph (1) → (n) graphics

file (1) → (n) graphics

node (n) → (n) edge (source/target relationships)

Lookup Relationships

LabelGraphics → Label Graphics Lookup

graphics → Creativ 0 Hex Color Codes

file → File Application

Data Loading Relationships

External Sources → ACW-Get EdgeData → edge

External Sources → Incidentloaderapi → incident data

External Sources → Creativ 0 Graphic Lookup Loader → graphics

Key Features and Capabilities

Graph Visualization

  • Interactive node-edge graph rendering
  • Customizable visual themes using hex color codes
  • Label graphics with configurable record types

Digital Twin Creation

  • Application digital twins with complete dependency mapping
  • CI digital twins with CMDB integration
  • Automated graph structure generation

Data Integration

  • Multiple data source support
  • Automated data loading processes
  • API integration capabilities

File Management

  • Multi-application file support
  • State-based file processing
  • Type classification system

Technical Architecture

Data Flow

  1. Input: Files and external data sources
  2. Processing: Business rules ensure data integrity
  3. Storage: Structured data in core tables
  4. Visualization: Graph rendering using graphics and lookup tables
  5. Interaction: UI actions provide user functionality

Security Model

  • Scoped application isolation
  • Allowed classes validation
  • Role-based access control integration

Performance Considerations

  • Optimized lookup table structure
  • Cascading delete operations for data cleanup
  • Batch loading processes for large datasets

Future Enhancements

Potential Extensions

  • Additional visualization types beyond graphs
  • Enhanced API integrations
  • Real-time data synchronization
  • Advanced analytics and reporting

Scalability Considerations

  • Table partitioning for large datasets
  • Caching strategies for frequent lookups
  • Asynchronous processing for bulk operations

Link to published document: https://claude.ai/public/artifacts/7942a843-3b58-43f6-8fe3-1f1783b70542

References

mcp-neo4j/servers/mcp-neo4j-cypher at main · neo4j-contrib/mcp-neo4j

Model Context Protocol (MCP) Integrations for Neo4j - Developer Guides

Error: Neo.ClientError.Statement.ExternalResourceFailed - Neo4j Graph Platform / Cypher - Neo4j Onli...

Default file locations - Operations Manual

Neo4j Fundamentals | Foundational | Free Neo4j Courses from GraphAcademy

neo4j-graph-examples/movies: Built-in Movie Graph Example

Comments
GlideFather
Tera Patron

Hi @VaranAwesomenow,

are you sure this is related to ServiceNow? Also, is this asking for help or you were sharing an article?
It is not clear, how can we help you.

Version history
Last update:
‎06-27-2025 12:56 AM
Updated by:
Contributors