Skip to content

Commit 78af90a

Browse files
committed
Added page on model context protocol and mcp-servers
1 parent cc266cf commit 78af90a

File tree

2 files changed

+257
-0
lines changed

2 files changed

+257
-0
lines changed

modules/genai-ecosystem/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
**** xref:vector-search.adoc[Vector Index and Search]
1616

1717
*** GraphRAG Ecosystem Tools
18+
**** xref:model-context-protocol-mcp.adoc[Model Context Protocol]
1819
**** https://neo4j.com/labs/genai-ecosystem/llm-graph-builder[LLM Graph Builder^]
1920
**** https://neo4j.com/labs/genai-ecosystem/neoconverse[NeoConverse^]
2021
**** https://neo4j.com/labs/genai-ecosystem/apoc-genai[APOC Extended for GenAI^]
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
= Model Context Protocol (MCP) Integrations for Neo4j
2+
// include::_graphacademy_llm.adoc[]
3+
:slug: model-context-protocol-mcp
4+
:author: Michael Hunger
5+
:category: genai-ecosystem
6+
:tags: graphrag, agent, python, mcp, model-context-protocol, tools, mcp-server, aura
7+
:neo4j-versions: 2025-01+
8+
:page-pagination:
9+
:page-product: neo4j
10+
11+
== What is the Model Context Protocol
12+
13+
The https://modelcontextprotocol.io/introduction[Model Context Protocol] was introduced by Anthropic in Nov 2024 to ease the integration of LLM Assistants with tools providing access to data, services, APIs and local systems.
14+
15+
It comes with a https://modelcontextprotocol.io/specification/2025-03-26[open source specification^], and a number of https://github.com/modelcontextprotocol#getting-started[SDKs^] (Python, TypeScript, Java, etc.) to implement MCP Servers and clients.
16+
17+
The MCP architecture consists of the *MCP Host* program which can be configured with a number of *MCP Servers* that provide capabilities like tools, resources, and prompts.
18+
19+
If you want to dive deeper, here is a https://neo4j.com/blog/developer/model-context-protocol/[comprehensive overview with explanations and examples with Neo4j^].
20+
21+
Whenever a user (or agent) requests in an interaction some task that could be executed by or through using a MCP Server capability, the LLM will select the tool, extract parameters and invoke the tool through an *MCP Client* connected to the MCP Server.
22+
23+
image::https://dist.neo4j.com/wp-content/uploads/20250401141320/mcp-architecture-neo4j-e1743543257487.png[]
24+
25+
26+
Large Cloud, Infrastructure and LLM Providers announced support for MCP in their offerings.
27+
28+
* https://x.com/demishassabis/status/1910107859041271977[Google^]
29+
* https://www.microsoft.com/en-us/microsoft-copilot/blog/copilot-studio/introducing-model-context-protocol-mcp-in-copilot-studio-simplified-integration-with-ai-apps-and-agents/[Microsoft^]
30+
* https://awslabs.github.io/mcp/[AWS]
31+
* https://x.com/sama/status/1904957253456941061[OpenAI^]
32+
* https://hub.docker.com/u/mcp?page=1&search=[Docker^]
33+
34+
Also Agent Frameworks like LangChain, CrewAI, Pydantic.AI and Agent Development Kit (ADK) and others are supporting MCP as tools.
35+
36+
There are still a number of open issues, especially around security, discovery, trusted deployment, permission control in the MCP protocol.
37+
38+
But Antropic and the larger community are determined to address them quickly.
39+
Especially with the large providers joining the ecosystem, many of the enterprise related requirements will be addressed soon.
40+
41+
The MCP protocol saw a lot of adoption since the beginning of 2025 with thousands of servers for all kinds of APIs having been built by the community.
42+
43+
44+
=== MCP Servers
45+
46+
MCP Servers are providing an implementation of the MCP protocol (JSON-RPC) over different transports - standard-I/O or HTTP(S).
47+
Most servers today are local servers, with http based servers growing in relevance, esp. with the recent addition of OAuth 2.1 to the MCP specification.
48+
49+
The offer these capabilities:
50+
51+
* *tools* - tools can retrieve data or take action, they take parameters and return results or errors to the client
52+
* *resources* - read only static or dynamic resources, like files, pages, schemas
53+
* *prompts* - multi-step prompts with placeholders to guide user interactions with this service
54+
55+
Some example servers (Neo4j servers explained below)
56+
57+
// * https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking[Sequential Thinking Server^]
58+
* https://supabase.com/docs/guides/getting-started/mcp[Supabase Database Management^]
59+
* https://github.com/grafana/mcp-grafana[Grafana Management^]
60+
* https://github.com/microsoft/playwright-mcp[Microsoft Playwright^]
61+
* https://github.com/stripe/agent-toolkit/tree/main/modelcontextprotocol[Stripe Customer & Payment Management^]
62+
// * https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem[Filesystem^]
63+
* https://github.com/github/github-mcp-server[GitHub^]
64+
* https://github.com/modelcontextprotocol/servers/tree/main/src/slack[Slack^]
65+
// * https://github.com/modelcontextprotocol/servers/blob/main/src/brave-search[Brave Search^]
66+
* <<#neo4j,Neo4j Servers>>
67+
68+
=== MCP Clients/Hosts
69+
70+
An MCP Host (LLM-Application like Claude, Cursor or CoPilot) can be configured with a number of MCP Servers.
71+
When an MCP Server is activated, it creates an MCP client for opening a persistent, bi-directional connection to the MCP Server (using JSON RPC).
72+
73+
Then whenever a user requests a task for which a server's capability can be used, the MCP host LLM:
74+
75+
. extracts the parameter and information from the instruction and the conversational context,
76+
. selects the best tool based on description and past usage and
77+
. sends a request.
78+
. the response is then integrated into the current context,
79+
. will be used in the conversation and
80+
. can be used as input to other MCP calls or
81+
. generating artifacts like documents, images, code.
82+
83+
==== Developer Tools and IDEs
84+
85+
All the AI powered IDEs support MCP now, so that during your development process you can access services from the AI powered chat.
86+
The built-in agents can use these MCP servers to fetch information relevant for your project (e.g. database definitions), spin up services or databases or open pull requests or create JIRA tickets.
87+
88+
* https://docs.cursor.com/context/model-context-protocol[Cursor^]
89+
* https://docs.windsurf.com/windsurf/mcp[Windsurf^]
90+
* https://code.visualstudio.com/docs/copilot/chat/mcp-servers[VS Code^]
91+
* https://github.com/modelcontextprotocol/inspector[MCP Inspector^]
92+
* https://cline.bot/mcp-marketplace[Cline^]
93+
// * Jetbrains?
94+
95+
image::https://dist.neo4j.com/wp-content/uploads/20250415081900/mcp-inspector-toolbox.png[]
96+
97+
98+
==== End User Tools
99+
100+
End user tools will be able to use MCP servers to also securely access SaaS services, Document storage (Drive, Sharepoint, OneDrive, Box), generative tools and corporate databases.
101+
102+
* https://modelcontextprotocol.io/quickstart/user[Claude Desktop^] (by Anthropic, only supports STDIO servers)
103+
* https://www.microsoft.com/en-us/microsoft-copilot/blog/copilot-studio/introducing-model-context-protocol-mcp-in-copilot-studio-simplified-integration-with-ai-apps-and-agents/[MSFT Copilot^] (Studio)
104+
* https://cloud.google.com/products/agentspace?hl=en[Google Agent Space^] (coming via ADK)
105+
* OpenAI ChatGPT Desktop (coming soon)
106+
107+
image::https://dist.neo4j.com/wp-content/uploads/20250415081825/copilot-studio-mcp-demo.png[]
108+
109+
110+
[[neo4j]]
111+
== Neo4j MCP Servers
112+
113+
The first Neo4j MCP server to interact with a Neo4j Database via Cypher was created in December 2024, shortly after MCP was launched.
114+
115+
Since then we have added https://github.com/neo4j-contrib/mcp-neo4j[several more MCP servers^], to control the Neo4j Aura API and to store memories as a knowledge graph in Neo4j.
116+
117+
Neo4j also integrated with Google's MCP Toolbox to provide optimized tool integration for graph databases.
118+
119+
=== MCP-Neo4j-Cypher
120+
121+
The https://github.com/neo4j-contrib/mcp-neo4j/tree/main/servers/mcp-neo4j-cypher[mcp-neo4j-cypher Server^] allows to extract the graph database schema so give the agent-LLM to generate Cypher queries to query and update the database.
122+
123+
Tools:
124+
125+
* `get-neo4j-schema`
126+
* `read-neo4j-cypher`
127+
* `write-neo4j-cypher`
128+
129+
image::https://cdn-images-1.medium.com/max/1024/1*UnC-f-LmG5RB-wk3G16TgQ.png[]
130+
image::https://dist.neo4j.com/wp-content/uploads/20250415082244/mcp-neo4j-cypher-movies-pie.png[]
131+
132+
Here is a blog post showing the https://neo4j.com/blog/developer/claude-converses-neo4j-via-mcp/[server in action, to extract information progressively from a database^] and use it both to drill down more but also render interactive charts and visualizations.
133+
134+
=== MCP-Neo4j-Memory
135+
136+
MCP came with an example knowledge graph implementation for storing memories, we upgraded that to use Neo4j as a real graph database.
137+
138+
The https://github.com/neo4j-contrib/mcp-neo4j/tree/main/servers/mcp-neo4j-memory[mcp-neo4j-memory Server^] stores and updates entities with observations and relationships between them in Neo4j and can search and retrieve subgraphs of relevance.
139+
140+
It also works for long conversations or plans that turn into more comprehensive eknowledge graphs.
141+
142+
It offers these tools and operations:
143+
144+
Querying
145+
146+
* `read_graph` load whole graph
147+
* `search_nodes` by search string
148+
* `find_nodes` by name
149+
150+
Updating
151+
152+
* `create_entities`, `delete_entities` - create memory entities
153+
* `create_relations`, `delete_relations` - manage relationships
154+
* `add_observations`, `delete_observations` - add observation statements to entities
155+
156+
image::https://dist.neo4j.com/wp-content/uploads/20250415121327/mpc-neo4j-memory-colleagues.png[]
157+
158+
image::https://dist.neo4j.com/wp-content/uploads/20250415120121/mcp-memory-instructions.png[]
159+
image::https://dist.neo4j.com/wp-content/uploads/20250415120117/mcp-memory-graph.png[]
160+
161+
=== MCP Neo4j Aura Manager
162+
163+
One interesting area for developers of using MCP servers is actually not the data side but infrastructure.
164+
While developing applications, it is useful to spin up or manage database instances, or pause/resume from the comfort of your IDE.
165+
Other infrastructure aspects could be migrations, cost overviews, inviting team members etc.
166+
167+
168+
The https://github.com/neo4j-contrib/mcp-neo4j/tree/main/servers/mcp-neo4j-cloud-aura-api[mcp-neo4j-aura-manager^] provides access to the https://neo4j.com/docs/aura/platform/api/specification/[Neo4j Aura API^] for managing databases, tenants, projects.
169+
170+
When configured with client-id and client-secret the MCP server can access the Aura API on your behalf and offers the following tools as operations:
171+
172+
Instance Management
173+
174+
* `list_instances`
175+
* `get_instance_details`, `get_instance_by_name`
176+
177+
* `create_instance`, `delete_instance`
178+
* `update_instance_name`, `update_instance_memory`, `update_instance_vector_optimization`
179+
* `pause_instance`, `resume_instance`
180+
181+
Tenant/Project Management
182+
183+
* `list_tenants`
184+
* `get_tenant_details`
185+
186+
image::https://dist.neo4j.com/wp-content/uploads/20250415082358/cursor-aura-mcp.png[width=400]
187+
image::https://dist.neo4j.com/wp-content/uploads/20250415082130/mcp-neo4j-aura-create-instance.png[]
188+
189+
== Google MCP Toolbox
190+
191+
https://googleapis.github.io/genai-toolbox/getting-started/mcp_quickstart/[Google's MCP Toolbox for Database^] is an https://github.com/googleapis/genai-toolbox[open source tool^] to integrate a variety of databases as sources for agentic systems.
192+
193+
Individual parameterized queries can be defined as tools and made available to agent frameworks.
194+
Toolbox takes care of database connection management, authentication, result processing and error handling.
195+
196+
image::https://googleapis.github.io/genai-toolbox/getting-started/introduction/architecture.png[]
197+
198+
Toolbox integrates as an MCP Server but also directly with LangChain and LlamaIndex.
199+
200+
You can deploy MCP toolbox to Cloud Run or Kubernetes or run it locally on your system.
201+
202+
The Neo4j Integration was added early in Dec 2024, and provides
203+
204+
* https://googleapis.github.io/genai-toolbox/resources/sources/neo4j/[Neo4j Source^]
205+
* https://googleapis.github.io/genai-toolbox/resources/tools/neo4j-cypher/[Neo4j Cypher Tools^]
206+
207+
image::https://dist.neo4j.com/wp-content/uploads/20250415081953/mcp-toolbox-tools.png[]
208+
image::https://dist.neo4j.com/wp-content/uploads/20250415082753/mcp-server-toolkit-inspector.png[]
209+
210+
Learn more in this article: [Build AI Agents With Google's MCP Toolbox and Neo4j Knowledge Graphs - Graph Database & Analytics](https://neo4j.com/blog/developer/ai-agents-gen-ai-toolbox/)
211+
212+
== MCP with Agent Frameworks
213+
214+
Most Agent Frameworks support MCP servers as tools, and so also the Neo4j MCP servers.
215+
216+
217+
=== Using MCP Toolbox and Neo4j with the Google Agent Development Kit (ADK)
218+
219+
Google's new Agent Development Kit (ADK) also supports integrating https://google.github.io/adk-docs/tools/mcp-tools/[MCP Servers as tools for agents^].
220+
221+
It also https://google.github.io/adk-docs/tools/google-cloud-tools/#toolbox-tools-for-databases[natively supports the MCP Toolbox^] so that tools defined there can be used directly.
222+
223+
This notebook demonstrates examples of using https://colab.research.google.com/drive/1f0GYXrO8pZsoJnyKDDxzFZVaYgXhx3ME[Agent Development Kit with Neo4j^].
224+
225+
=== Using MCP Servers with LangChain / LangGraph
226+
227+
MCP is available in the LangChain ecosystem through https://changelog.langchain.com/announcements/mcp-adapters-for-langchain-and-langgraph[MCP Adapters^].
228+
229+
LangChain shared also a very interesting https://blog.langchain.dev/mcp-fad-or-fixture/[discusion on MCP^].
230+
231+
=== Using MCP Servers with LlamaIndex Workflows
232+
233+
MCP Servers are integrated via an https://docs.llamaindex.ai/en/stable/api_reference/tools/mcp/[MCP Tool Spec into LlamaIndex^].
234+
Agents can be connected to tools via the integration https://llamahub.ai/l/tools/llama-index-tools-mcp[installed via LlamaHub^], as demonstrated in this https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-mcp/examples/mcp.ipynb[LlamaIndex MCP Example Notebook^]
235+
236+
// Original Idea:https://psiace.me/posts/integrate-mcp-tools-into-llamaindex/
237+
238+
=== Using MCP Servers with CrewAI
239+
240+
CrewAI provides bi-directional integration, https://github.com/crewAIInc/enterprise-mcp-server[published CrewAI workflows can be exposed as MCP servers^].
241+
242+
With work currently ongoing for using MCP servers as crew tools
243+
// https://community.crewai.com/t/agents-can-discover-use-tools-hosted-on-model-context-protocol-mcp-server/5254
244+
245+
=== Using MCP Servers with Pydantic.AI
246+
247+
https://ai.pydantic.dev/mcp/[PydanticAI supports Model Context Protocol (MCP)^] in three ways:
248+
249+
* Agents act as an MCP Client, connecting to MCP servers to use their tools
250+
* Agents can be used within MCP servers
251+
* As part of PydanticAI, we're building a number of MCP servers
252+
253+
=== Using MCP Servers with Semantik Kernel
254+
255+
MCP tools can be https://devblogs.microsoft.com/semantic-kernel/integrating-model-context-protocol-tools-with-semantic-kernel-a-step-by-step-guide/[converted to to Semantic Kernel^] functions so they can be added to a Kernel instance.
256+

0 commit comments

Comments
 (0)