|
| 1 | += Multi-Domain Agent with MCP & Neo4j |
| 2 | +include::_graphacademy_llm.adoc[] |
| 3 | +:slug: mcp-employee-customer |
| 4 | +:author: Zach Blumenfeld |
| 5 | +:category: genai-tutorials |
| 6 | +:tags: |
| 7 | +:neo4j-versions: 5.x |
| 8 | +:page-pagination: |
| 9 | +:page-product: mcp-employee-customer |
| 10 | + |
| 11 | +image::mcp-customer-employee.png[align=center] |
| 12 | +This is a context engineering example demonstrating how to create intelligent agents across multiple business domains with graph databases and model context protocol (MCP). Graph Databases represent context & associated metadata in an optimal matter, enabling agents to better decompose tasks and use mcp servers to execute intelligent workflows across multiple data sources. |
| 13 | +GraphRAG is involved in this process - as tools focus on graph retrieval, but think of graph context as a sort of meta-GraphRAG process. We aren't just telling agents how to retrieve data, we are guiding them over how to reason about what context to use. |
| 14 | + |
| 15 | +In this specific example, we work with a knowledge assistant that can help with |
| 16 | + |
| 17 | +1. **Employees & talent:** Skills analysis, talent search, and team formation |
| 18 | +2. **Customer experience:** Analyze & understand customer purchasing behavior & journeys. Specifically for a retail store in this example. |
| 19 | +3. **Identifying risks & making recommendations:** Putting the above together to understanding opportunities, costs, and make project and resourcing recommendations to improve ROI, reduce churn, etc. |
| 20 | +
|
| 21 | +== Graph & MCP Server Setup |
| 22 | + |
| 23 | +The Setup for this example is split into 2 steps: |
| 24 | + |
| 25 | +1. Graph & MCP Server Setup |
| 26 | +2. MCP Client Configuration |
| 27 | + |
| 28 | +=== Graph & MCP Server Setup |
| 29 | +For this example, you will need to setup 2 knowledge graphs, and we will use the below two separate projects for the respective graphs: |
| 30 | + |
| 31 | + |
| 32 | +1. https://github.com/neo4j-product-examples/neo4j-employee-graph/tree/mcp-toolbox[Employee Graph] |
| 33 | +2. https://github.com/neo4j-product-examples/demo-cx/tree/mcp-example/mcp-tools-subgraph[Customer Graph] |
| 34 | + |
| 35 | + |
| 36 | +For each graph you will need a respective Neo4j database. You can create Neo4j AuraDB instances at https://console.neo4j.io/. You can use the Aura Pro free trial for the customer graph and Aura free for the employee graph. During setup, you'll download a credentials file needed for later configuration. **Remember to make 2 databases**. |
| 37 | + |
| 38 | +After this you can do the following: |
| 39 | + |
| 40 | +1. For the Employee graph, run the 4 module notebooks in order (modules 1, 2, 3 & 4) from https://github.com/neo4j-product-examples/neo4j-employee-graph/tree/mcp-toolbox[this GitHub repo branch]. See the directions for deploying MCP Toolbox at the end of the module 4 notebook as well. |
| 41 | + |
| 42 | +2. For the Customer graph, see the readme in https://github.com/neo4j-product-examples/demo-cx/tree/mcp-example/mcp-tools-subgraph[this GitHub repo branch] for instructions. You will run a notebook and some similar scripts to get MCP Toolbox servers deployed. |
| 43 | + |
| 44 | + |
| 45 | +=== MCP Client Configuration |
| 46 | +You will leverage 4 MCP servers for this example. You can use any https://modelcontextprotocol.io/clients[MCP client], but here we will assume [https://claude.ai/downloadClaude Desktop] for which you would use the below configuration. See https://modelcontextprotocol.io/quickstart/user#installing-the-filesystem-server[MCP Desktop instructions] for more details on how to set this up. Other client configurations will vary, please see their associated docs. |
| 47 | +[source,json] |
| 48 | +---- |
| 49 | +{ |
| 50 | + "mcpServers": { |
| 51 | + "employee-cypher": { <1> |
| 52 | + "command": "uvx", |
| 53 | + "args": [ |
| 54 | + "mcp-neo4j-cypher" |
| 55 | + ], |
| 56 | + "env": { |
| 57 | + "NEO4J_URI":"neo4j+s://xxxxxxxx.databases.neo4j.io", |
| 58 | + "NEO4J_USERNAME":"neo4j", |
| 59 | + "NEO4J_PASSWORD": "xxxxxxxxxxxx" |
| 60 | + } |
| 61 | + }, |
| 62 | + "employee-tools": { <2> |
| 63 | + "command": "npx", |
| 64 | + "args": [ |
| 65 | + "mcp-remote", |
| 66 | + "https://employee-toolbox-xxxxxxxxxxxx.us-central1.run.app/mcp" |
| 67 | + ] |
| 68 | + }, |
| 69 | + "customer-cypher": { <3> |
| 70 | + "command": "uvx", |
| 71 | + "args": [ |
| 72 | + "mcp-neo4j-cypher" |
| 73 | + ], |
| 74 | + "env": { |
| 75 | + "NEO4J_URI":"neo4j+s://xxxxxxxx.databases.neo4j.io", |
| 76 | + "NEO4J_USERNAME":"neo4j", |
| 77 | + "NEO4J_PASSWORD": "xxxxxxxxxxxx" |
| 78 | + } |
| 79 | + }, |
| 80 | + "customer-tools": { <4> |
| 81 | + "command": "npx", |
| 82 | + "args": [ |
| 83 | + "mcp-remote", |
| 84 | + "https://customer-toolbox-xxxxxxxxxxxx.us-central1.run.app/mcp" |
| 85 | + ] |
| 86 | + } |
| 87 | + } |
| 88 | +} |
| 89 | +---- |
| 90 | +<1> `employee-cypher`: Enables the client (AI agent) to get the schema and execute its own Cypher (graph queries) against the employee graph |
| 91 | +<2> `employee-tools`: Provides specific Cypher templates to the AI agent. Think of these as expert crafted tools for finding similarities and summaries of employees and talent which can accept arguments/parameters from the agent (such as employee names, skill types, domains, etc. ) |
| 92 | +<3> `customer-cypher`: Like `employee-cypher` enables the client (AI agent) to get the schema and execute its own Cypher (graph queries) against the customer graph. |
| 93 | +<4> `customer-tools`: Similar to `employee-tools` provides specific Cypher templates to the AI agent but to access the customer graph. |
| 94 | + |
| 95 | + |
| 96 | +the `*-cypher` servers use the already available https://github.com/neo4j-contrib/mcp-neo4j/tree/main/servers/mcp-neo4j-cypher[`mcp-neo4j-cypher`]. |
| 97 | + |
| 98 | +The `*-tool` servers use Google MCP Toolbox to create servers with parameterized Cypher templates. The code for doing so is located in the respective repositories below |
| 99 | + |
| 100 | + |
| 101 | +== Sample Questions |
| 102 | + |
| 103 | +Below are some sample questions you can ask via Claude Desktop or your chosen client |
| 104 | + |
| 105 | +1. Can you summarize my technical talent and skills distribution? Feel free to include simple graphics. |
| 106 | + |
| 107 | +2. Let's switch focus to our customers. Can you tell me about my customer purchase patterns and segments? What does my churn risk look like? Feel free to include simple graphics. |
| 108 | + |
| 109 | +3. Who from our team can I put on this to figure out the right type of outreach? Can you write a brief project proposal? |
0 commit comments