LatentCodeCustomize
MCP servers
Connect LatentCode to other tools and data, such as issue trackers, databases and internal APIs, through the Model Context Protocol.
Add a server
latentcode mcp addThe wizard asks for a name, whether the server is Local (a command LatentCode starts) or Remote (a URL), and whether it uses OAuth. Inside a git repository it also asks whether to save it to the current project or globally. To add one in a single command (saved globally):
# local: everything after -- is the command to run
latentcode mcp add files -- npx -y @modelcontextprotocol/server-filesystem ~/Documents
# remote, with a header
latentcode mcp add tracker --url https://tracker.example.com/mcp --header "Authorization=Bearer $TRACKER_TOKEN"Check that it connects:
latentcode mcp list✓ files connected
npx -y @modelcontextprotocol/server-filesystem /Users/you/Documents
⚠ tracker needs authentication
https://tracker.example.com/mcpConfigure servers in latentcode.json
Servers live under mcp, keyed by name:
{
"mcp": {
"postgres": {
"type": "local",
"command": ["npx", "-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/app_dev"],
"environment": { "PGPASSWORD": "{env:PGPASSWORD}" }
},
"tracker": {
"type": "remote",
"url": "https://tracker.example.com/mcp",
"headers": { "Authorization": "Bearer {env:TRACKER_TOKEN}" }
},
"wiki": {
"type": "remote",
"url": "https://wiki.example.com/mcp",
"oauth": {}
}
}
}Local servers
type"local"requiredcommandstring[]requiredenvironmentobjectoptionalcwdstringoptionalenabledbooleanoptionaldefault truetimeoutintegeroptionalRemote servers
type"remote"requiredurlstringrequiredheadersobjectoptionaloauthobject | falseoptionalfalse turns OAuth off even if the server asks for it.enabledbooleanoptionaldefault truetimeoutintegeroptionalTo turn off a server defined in another config file, for example in one project, set "mcp": { "tracker": { "enabled": false } }. /mcps in the TUI turns servers on and off with space.
Log in with OAuth
- 1Add the server with an oauth block
"oauth": {}is enough for servers that support automatic client registration. Otherwise add theclientId(andclientSecret) you registered with the provider. - 2Authenticate$
latentcode mcp auth trackerYour browser opens the provider's login page. After you approve, it redirects to LatentCode on
http://127.0.0.1:19876/mcp/oauth/callback. - 3Check
latentcode mcp auth listshows each OAuth server and whether you're logged in.
| oauth field | Meaning |
|---|---|
| clientId | Client ID registered with the provider. Omit it to register automatically. |
| clientSecret | Client secret, if the provider issued one. |
| scope | Scopes to request. |
| callbackPort | Port for the redirect. Default 19876. |
| redirectUri | Full redirect URI, if the provider needs a specific one. |
Credentials are stored locally, readable only by you. Log out with latentcode mcp logout tracker. If a login fails, latentcode mcp debug tracker walks through the OAuth steps and shows where it stops.
Using MCP tools
- The agent sees each tool as
<server>_<tool>, for exampletracker_create_issue. - Tools are allowed by default. Control them with permissions:
"permission": { "tracker_*": "ask" }. - Prompts the server offers appear as slash commands; resources appear in the
@menu. - The sidebar and
/statusshow each server's status.
Troubleshooting
mcp list shows "failed"
The error follows the status. For local servers, run the command yourself to see its output; check that it's on your PATH. Start LatentCode with --print-logs for details.
"needs authentication"
Run latentcode mcp auth <name>.
"needs client registration"
The server doesn't support automatic registration. Register a client with the provider and add clientId to the server's oauth block.
The browser login never returns
Something else may be using port 19876. Set a different callbackPort.