From 6c13abecf433c681ea75f11335cd0521a1253aee Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Wed, 12 Mar 2025 13:16:16 +0100 Subject: [PATCH] Add Logfire MCP server documentation --- docs/how-to-guides/mcp-server.md | 70 ++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 71 insertions(+) create mode 100644 docs/how-to-guides/mcp-server.md diff --git a/docs/how-to-guides/mcp-server.md b/docs/how-to-guides/mcp-server.md new file mode 100644 index 00000000..d870c22f --- /dev/null +++ b/docs/how-to-guides/mcp-server.md @@ -0,0 +1,70 @@ +# Logfire MCP Server + +**Logfire** has its own [MCP server](https://modelcontextprotocol.io/introduction), which +you can use on [Claude Desktop](https://www.anthropic.com/news/claude-desktop), +[Cursor](https://www.cursor.com/), and any other software that supports MCP Servers. + +## Connect to the MCP server + +Here's how to connect different clients to the MCP server: + +### Cursor + +You can configure Cursor by creating a `.cursor/mcp.json` file in your project root: + +```json +{ + "mcpServers": { + "logfire": { + "command": "uvx", + "args": ["logfire-mcp", "--logfire-read-token=YOUR-TOKEN"], + } + } +} +``` + +!!! note + You need to pass the token via the `--logfire-read-token` flag, because Cursor doesn't + support the `env` field in the MCP configuration. + +For more detailed information, you can check the +[Cursor documentation](https://docs.cursor.com/context/model-context-protocol). + +### Claude Desktop + +In Claude Desktop, go to Settings → Advanced and add the following MCP configuration: +```json +{ + "command": ["logfire-mcp"], + "type": "stdio", + "env": { + "LOGFIRE_READ_TOKEN": "your_token" + } +} +``` + +Check out the [MCP quickstart](https://modelcontextprotocol.io/quickstart/user) +for more information. + +### Cline + +When using [Cline](https://docs.cline.bot/), you can configure the +`cline_mcp_settings.json` file to connect to the MCP server: + +```json +{ + "mcpServers": { + "logfire": { + "command": "uvx", + "args": [ + "logfire-mcp", + ], + "env": { + "LOGFIRE_READ_TOKEN": "your_token" + }, + "disabled": false, + "autoApprove": [] + } + } +} +``` diff --git a/mkdocs.yml b/mkdocs.yml index a5b32e90..16f279c7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -84,6 +84,7 @@ nav: - Alerts (Beta): guides/web-ui/alerts.md - SQL Explorer: guides/web-ui/explore.md - How To - Guides: + - Connect to the MCP Server: how-to-guides/mcp-server.md - Create Write Tokens: how-to-guides/create-write-tokens.md - Use different environments: how-to-guides/environments.md - Link to Code Source: how-to-guides/link-to-code-source.md