Connect an MCP client to Gladys
The Model Context Protocol (MCP) is an open protocol developed by Anthropic that allows exposing tools and functions that AI agents can use to retrieve information or interact with real-world devices.
What does Gladys' MCP server allow?β
Gladys Assistant integrates an MCP server that enables your compatible AI agents (Claude Desktop, Perplexity, Mistral Le Chat, etc.) to communicate with your smart home. Currently available capabilities include:
- π‘οΈ Retrieve device states
- temperature
- humidity
- open/closed (contact)
- lamp
- smart plug
- air quality
- carbon monoxide (CO)
- carbon dioxide (COβ)
- energy
- brightness
- motion
- PM10
- PM2.5
- angle
- distance
- leak
- level
- formaldehyde (HCHO)
- precipitation
- presence
- pressure
- rain
- smoke
- VOC (volatile organic compounds)
- volume
- π· View your cameras and describe what it sees (if your client is compatible)
- π‘ Turn lights on/off
- π Control switches and outlets
- π¬ Launch scenes
System Architectureβ
The MCP system works with 2 components:
- The MCP client: This is your AI agent (Claude Desktop, Perplexity, Mistral Le Chat...)
- The MCP server: Integrated into Gladys, it exposes available functions that the client can call
By default, your agent and your Gladys instance must be on the same local network to communicate with each other.
If you are a Gladys Plus subscriber, you can use the Open API to continue accessing the MCP server outside your home. This Open API route is also necessary if your agent can only access MCP servers available online (for Mistral Le Chat for example).
Configuration in Gladysβ
Local MCPβ
Go to Integrations β MCP in Gladys.
MCP Server URLβ
The MCP server URL is visible in the interface:
http://YOUR_GLADYS_IP/api/v1/service/mcp/proxy
Authentication for your connection is done by adding the Authorization header with your local API key as the value (see below).
Generating a local API Key (<LOCAL_API_KEY>)β
To secure the connection between your agent and Gladys, you must generate an API key:
- In Gladys' MCP interface, at the bottom of the page, enter a name for your client (e.g., "Claude Desktop", "VS Code"...)
- Click "Generate"
- Important: Copy the generated key immediately, you won't be able to see it again
- Add it to your client configuration by passing it in the
Authorizationheader
You can revoke this key at any time if needed.
Internet Access with Gladys Plusβ
If you want to use agents that require a public URL (Mistral Le Chat), you can go through Gladys Plus.
URLβ
Gladys Plus provides a secure and authenticated route:
https://api.gladysgateway.com/v1/api/mcp/<GLADYS_PLUS_API_KEY>
Generating a Gladys Plus API Key (<GLADYS_PLUS_API_KEY>)β
You must generate an Open API key (be careful, not one from the configuration interface), to do this follow the Gladys Plus documentation
Configuring MCP Clientsβ
Optional - mcp-proxy (Claude Desktop and Perplexity)β
Not all clients yet support MCP servers directly via HTTP (such as the free version of Claude Desktop or Perplexity) and communicate via STDIO. You must therefore use mcp-proxy which bridges stdio and HTTP. It's a small software that must be installed on the same machine as the MCP client.
Installing mcp-proxyβ
Follow the installation instructions on the GitHub repository: mcp-proxy Installation
Once installed, find the full path of mcp-proxy:
# On macOS/Linux
which mcp-proxy
# On Windows
where.exe mcp-proxy
Note this path, you'll need it for configuration.
Configuration for Claude Desktopβ
- Start Claude Desktop
- Go to Settings β Developer β Local MCPs
- Click "Edit Config"
- Modify the
claude_desktop_config.jsonfile:
{
"mcpServers": {
"gladys": {
"command": "/full/path/to/mcp-proxy",
"args": [
"http://<YOUR_GLADYS_IP>/api/v1/service/mcp/proxy",
"--transport",
"streamablehttp",
"--header",
"Authorization: <LOCAL_API_KEY>"
],
"env": {}
}
}
}
Replace:
/full/path/to/mcp-proxywith the path obtained fromwhich mcp-proxy<YOUR_GLADYS_IP>with your Gladys IP address<LOCAL_API_KEY>with the key generated in Gladys
- Save and restart Claude Desktop
If everything works, you should have access to all MCP functions in the chat.
π‘ Tip: You can also use the Gladys Plus URL
https://api.gladysgateway.com/v1/api/mcp/<GLADYS_PLUS_API_KEY>instead of the local URL to access your Gladys from anywhere.
Configuration for Perplexityβ
- Start Perplexity
- Go to Settings β Connectors β Add Connector
- Select the "Advanced" tab
- Give a name: "Gladys"
- Configure:
{
"command": "/full/path/to/mcp-proxy",
"args": [
"http://<YOUR_GLADYS_IP>/api/v1/service/mcp/proxy",
"--transport",
"streamablehttp",
"--header",
"Authorization: <LOCAL_API_KEY>"
],
"env": {}
}
Replace the same values as for Claude Desktop.
- Save and wait for Perplexity to detect the functions
π More information: Perplexity MCP Documentation
π‘ Tip: You can also use the Gladys Plus URL
https://api.gladysgateway.com/v1/api/mcp/<GLADYS_PLUS_API_KEY>instead of the local URL to access your Gladys from anywhere.
VS Code with GitHub Copilotβ
GitHub Copilot in VS Code natively supports MCP servers via HTTP.
- Open Copilot Chat in VS Code
- At the bottom, select Agent then click the βοΈ icon (wrench)
- Choose "Add more Tools..." from the dropdown
- Select "Add MCP Server"
- Choose the "HTTP" type
- Enter the URL:
http://<YOUR_GLADYS_IP>/api/v1/service/mcp/proxy - In headers, add:
- Name:
Authorization - Value:
<LOCAL_API_KEY>
- Name:
- Give your server a name (e.g., "Gladys")
You can now chat with Copilot and ask it to interact with your home!
π More information: VS Code MCP Documentation
π‘ Tip: You can also use the Gladys Plus URL
https://api.gladysgateway.com/v1/api/mcp/<GLADYS_PLUS_API_KEY>instead of the local URL to access your Gladys from anywhere.
Mistral Le Chat only with Gladys Plusβ
Le Chat only allows connection to MCPs accessible on the internet.
- Go to Intelligence β Connectors
- Click Add a connector
- In the Custom MCP Connector tab, complete the form with the URL and Gladys Plus API key
https://api.gladysgateway.com/v1/api/mcp/<GLADYS_PLUS_API_KEY>
You can now interact with Gladys data in Le Chat
Need Help?β
Feel free to ask your questions on the Gladys forum, the community is here to help you!