MCP & Plugins Intermediate
Connect an MCP Server
Add an MCP server inline to extend Claude with external tools (filesystem, database, browser)
Command
$ "color:#7C5CFC">claude -p "List files in /tmp" \ "color:#d97757">--mcp-config '{"mcpServers":{"filesystem":{"command":"">npx","args":["-y","@anthropic-ai/mcp-server-filesystem","/tmp"]}}}'
Response
{
"result": "Files in /tmp:\n- test.txt\n- logs/",
"total_cost_usd": 0.02
} Parsing Code
059669">">// Or use a config file: 059669">">// claude -p "Query DB059669">" --mcp-config ./mcp-config.json 059669">">// 059669">">// mcp-config.json: 059669">">// { "mcpServers059669">": { "db059669">": { "command059669">": "python059669">", "args059669">": ["-m059669">", "mcp_server_postgres059669">"], "env059669">": { "DATABASE_URL059669">": "..." } } } }
Gotchas
! Server starts as a child process and stops when the session ends
! Use --mcp-config path/to/file.json for reusable configurations