Model Context Protocol #4257
louis-jan
started this conversation in
Feature Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How MCP works
MCP (Model Context Protocol) is an open protocol that enables secure, controlled interactions between AI applications and local or remote resources. Let’s break down how it works, then look at how we’ll use it in this guide.
General Architecture
At its core, MCP follows a client-server architecture where a host application can connect to multiple servers:
In This Discussion
To demonstrate how MCP works in practice, let’s look at how Jan Desktop integrates MCP servers. Specifically, we’ll focus on a setup using @smithery/sdk, a library that simplifies MCP implementation.
Workflow
1. Jan Desktop: Acts as the host application, initiating queries and managing user interactions.
2. App Extension: A custom module extending Jan’s capabilities, serving as a bridge to external tools.
3. @smithery/sdk: A library that handles MCP communication, translating requests from Jan into standardized MCP queries.
4. MCP Server: The endpoint that executes specific tasks (e.g., web searches, database lookups) and returns results to Jan.
5. Remote Resources: MCP servers can connect to APIs or other internet resources to retrieve data.
Why Use MCP with Jan?
• Standardization: MCP provides a consistent way to interact with various resources, making integration smoother.
• Flexibility: Connect Jan to any resource that MCP servers expose, from local files to cloud-based APIs.
• Security: Fine-grained control ensures only authorized resources are accessed.
• Scalability: Easily extend Jan’s capabilities by adding more MCP servers without modifying core functionality.
Coming Up
In the next sections, we’ll dive deeper into setting up @smithery/sdk, configuring MCP servers, and creating a seamless interaction flow in Jan Desktop.
Build the Extension Tool
Let’s use the Assistant extension as an example, since it serves as an implementation tool for extensions.
3 Then the new tool code base will be something like this:
Run in Jan
We use this extension file in the demo screenshots provided below.
Attachments:
This extension TGZ file was built from feat/mcp-assistant-extension
janhq-assistant-extension-1.0.1.tgz
Install the updated extension
Setting APIs
Disable Experimental Feature
There is a known issue where Jan would ignore other tools and enable
retrieval
tool only when toggle it on. That will be fixed soon from Jan.Create new thread
Previous threads will have
assistant’s tools
defined in thread.json. To apply new tool changes, create a new thread.Voila
That is just an example
The example above is not an official MCP implementation of Jan, which is more about demonstrating how simple users can extend Jan’s features using its extension framework.
It's not a good implementation since:
We are still working on it
Please stay tuned and experiment with the extension update mentioned above in the meantime. We will update Jan and its backend to ensure the features are properly built.
Beta Was this translation helpful? Give feedback.
All reactions