Claude Code: .mcp.json del proyecto con el MCP remoto (credencial por variable de entorno)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 12:32:29 +02:00
parent 68783ca0b7
commit 3e7bc4dbc6
2 changed files with 27 additions and 2 deletions

11
.mcp.json Normal file
View File

@@ -0,0 +1,11 @@
{
"mcpServers": {
"bilagun": {
"type": "http",
"url": "${BILAGUN_MCP_URL:-https://mcp.gureametsabilagun.pireon.dev/mcp}",
"headers": {
"Authorization": "Basic ${BILAGUN_MCP_AUTH}"
}
}
}
}

View File

@@ -49,10 +49,24 @@ so each person acts with their own permissions and access can be revoked from th
After deploying, in Dokploy add a **domain** to the service `mcp`, port **3000** (e.g. `mcp.gureametsabilagun.pireon.dev`, HTTPS on). After deploying, in Dokploy add a **domain** to the service `mcp`, port **3000** (e.g. `mcp.gureametsabilagun.pireon.dev`, HTTPS on).
Check it: `https://mcp.gureametsabilagun.pireon.dev/healthz` → `{"ok":true}`. Check it: `https://mcp.gureametsabilagun.pireon.dev/healthz` → `{"ok":true}`.
**Claude Code** **Claude Code (from this repository)**
The repo includes `.mcp.json`, so Claude Code offers the `bilagun` server when you open the project.
Each person only sets their own credential (never committed):
```bash ```bash
claude mcp add --transport http bilagun https://mcp.gureametsabilagun.pireon.dev/mcp \ # ~/.zshrc or ~/.bashrc
export BILAGUN_MCP_AUTH="$(printf 'asistente:xxxx xxxx xxxx xxxx xxxx xxxx' | base64)"
# optional, if the MCP domain is different:
# export BILAGUN_MCP_URL="https://mcp.example.org/mcp"
```
Open a new terminal, run `claude` in the project, approve the `bilagun` server and check it with `/mcp`.
**Claude Code (any folder)**
```bash
claude mcp add --transport http --scope user bilagun https://mcp.gureametsabilagun.pireon.dev/mcp \
--header "Authorization: Basic <base64 from step 1>" --header "Authorization: Basic <base64 from step 1>"
``` ```