MCP
Serve the tools of a session to any MCP client with kloudlite mcp.
Last updated
On this page
Description and operation
General
kloudlite mcp is a stdio MCP server. An MCP client, for example Claude Code, starts it as a program and calls the agent tools of one session through it. The server serves every workspace, environment and workspace tool of the session. Each tool names its target with workspace or env. No command, file read or file write runs on your computer.
| Argument | Meaning |
|---|---|
team | The team whose session to serve. Your own session when absent. |
--session | The session to serve, by name or id. |
The server picks the session in this order: --session, the session that you selected with kloudlite sessions use (saved in session.json in ~/.config/kloudlite), your only session. With more than one session and none selected, the server lists one tool, session_pick, until the agent picks a session. With no session, it creates the session main with no environment.
The server adds two tools for the session of your computer. session_current shows the session and its environment. session_use picks another session, and can connect it to an environment. The client then loads the tools again. The server writes stdout for the client only. The messages for you go to stderr.
If the link to the session drops, the server stays up and connects again after 5 seconds. A call that the dropped link carried returns an error, and the client repeats it. If the session ended, the server picks a session again, in the same order.
Tasks
Add the server to an MCP client
Reason for the task: Give an MCP client the tools of a session.
Job set-up
- Access: you.
- Agent tool: none; an agent uses the SDK.
- Conditions:
kloudliteis installed and you are signed in. See Install kloudlite. - References:
kloudlite mcp.
Procedure
Add the server to Claude Code. Other clients take the same command and arguments in their MCP settings.
claude mcp add kl -- kloudlite mcpAdd the team and the session to the command to serve a session other than the default.
claude mcp add kl -- kloudlite mcp acme --session devClose the client and open it again.
Close-out
- Make sure that the client lists the server
klas connected and shows its tools.
Pick the session
Reason for the task: Point the tools at the session you want to work in.
Job set-up
- Access: you.
- Agent tool:
session_use - Conditions: the server
klis connected. - References:
kloudlite sessions use,GET /v1/sessions.
Procedure
Select the session by name or
id. Addteamfor a team session.{"tool": "session_use", "arguments": {"name": "dev"}}Connect the session to an environment with
environment(an existing environment, byidor name). Usenew_environment(a name) to create one instead.{"tool": "session_use", "arguments": {"name": "dev", "environment": "api"}}
Close-out
- Run
session_current. Make sure that it names the session.
Show the session
Reason for the task: Find the session that the tools drive, and its environment.
Job set-up
- Access: you.
- Agent tool:
session_current - Conditions: the server
klis connected. - References:
GET /v1/sessions/{id}.
Procedure
Show the session.
{"tool": "session_current", "arguments": {}}
Close-out
- Make sure that the answer names the session that you expect. If it does not, pick the session.
Troubleshooting
| Symptom | Possible cause | Corrective action |
|---|---|---|
The client lists one tool, session_pick | More than one session exists and none is selected. | Call session_pick with the name or id of the session. |
kloudlite: mcp: …; retrying or …; reconnecting on stderr | The server cannot reach the session. | Wait. The server tries again every 5 seconds. If it repeats, run kloudlite login. |
The client lists no server kl | The client does not find kloudlite, or was not restarted. | Give the full path of kloudlite in the command, then restart the client. |
403 with your access to acme is paused | A team admin paused your access. | Ask a team admin to unpause it. |