L2 · 09 · Using & Configuring MCP Servers

Level 1 explained what MCP is and built a toy server. This page is the practitioner's guide: when an MCP server is worth adding, how to find trustworthy ones, how to configure them in your IDE and CLI agents (with secrets done right), Metals MCP for Scala in depth, and how to troubleshoot.

Level 250 minTrack 8 · MCP & integrationLast verified 2026-10

By the end of this page you can

Do you even need an MCP server?

OptionBest whenExample
Nothing extraBuilt-in tools (read/edit files, run shell) already cover itsbt test, git diff, rg
CLI via shellA good CLI exists and the agent can run it. Simple, transparent, scriptable.gh pr view, psql -c, kubectl get
MCP serverYou need structured tools, auth flows (OAuth), use outside a terminal (chat apps, IDE chat), fine-grained approvals, or rich language intelligenceMetals (compiler-backed Scala tools), issue trackers, docs search, browser automation, Xcode
Rule of thumb Start with built-ins and CLIs. Add an MCP server when you notice the agent guessing things that a tool could know (types, symbols, ticket details, current docs, UI state), or when non-terminal hosts need the capability.

Finding servers and judging trust

Places to look: the official MCP Registry (registry.modelcontextprotocol.io, a public catalogue of server metadata), the vendor of the system you want to connect (official servers are best), your IDE's marketplace or MCP gallery, and well-known open-source projects.

Configuration recipes

VS Code (workspace: .vscode/mcp.json)

{
  "inputs": [
    { "id": "dbUrl", "type": "promptString", "description": "Read-only dev database URL", "password": true }
  ],
  "servers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@playwright/mcp@<pinned-version>"]
    },
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    },
    "orders-db": {
      "type": "stdio",
      "command": "<trusted-postgres-mcp-server>",
      "args": ["--read-only"],
      "env": { "DATABASE_URL": "${input:dbUrl}" }
    }
  }
}

CLI agents

# stdio server (local process)
claude mcp add --transport stdio playwright -- npx -y @playwright/mcp@<pinned-version>
codex  mcp add playwright -- npx -y @playwright/mcp@<pinned-version>

# remote server (HTTP)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/

# inspect
claude mcp list
codex  mcp list

CLI agents also store servers in config files (user-level and/or project-level). Project-level files can be committed when they contain no secrets. Pass secrets through environment variables.

Other hosts

Metals MCP for Scala, in depth

Metals already gives agents compiler diagnostics (the red squiggles) in editors that surface them. The MCP server goes further and lets agents actively ask the Scala tooling.

Tool category (names vary by version)What the agent gains
Compile file / module / whole projectFast, incremental feedback without running a full sbt compile
Run tests (suite or single test)Targeted verification
Inspect a symbol (members, signatures)Real APIs instead of hallucinated methods
Get docs for a symbolScaladoc for libraries in your classpath, at your exact versions
Find usages / search symbols by name or typeAccurate impact analysis for refactors
Import build, format, and other helpersKeeps the workspace in a good state
  1. VS Code: set "metals.startMcpServer": true (and enable MCP/agent mode). Metals logs a line like "Metals MCP server started on port …" and can write the MCP config for supported editors.
  2. Other editors / CLI agents: point the agent at the URL Metals prints, or use the standalone metals-mcp launcher (install with Coursier: cs install metals-mcp) with your workspace path.
  3. Teach the agent to use it. Add this to AGENTS.md:
## Scala tooling
- Use the Metals MCP tools to inspect symbols and read docs before using an unfamiliar API.
- After editing, compile the changed module with the Metals compile tool; fix all errors before running tests.
- Prefer the Metals test tool for single suites; run `sbt test` only for the final check.
Why it matters for Scala specifically Implicits/givens, type inference and macros make Scala APIs hard to guess from text alone. Compiler-backed inspection removes a whole class of AI errors, and incremental compile through Metals is much faster than cold sbt runs in agent loops.

Useful server categories

CategoryTypical usesSafety note
Code hosting (GitHub, GitLab…)Read issues/PRs, review comments, CI statusScope tokens to specific repos; review write tools
Language tooling (Metals, Xcode)Compile, inspect, testLocal, low risk
DatabasesInspect schemas, run read queries for debuggingRead-only user, dev data only, never production
Docs / web fetchCurrent library docs and changelogsFetched pages can contain prompt injections
Browser automation (e.g. Playwright MCP)Reproduce UI bugs, test flows, take screenshotsUse test accounts; isolate from real logins
Issue trackers, chat, docs wikisPull ticket context, update statusApprove outbound/write actions
Observability (logs, metrics)Investigate incidentsLogs contain personal data; redact; read-only

Keep toolsets small

Every enabled tool's name, description and schema is sent to the model on every request. Twenty servers with 300 tools cost tokens, slow responses and confuse tool choice.

Troubleshooting

SymptomLikely causeFix
Server fails to startCommand not on the PATH the IDE sees (GUI apps often have a different PATH than your shell)Use an absolute path to the executable; restart the IDE after installing
Starts, but no tools listedHandshake/protocol error, or wrong transport (stdio vs HTTP)Check the server output/logs; test with the MCP Inspector
Metals MCP missingSetting off, build not imported, port changedEnable setting, import build, re-check the port in Metals logs
401/403 from remote serverExpired token, missing scopesRe-authenticate; check token scopes
Agent ignores the toolVague description, too many tools, or the instruction isn't thereFewer tools; add guidance to AGENTS.md; name the tool in the prompt once
Calls time outSlow backend or large resultsNarrow the query; use pagination; raise timeout if the host allows
npx @modelcontextprotocol/inspector <command> <args...>
# e.g. npx @modelcontextprotocol/inspector uv run word_tools.py
Try it (40 min)
  1. On a Scala project in VS Code, enable Metals MCP. Ask the agent: "Inspect OrderService with the Metals tools and list its public methods with signatures." Confirm a Metals tool was called.
  2. Add Playwright MCP (pinned version) and ask the agent to open a local web page and describe what's broken.
  3. Write .vscode/mcp.json with one secret via inputs. Verify no secret ends up in git (git diff).
  4. Look up one server in the MCP Registry and go through the trust checklist for it.

Key takeaways