langfuse-mcp-extended 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 JaviMaligno
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # Langfuse MCP Server
2
+
3
+ A comprehensive [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for [Langfuse](https://langfuse.com), providing AI assistants with access to traces, scores, datasets, and more.
4
+
5
+ ## Features
6
+
7
+ - **Traces**: List, get, and delete traces with full filtering
8
+ - **Observations**: Query generations, spans, and events
9
+ - **Scores**: Full CRUD operations for evaluation scores
10
+ - **Score Configs**: Manage score configurations
11
+ - **Datasets**: Complete dataset management including items and runs
12
+ - **Sessions**: Access session data
13
+ - **Prompts**: (Optional) Extended prompt management
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install langfuse-mcp-server
19
+ ```
20
+
21
+ Or run directly with npx:
22
+
23
+ ```bash
24
+ npx langfuse-mcp-server
25
+ ```
26
+
27
+ ## Configuration
28
+
29
+ Set the following environment variables:
30
+
31
+ ```bash
32
+ LANGFUSE_PUBLIC_KEY=pk-lf-...
33
+ LANGFUSE_SECRET_KEY=sk-lf-...
34
+ LANGFUSE_BASE_URL=https://cloud.langfuse.com # or your self-hosted URL
35
+ ```
36
+
37
+ ### Optional Configuration
38
+
39
+ ```bash
40
+ MCP_ENABLE_PROMPTS=false # Enable prompt tools (default: false, use official MCP for prompts)
41
+ LOG_LEVEL=info # debug, info, warn, error
42
+ ```
43
+
44
+ ## Usage with Claude Code
45
+
46
+ Add to your project's `.mcp.json` file:
47
+
48
+ ```json
49
+ {
50
+ "langfuse": {
51
+ "command": "node",
52
+ "args": ["/path/to/langfuse-mcp-server/build/index.mjs"],
53
+ "env": {
54
+ "LANGFUSE_PUBLIC_KEY": "pk-lf-...",
55
+ "LANGFUSE_SECRET_KEY": "sk-lf-...",
56
+ "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ## Usage with Claude Desktop
63
+
64
+ Add to your Claude Desktop configuration (`~/.config/claude/claude_desktop_config.json`):
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "langfuse": {
70
+ "command": "npx",
71
+ "args": ["langfuse-mcp-server"],
72
+ "env": {
73
+ "LANGFUSE_PUBLIC_KEY": "pk-lf-...",
74
+ "LANGFUSE_SECRET_KEY": "sk-lf-...",
75
+ "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Usage with Cursor
83
+
84
+ Add to your Cursor MCP settings:
85
+
86
+ ```json
87
+ {
88
+ "mcp": {
89
+ "servers": {
90
+ "langfuse": {
91
+ "command": "npx",
92
+ "args": ["langfuse-mcp-server"],
93
+ "env": {
94
+ "LANGFUSE_PUBLIC_KEY": "pk-lf-...",
95
+ "LANGFUSE_SECRET_KEY": "sk-lf-...",
96
+ "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ ## Available Tools
105
+
106
+ ### Traces
107
+ - `listTraces` - List traces with filtering and pagination
108
+ - `getTrace` - Get a specific trace with full details
109
+ - `deleteTrace` - Delete a trace
110
+
111
+ ### Observations
112
+ - `listObservations` - List observations (generations, spans, events)
113
+ - `getObservation` - Get a specific observation
114
+
115
+ ### Scores
116
+ - `createScore` - Create a score for a trace or observation
117
+ - `listScores` - List scores with filtering
118
+ - `getScore` - Get a specific score
119
+ - `deleteScore` - Delete a score
120
+
121
+ ### Score Configs
122
+ - `createScoreConfig` - Create a score configuration
123
+ - `listScoreConfigs` - List all score configurations
124
+ - `getScoreConfig` - Get a specific score configuration
125
+
126
+ ### Datasets
127
+ - `createDataset` - Create a new dataset
128
+ - `listDatasets` - List all datasets
129
+ - `getDataset` - Get a dataset by name
130
+ - `createDatasetItem` - Create or update a dataset item
131
+ - `listDatasetItems` - List items in a dataset
132
+ - `getDatasetItem` - Get a specific dataset item
133
+ - `deleteDatasetItem` - Delete a dataset item
134
+ - `createDatasetRunItem` - Link a trace to a dataset item
135
+ - `listDatasetRuns` - List runs for a dataset
136
+ - `getDatasetRun` - Get a specific dataset run
137
+
138
+ ### Sessions
139
+ - `listSessions` - List sessions
140
+ - `getSession` - Get a specific session
141
+
142
+ ### Prompts (Optional)
143
+ - `getPrompt` - Get a prompt by name
144
+ - `listPrompts` - List all prompts
145
+ - `createTextPrompt` - Create a text prompt
146
+ - `createChatPrompt` - Create a chat prompt
147
+ - `updatePromptLabels` - Update prompt labels
148
+
149
+ ## Development
150
+
151
+ ```bash
152
+ # Install dependencies
153
+ npm install
154
+
155
+ # Run in development mode
156
+ npm run dev
157
+
158
+ # Build
159
+ npm run build
160
+
161
+ # Run unit tests
162
+ npm test
163
+
164
+ # Run integration tests (requires Langfuse credentials)
165
+ npm run test:integration
166
+
167
+ # Run all tests
168
+ npm run test:all
169
+
170
+ # Type check
171
+ npm run typecheck
172
+
173
+ # Lint
174
+ npm run lint
175
+ ```
176
+
177
+ ## Test Coverage
178
+
179
+ - **59 unit tests** - All tools with mocked API
180
+ - **18 integration tests** - Real API calls against Langfuse
181
+
182
+ ## Upstream Contribution
183
+
184
+ This project is designed to be contributed to the official Langfuse MCP server. We're actively working with the Langfuse team:
185
+
186
+ - **Discussion**: [langfuse/langfuse#5646](https://github.com/langfuse/langfuse/discussions/5646)
187
+ - **Issue**: [langfuse/mcp-server-langfuse#14](https://github.com/langfuse/mcp-server-langfuse/issues/14)
188
+
189
+ ## Contributing
190
+
191
+ Contributions are welcome!
192
+
193
+ 1. Fork the repository
194
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
195
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
196
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
197
+ 5. Open a Pull Request
198
+
199
+ ## License
200
+
201
+ MIT License - see [LICENSE](LICENSE) for details.
202
+
203
+ ## Related
204
+
205
+ - [Langfuse](https://langfuse.com) - Open source LLM observability
206
+ - [Model Context Protocol](https://modelcontextprotocol.io) - MCP specification
207
+ - [Official Langfuse MCP Server](https://github.com/langfuse/mcp-server-langfuse) - Prompts-focused MCP server
@@ -0,0 +1,2 @@
1
+
2
+ export { }