@awarecorp/mcp-logger 0.0.2-dev.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 +21 -0
- package/README.md +306 -0
- package/bin/mcp-logger.js +9 -0
- package/dist/cli/cli.js +2 -0
- package/dist/cli/interceptor.js +1 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.js +1 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/instrumentation.js +1 -0
- package/dist/sdk/types.d.ts +66 -0
- package/dist/shared/config.js +1 -0
- package/dist/shared/span-utils.js +1 -0
- package/dist/shared/telemetry.js +1 -0
- package/dist/shared/types.d.ts +53 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Aware
|
|
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,306 @@
|
|
|
1
|
+
# @awarecorp/mcp-logger
|
|
2
|
+
|
|
3
|
+
**통합 MCP Observability 솔루션** - 하나의 패키지로 SDK와 CLI를 모두 제공합니다.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 두 가지 사용 방법
|
|
8
|
+
|
|
9
|
+
### 1️⃣ **SDK**: 코드에 직접 통합
|
|
10
|
+
당신이 MCP 서버를 개발하고 있다면, SDK를 사용하세요.
|
|
11
|
+
|
|
12
|
+
### 2️⃣ **CLI**: 코드 수정 없이 래핑
|
|
13
|
+
이미 만들어진 MCP 서버(npm 패키지)를 사용한다면, CLI를 사용하세요.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 📦 설치
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @awarecorp/mcp-logger
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1️⃣ SDK 사용법
|
|
26
|
+
|
|
27
|
+
### TypeScript
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
31
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
32
|
+
import { initMCPLogger } from '@awarecorp/mcp-logger';
|
|
33
|
+
|
|
34
|
+
const server = new Server(
|
|
35
|
+
{ name: 'my-server', version: '1.0.0' },
|
|
36
|
+
{ capabilities: { tools: {} } }
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// 🔥 자동 계측 활성화 (이것만 추가하면 됩니다!)
|
|
40
|
+
initMCPLogger(server, {
|
|
41
|
+
apiKey: process.env.AWARE_API_KEY!,
|
|
42
|
+
serviceName: 'my-awesome-mcp-server',
|
|
43
|
+
debug: true, // 디버그 로그 활성화 (선택사항)
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// 평소처럼 핸들러 등록
|
|
47
|
+
server.setRequestHandler('tools/list', async () => ({
|
|
48
|
+
tools: [
|
|
49
|
+
{ name: 'read_file', description: 'Read a file' },
|
|
50
|
+
{ name: 'write_file', description: 'Write to a file' },
|
|
51
|
+
],
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
server.setRequestHandler('tools/call', async (request) => {
|
|
55
|
+
const { name, arguments: args } = request.params;
|
|
56
|
+
// 이 핸들러는 자동으로 로깅됩니다!
|
|
57
|
+
return { result: `Called ${name}` };
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// stdio transport 시작
|
|
61
|
+
const transport = new StdioServerTransport();
|
|
62
|
+
await server.connect(transport);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### JavaScript (CommonJS)
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
69
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
70
|
+
const { initMCPLogger } = require('@awarecorp/mcp-logger');
|
|
71
|
+
|
|
72
|
+
const server = new Server(
|
|
73
|
+
{ name: 'my-server', version: '1.0.0' },
|
|
74
|
+
{ capabilities: { tools: {} } }
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// 🔥 자동 계측 활성화
|
|
78
|
+
initMCPLogger(server, {
|
|
79
|
+
apiKey: process.env.AWARE_API_KEY,
|
|
80
|
+
serviceName: 'my-mcp-server',
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
server.setRequestHandler('tools/list', async () => ({
|
|
84
|
+
tools: [{ name: 'test', description: 'Test tool' }],
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
const transport = new StdioServerTransport();
|
|
88
|
+
server.connect(transport);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### SDK API
|
|
92
|
+
|
|
93
|
+
#### `initMCPLogger(server, options)`
|
|
94
|
+
|
|
95
|
+
MCP 서버에 자동 계측을 추가합니다.
|
|
96
|
+
|
|
97
|
+
**Parameters:**
|
|
98
|
+
- `server` (`MCPServer`): MCP Server 인스턴스
|
|
99
|
+
- `options` (`SDKInitOptions`):
|
|
100
|
+
- `apiKey` (string, 필수): Aware API 키
|
|
101
|
+
- `serviceName` (string, 옵션): 서비스 이름 (기본값: 자동 생성)
|
|
102
|
+
- `debug` (boolean, 옵션): 디버그 로그 활성화 (기본값: false)
|
|
103
|
+
- `endpoint` (string, 옵션): 커스텀 OTLP 엔드포인트
|
|
104
|
+
|
|
105
|
+
**Returns:** `void`
|
|
106
|
+
|
|
107
|
+
**Throws:**
|
|
108
|
+
- `Error`: apiKey가 제공되지 않은 경우
|
|
109
|
+
- `Error`: server 인스턴스가 제공되지 않은 경우
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 2️⃣ CLI 사용법
|
|
114
|
+
|
|
115
|
+
### 기본 사용법
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npx @awarecorp/mcp-logger \
|
|
119
|
+
--api-key YOUR_API_KEY \
|
|
120
|
+
-- \
|
|
121
|
+
npx @modelcontextprotocol/server-filesystem /path/to/dir
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`--` 뒤에 원래 사용하던 MCP 서버 명령어를 그대로 입력하면 됩니다.
|
|
125
|
+
|
|
126
|
+
### 전역 설치 (선택사항)
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm install -g @awarecorp/mcp-logger
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
사용:
|
|
133
|
+
```bash
|
|
134
|
+
mcp-logger --api-key YOUR_KEY -- npx server-filesystem /path
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Claude Desktop 설정
|
|
138
|
+
|
|
139
|
+
#### Before (관측성 없음)
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"filesystem": {
|
|
144
|
+
"command": "npx",
|
|
145
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Documents"]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### After (관측성 추가) ✨
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"mcpServers": {
|
|
155
|
+
"filesystem": {
|
|
156
|
+
"command": "npx",
|
|
157
|
+
"args": [
|
|
158
|
+
"-y",
|
|
159
|
+
"@awarecorp/mcp-logger",
|
|
160
|
+
"--api-key", "your-aware-api-key",
|
|
161
|
+
"--service-name", "my-filesystem-server",
|
|
162
|
+
"--",
|
|
163
|
+
"@modelcontextprotocol/server-filesystem",
|
|
164
|
+
"/Users/username/Documents"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**이게 전부입니다!** 코드 수정 없이 모든 요청/응답이 Aware 플랫폼에 기록됩니다.
|
|
172
|
+
|
|
173
|
+
### CLI 옵션
|
|
174
|
+
|
|
175
|
+
#### 필수 옵션
|
|
176
|
+
- `--api-key <key>` 또는 `-k <key>`: Aware API 키 (필수)
|
|
177
|
+
|
|
178
|
+
#### 선택 옵션
|
|
179
|
+
- `--service-name <name>` 또는 `-s <name>`: 서비스 식별 이름 (기본값: 자동 생성)
|
|
180
|
+
- `--debug` 또는 `-d`: 디버그 로그 활성화
|
|
181
|
+
- `--endpoint <url>` 또는 `-e <url>`: 커스텀 OTLP 엔드포인트
|
|
182
|
+
|
|
183
|
+
### CLI 사용 예시
|
|
184
|
+
|
|
185
|
+
#### 파일시스템 서버
|
|
186
|
+
```bash
|
|
187
|
+
npx @awarecorp/mcp-logger \
|
|
188
|
+
--api-key abc123 \
|
|
189
|
+
--service-name my-filesystem \
|
|
190
|
+
-- \
|
|
191
|
+
npx -y @modelcontextprotocol/server-filesystem /Users/username/Documents
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### GitHub 서버
|
|
195
|
+
```bash
|
|
196
|
+
npx @awarecorp/mcp-logger \
|
|
197
|
+
-k abc123 \
|
|
198
|
+
-s github-integration \
|
|
199
|
+
-- \
|
|
200
|
+
npx -y @modelcontextprotocol/server-github
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Brave Search 서버 (디버그 모드)
|
|
204
|
+
```bash
|
|
205
|
+
npx @awarecorp/mcp-logger \
|
|
206
|
+
--api-key abc123 \
|
|
207
|
+
--service-name brave-search \
|
|
208
|
+
--debug \
|
|
209
|
+
-- \
|
|
210
|
+
npx -y @modelcontextprotocol/server-brave-search
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 🏗️ 아키텍처
|
|
216
|
+
|
|
217
|
+
이 패키지는 세 가지 레이어로 구성되어 있습니다:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
@awarecorp/mcp-logger
|
|
221
|
+
├── SDK (공개 API)
|
|
222
|
+
│ ├── initMCPLogger() - MCP 서버 계측
|
|
223
|
+
│ └── shutdown() - 텔레메트리 종료
|
|
224
|
+
│
|
|
225
|
+
├── CLI (바이너리만 접근 가능)
|
|
226
|
+
│ └── mcp-logger - CLI 래퍼
|
|
227
|
+
│
|
|
228
|
+
└── Shared (내부 구현)
|
|
229
|
+
├── telemetry - OpenTelemetry 초기화
|
|
230
|
+
├── span-utils - Span 유틸리티
|
|
231
|
+
└── config - 공통 설정
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 중요한 설계 원칙
|
|
235
|
+
|
|
236
|
+
1. **SDK만 공개 API로 노출**: `import`로는 SDK만 접근 가능
|
|
237
|
+
2. **CLI는 바이너리로만 접근**: `npx` 또는 `mcp-logger` 명령어로만 사용
|
|
238
|
+
3. **공통 코드 재사용**: OpenTelemetry 로직은 shared 레이어에서 통합 관리
|
|
239
|
+
4. **타입 안전성**: CLI는 타입 정의가 노출되지 않음
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 🔧 개발
|
|
244
|
+
|
|
245
|
+
### 빌드
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
npm run build
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 로컬 테스트
|
|
252
|
+
|
|
253
|
+
#### SDK 테스트
|
|
254
|
+
```typescript
|
|
255
|
+
// test.ts
|
|
256
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
257
|
+
import { initMCPLogger } from './src/index.js';
|
|
258
|
+
|
|
259
|
+
const server = new Server({ name: 'test', version: '1.0.0' }, { capabilities: {} });
|
|
260
|
+
initMCPLogger(server, { apiKey: 'test', debug: true });
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### CLI 테스트
|
|
264
|
+
```bash
|
|
265
|
+
npm run build
|
|
266
|
+
node bin/mcp-logger.js --help
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## 📝 라이선스
|
|
272
|
+
|
|
273
|
+
MIT
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 🤝 기여
|
|
278
|
+
|
|
279
|
+
이슈와 PR은 언제나 환영합니다!
|
|
280
|
+
|
|
281
|
+
자세한 개발 가이드는 [DEVELOPMENT.md](./DEVELOPMENT.md)를 참조하세요.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 📦 배포 (Maintainers Only)
|
|
286
|
+
|
|
287
|
+
### Stable 버전 배포
|
|
288
|
+
```bash
|
|
289
|
+
npm run version:patch # 또는 minor, major
|
|
290
|
+
npm run publish:stable
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Dev 버전 배포
|
|
294
|
+
```bash
|
|
295
|
+
npm run version:dev
|
|
296
|
+
npm run publish:dev
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
자세한 내용은 [DEVELOPMENT.md](./DEVELOPMENT.md#배포)를 참조하세요.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## 📞 지원
|
|
304
|
+
|
|
305
|
+
- 문서: [https://aware.mcypher.com/docs](https://aware.mcypher.com/docs)
|
|
306
|
+
- 이슈: [GitHub Issues](https://github.com/your-org/mcp-logger/issues)
|
package/dist/cli/cli.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{spawn as e}from"child_process";import{program as r}from"commander";import{NodeSDK as t}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as o}from"@opentelemetry/exporter-trace-otlp-http";import{Resource as s}from"@opentelemetry/resources";import{trace as i,SpanStatusCode as n}from"@opentelemetry/api";import{Transform as c}from"stream";const a="https://aware.mcypher.com/v1/traces",g="1.0.0";let d=null,p=null,u=!1;function l(){return p}async function m(){if(d)try{await d.shutdown(),d=null,p=null,u=!1}catch(e){console.error("[MCP Logger] Error shutting down telemetry:",e)}}function h(e,r=1e4){try{const t=JSON.stringify(e);return t.length>r?t.slice(0,r)+"... (truncated)":t}catch(e){return null}}class f extends c{buffer="";direction;debug;constructor(e,r=!1){super(),this.direction=e,this.debug=r}_transform(e,r,t){try{this.push(e),this.buffer+=e.toString(),this.buffer.length>1e6&&(this.debug&&console.error("[MCP Logger CLI] Buffer size exceeded, clearing..."),this.buffer=""),this.tryParseMessages(),t()}catch(e){t(e)}}tryParseMessages(){const e=this.buffer.split("\n");this.buffer=e.pop()||"";for(const r of e){const e=r.trim();if(e)try{const r=JSON.parse(e);this.traceMessage(r).catch(e=>{this.debug&&console.error("[MCP Logger CLI] Trace error:",e)})}catch(r){this.debug&&console.error("[MCP Logger CLI] Failed to parse:",e)}}}async traceMessage(e){const r=l();if(!r)return void(this.debug&&console.error("[MCP Logger CLI] Tracer not initialized"));const t=e.method?`mcp.${e.method}`:void 0!==e.id?"mcp.response":"mcp.notification";return new Promise(o=>{r.startActiveSpan(t,r=>{try{if(function(e,r){for(const[t,o]of Object.entries(r))null!=o&&e.setAttribute(t,o)}(r,{"mcp.direction":this.direction,"mcp.jsonrpc":e.jsonrpc||"2.0"}),void 0!==e.id&&r.setAttribute("mcp.id",String(e.id)),e.method&&r.setAttribute("mcp.method",e.method),e.params){const t=h(e.params);t&&(r.setAttribute("mcp.params.size",t.length),t.length<1e3&&r.setAttribute("mcp.params",t))}const t=h(e);t&&function(e,r,t,o){try{t?e.addEvent(r,t):e.addEvent(r)}catch(e){o&&console.error("[MCP Logger] Failed to add span event:",e)}}(r,`mcp.${this.direction}`,{message:t,timestamp:Date.now()},this.debug),this.debug&&console.error(`[MCP Logger CLI] ${this.direction}:`,JSON.stringify(e,null,2)),e.error?(r.setAttribute("mcp.error",!0),r.setAttribute("mcp.error.code",e.error.code),r.setAttribute("mcp.error.message",e.error.message),r.setStatus({code:n.ERROR,message:e.error.message})):function(e){e.setStatus({code:n.OK})}(r)}catch(e){this.debug&&console.error("[MCP Logger CLI] Error in span:",e),r.setStatus({code:n.ERROR,message:String(e)})}finally{r.end(),o()}})})}_flush(e){try{if(this.buffer.trim())try{const e=JSON.parse(this.buffer);this.traceMessage(e).catch(e=>{this.debug&&console.error("[MCP Logger CLI] Trace error:",e)})}catch(e){this.debug&&console.error("[MCP Logger CLI] Failed to parse final buffer:",e)}e()}catch(r){e(r)}}}r.name("mcp-logger").description("Add observability to any MCP server without code changes").version("1.0.0").requiredOption("-k, --api-key <key>","Aware API key").option("-s, --service-name <name>","Service name for identification").option("-d, --debug","Enable debug logging",!1).option("-e, --endpoint <url>","Custom OTLP endpoint").argument("<command...>","MCP server command to wrap").action(async(r,n)=>{try{!function(e){if(u)return e.debug&&console.error("[MCP Logger] Telemetry already initialized, returning existing tracer"),p;const r=e.serviceName||`mcp-server-${Math.random().toString(36).slice(2,8)}`;e.debug&&(console.error("[MCP Logger] Initializing telemetry..."),console.error(`[MCP Logger] Endpoint: ${e.endpoint||a}`),console.error(`[MCP Logger] Service: ${r}`)),d=new t({resource:new s({"service.name":r,"service.version":g}),traceExporter:new o({url:e.endpoint||a,headers:{"x-api-key":e.apiKey}})}),d.start(),p=i.getTracer("mcp-logger",g),u=!0,e.debug&&console.error("[MCP Logger] Telemetry initialized successfully");const n=async()=>{e.debug&&console.error("[MCP Logger] Shutting down telemetry..."),await m()};process.once("SIGTERM",n),process.once("SIGINT",n)}(n),n.debug&&console.error("[MCP Logger CLI] Starting MCP server:",r.join(" "));const[c,...l]=r,h=e(c,l,{stdio:["pipe","pipe","inherit"],env:{...process.env,MCP_LOGGER_ENABLED:"true"}}),b=new f("request",n.debug);process.stdin.pipe(b).pipe(h.stdin);const C=new f("response",n.debug);h.stdout.pipe(C).pipe(process.stdout),h.on("error",async e=>{console.error("[MCP Logger CLI] Failed to start MCP server:",e),await m(),process.exit(1)}),h.on("exit",async(e,r)=>{n.debug&&console.error(`[MCP Logger CLI] MCP server exited with code ${e}, signal ${r}`),await m(),process.exit(e||0)});let y=!1;const L=async e=>{y||(y=!0,n.debug&&console.error(`[MCP Logger CLI] Received ${e}, shutting down...`),h.kill(e),await Promise.race([new Promise(e=>h.once("exit",e)),new Promise(e=>setTimeout(e,5e3))]),await m(),process.exit(0))};process.on("SIGTERM",()=>L("SIGTERM")),process.on("SIGINT",()=>L("SIGINT"))}catch(e){console.error("[MCP Logger CLI] Fatal error:",e),await m(),process.exit(1)}}),r.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Transform as e}from"stream";import"@opentelemetry/api";import"@opentelemetry/sdk-node";import"@opentelemetry/exporter-trace-otlp-http";import"@opentelemetry/resources";class r extends e{buffer="";direction;debug;constructor(e,r=!1){super(),this.direction=e,this.debug=r}_transform(e,r,t){try{this.push(e),this.buffer+=e.toString(),this.buffer.length>1e6&&(this.debug&&console.error("[MCP Logger CLI] Buffer size exceeded, clearing..."),this.buffer=""),this.tryParseMessages(),t()}catch(e){t(e)}}tryParseMessages(){const e=this.buffer.split("\n");this.buffer=e.pop()||"";for(const r of e){const e=r.trim();if(e)try{const r=JSON.parse(e);this.traceMessage(r).catch(e=>{this.debug&&console.error("[MCP Logger CLI] Trace error:",e)})}catch(r){this.debug&&console.error("[MCP Logger CLI] Failed to parse:",e)}}}async traceMessage(e){this.debug&&console.error("[MCP Logger CLI] Tracer not initialized")}_flush(e){try{if(this.buffer.trim())try{const e=JSON.parse(this.buffer);this.traceMessage(e).catch(e=>{this.debug&&console.error("[MCP Logger CLI] Trace error:",e)})}catch(e){this.debug&&console.error("[MCP Logger CLI] Failed to parse final buffer:",e)}e()}catch(r){e(r)}}}export{r as MessageInterceptor};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 공통 타입 정의
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 텔레메트리 초기화 옵션
|
|
8
|
+
*/
|
|
9
|
+
interface TelemetryOptions {
|
|
10
|
+
/**
|
|
11
|
+
* API Key for authentication (필수)
|
|
12
|
+
*/
|
|
13
|
+
apiKey: string;
|
|
14
|
+
/**
|
|
15
|
+
* 서비스 이름 (옵션)
|
|
16
|
+
* 지정하지 않으면 자동으로 'mcp-server-{random}' 형식으로 생성
|
|
17
|
+
*/
|
|
18
|
+
serviceName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* 커스텀 OTLP 엔드포인트 (옵션)
|
|
21
|
+
* 기본값: CONFIG.ENDPOINT
|
|
22
|
+
*/
|
|
23
|
+
endpoint?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 디버그 로그 활성화 (옵션)
|
|
26
|
+
*/
|
|
27
|
+
debug?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* SDK 타입 정의
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* SDK 초기화 옵션 (TelemetryOptions 확장)
|
|
36
|
+
*/
|
|
37
|
+
interface SDKInitOptions extends TelemetryOptions {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* MCP Server 타입 (재export)
|
|
41
|
+
*/
|
|
42
|
+
type MCPServer = Server;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 공통 텔레메트리 레이어
|
|
46
|
+
*
|
|
47
|
+
* OpenTelemetry SDK 초기화 및 관리를 담당합니다.
|
|
48
|
+
* SDK와 CLI 양쪽에서 공통으로 사용됩니다.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Telemetry 종료
|
|
53
|
+
*/
|
|
54
|
+
declare function shutdownTelemetry(): Promise<void>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* MCP Logger SDK
|
|
58
|
+
*
|
|
59
|
+
* MCP 서버에 자동 관측성(Observability)을 추가하는 SDK입니다.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* MCP 서버에 자동 계측을 추가합니다.
|
|
64
|
+
*
|
|
65
|
+
* 이 함수는 MCP 서버의 모든 요청/응답을 자동으로 로깅하고 추적합니다.
|
|
66
|
+
* OpenTelemetry를 사용하여 traces를 수집하며, 설정된 엔드포인트로 전송합니다.
|
|
67
|
+
*
|
|
68
|
+
* @param server - MCP Server 인스턴스
|
|
69
|
+
* @param options - 초기화 옵션
|
|
70
|
+
*
|
|
71
|
+
* @throws {Error} apiKey가 제공되지 않은 경우
|
|
72
|
+
* @throws {Error} server 인스턴스가 제공되지 않은 경우
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* TypeScript 사용 예시:
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
78
|
+
* import { initMCPLogger } from '@awarecorp/mcp-logger';
|
|
79
|
+
*
|
|
80
|
+
* const server = new Server({ name: 'my-server', version: '1.0.0' }, {
|
|
81
|
+
* capabilities: { tools: {} }
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* initMCPLogger(server, {
|
|
85
|
+
* apiKey: 'your-api-key',
|
|
86
|
+
* serviceName: 'my-mcp-server',
|
|
87
|
+
* debug: true,
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* server.setRequestHandler('tools/call', async (request) => {
|
|
91
|
+
* // 이 핸들러는 자동으로 로깅됩니다
|
|
92
|
+
* return { result: 'success' };
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* JavaScript 사용 예시:
|
|
98
|
+
* ```javascript
|
|
99
|
+
* const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
|
|
100
|
+
* const { initMCPLogger } = require('@awarecorp/mcp-logger');
|
|
101
|
+
*
|
|
102
|
+
* const server = new Server({ name: 'my-server', version: '1.0.0' }, {
|
|
103
|
+
* capabilities: { tools: {} }
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* initMCPLogger(server, {
|
|
107
|
+
* apiKey: process.env.API_KEY,
|
|
108
|
+
* serviceName: 'my-mcp-server',
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function initMCPLogger(server: MCPServer, options: SDKInitOptions): void;
|
|
113
|
+
|
|
114
|
+
export { initMCPLogger, shutdownTelemetry as shutdown };
|
|
115
|
+
export type { MCPServer, SDKInitOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NodeSDK as e}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as r}from"@opentelemetry/exporter-trace-otlp-http";import{Resource as t}from"@opentelemetry/resources";import{trace as o,SpanStatusCode as n}from"@opentelemetry/api";const s="https://aware.mcypher.com/v1/traces",c="1.0.0";let i=null,a=null,l=!1;function u(){return a}async function g(){if(i)try{await i.shutdown(),i=null,a=null,l=!1}catch(e){console.error("[MCP Logger] Error shutting down telemetry:",e)}}function m(e,r){for(const[t,o]of Object.entries(r))null!=o&&e.setAttribute(t,o)}function p(e,r,t,o){try{t?e.addEvent(r,t):e.addEvent(r)}catch(e){o&&console.error("[MCP Logger] Failed to add span event:",e)}}function d(e,r=1e4){try{const t=JSON.stringify(e);return t.length>r?t.slice(0,r)+"... (truncated)":t}catch(e){return null}}function h(h,f){if(!f.apiKey)throw new Error("[MCP Logger SDK] apiKey is required");if(!h)throw new Error("[MCP Logger SDK] server instance is required");!function(n){if(l)return n.debug&&console.error("[MCP Logger] Telemetry already initialized, returning existing tracer"),a;const u=n.serviceName||`mcp-server-${Math.random().toString(36).slice(2,8)}`;n.debug&&(console.error("[MCP Logger] Initializing telemetry..."),console.error(`[MCP Logger] Endpoint: ${n.endpoint||s}`),console.error(`[MCP Logger] Service: ${u}`)),i=new e({resource:new t({"service.name":u,"service.version":c}),traceExporter:new r({url:n.endpoint||s,headers:{"x-api-key":n.apiKey}})}),i.start(),a=o.getTracer("mcp-logger",c),l=!0,n.debug&&console.error("[MCP Logger] Telemetry initialized successfully");const m=async()=>{n.debug&&console.error("[MCP Logger] Shutting down telemetry..."),await g()};process.once("SIGTERM",m),process.once("SIGINT",m)}(f),function(e,r=!1){const t=u();if(!t)throw new Error("[MCP Logger SDK] Tracer not initialized. Call initMCPLogger first.");const o=e.setRequestHandler.bind(e);e.setRequestHandler=function(e,s){const c=e.shape?.method,i=c?._def?.value||"unknown";return r&&console.log(`[MCP Logger SDK] Instrumenting handler: ${i}`),o(e,async(e,o)=>{const c=`mcp.${i}`;return await t.startActiveSpan(c,{attributes:{"mcp.method":i,"mcp.request.method":e.method}},async t=>{const c=Date.now();try{const i=d(e.params||{});m(t,{"mcp.request.id":"unknown","mcp.request.params.size":i?.length}),i&&i.length<1e3&&t.setAttribute("mcp.request.params",i),p(t,"mcp.request.received",{"request.method":e.method,"request.timestamp":c},r),r&&console.log("[MCP Logger SDK] Request received:",{method:e.method,params:e.params});const a=await s(e,o),l=Date.now(),u=l-c,g=d(a);return m(t,{"mcp.duration_ms":u,"mcp.response.size":g?.length}),g&&g.length<1e3&&t.setAttribute("mcp.response.result",g),p(t,"mcp.response.sent",{"response.timestamp":l,"response.duration_ms":u},r),function(e){e.setStatus({code:n.OK})}(t),r&&console.log(`[MCP Logger SDK] Response sent (${u}ms):`,a),a}catch(e){throw function(e,r,t){const o=r instanceof Error?r.message:"Unknown error",s=r instanceof Error?r.constructor.name:"Error";r instanceof Error&&e.recordException(r),e.setStatus({code:n.ERROR,message:o}),e.setAttribute("error",!0),e.setAttribute("error.type",s),e.setAttribute("error.message",o),t&&console.error("[MCP Logger] Error recorded in span:",r)}(t,e,r),r&&console.error("[MCP Logger SDK] Error occurred:",e),e}finally{t.end()}})})},r&&console.log("[MCP Logger SDK] Server instrumentation complete")}(h,f.debug),f.debug&&console.log("[MCP Logger SDK] ✓ Initialization complete")}export{h as initMCPLogger,g as shutdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NodeSDK as e}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as r}from"@opentelemetry/exporter-trace-otlp-http";import{Resource as t}from"@opentelemetry/resources";import{trace as o,SpanStatusCode as n}from"@opentelemetry/api";const s="https://aware.mcypher.com/v1/traces",c="1.0.0";let i=null,a=null,l=!1;function u(){return a}async function g(){if(i)try{await i.shutdown(),i=null,a=null,l=!1}catch(e){console.error("[MCP Logger] Error shutting down telemetry:",e)}}function m(e,r){for(const[t,o]of Object.entries(r))null!=o&&e.setAttribute(t,o)}function p(e,r,t,o){try{t?e.addEvent(r,t):e.addEvent(r)}catch(e){o&&console.error("[MCP Logger] Failed to add span event:",e)}}function d(e,r=1e4){try{const t=JSON.stringify(e);return t.length>r?t.slice(0,r)+"... (truncated)":t}catch(e){return null}}function h(h,f){if(!f.apiKey)throw new Error("[MCP Logger SDK] apiKey is required");if(!h)throw new Error("[MCP Logger SDK] server instance is required");!function(n){if(l)return n.debug&&console.error("[MCP Logger] Telemetry already initialized, returning existing tracer"),a;const u=n.serviceName||`mcp-server-${Math.random().toString(36).slice(2,8)}`;n.debug&&(console.error("[MCP Logger] Initializing telemetry..."),console.error(`[MCP Logger] Endpoint: ${n.endpoint||s}`),console.error(`[MCP Logger] Service: ${u}`)),i=new e({resource:new t({"service.name":u,"service.version":c}),traceExporter:new r({url:n.endpoint||s,headers:{"x-api-key":n.apiKey}})}),i.start(),a=o.getTracer("mcp-logger",c),l=!0,n.debug&&console.error("[MCP Logger] Telemetry initialized successfully");const m=async()=>{n.debug&&console.error("[MCP Logger] Shutting down telemetry..."),await g()};process.once("SIGTERM",m),process.once("SIGINT",m)}(f),function(e,r=!1){const t=u();if(!t)throw new Error("[MCP Logger SDK] Tracer not initialized. Call initMCPLogger first.");const o=e.setRequestHandler.bind(e);e.setRequestHandler=function(e,s){const c=e.shape?.method,i=c?._def?.value||"unknown";return r&&console.log(`[MCP Logger SDK] Instrumenting handler: ${i}`),o(e,async(e,o)=>{const c=`mcp.${i}`;return await t.startActiveSpan(c,{attributes:{"mcp.method":i,"mcp.request.method":e.method}},async t=>{const c=Date.now();try{const i=d(e.params||{});m(t,{"mcp.request.id":"unknown","mcp.request.params.size":i?.length}),i&&i.length<1e3&&t.setAttribute("mcp.request.params",i),p(t,"mcp.request.received",{"request.method":e.method,"request.timestamp":c},r),r&&console.log("[MCP Logger SDK] Request received:",{method:e.method,params:e.params});const a=await s(e,o),l=Date.now(),u=l-c,g=d(a);return m(t,{"mcp.duration_ms":u,"mcp.response.size":g?.length}),g&&g.length<1e3&&t.setAttribute("mcp.response.result",g),p(t,"mcp.response.sent",{"response.timestamp":l,"response.duration_ms":u},r),function(e){e.setStatus({code:n.OK})}(t),r&&console.log(`[MCP Logger SDK] Response sent (${u}ms):`,a),a}catch(e){throw function(e,r,t){const o=r instanceof Error?r.message:"Unknown error",s=r instanceof Error?r.constructor.name:"Error";r instanceof Error&&e.recordException(r),e.setStatus({code:n.ERROR,message:o}),e.setAttribute("error",!0),e.setAttribute("error.type",s),e.setAttribute("error.message",o),t&&console.error("[MCP Logger] Error recorded in span:",r)}(t,e,r),r&&console.error("[MCP Logger SDK] Error occurred:",e),e}finally{t.end()}})})},r&&console.log("[MCP Logger SDK] Server instrumentation complete")}(h,f.debug),f.debug&&console.log("[MCP Logger SDK] ✓ Initialization complete")}export{h as initMCPLogger,g as shutdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"@opentelemetry/sdk-node";import"@opentelemetry/exporter-trace-otlp-http";import"@opentelemetry/resources";import"@opentelemetry/api";function e(e,t=!1){throw new Error("[MCP Logger SDK] Tracer not initialized. Call initMCPLogger first.")}export{e as instrumentMCPServer};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { ZodObject, ZodLiteral } from 'zod';
|
|
3
|
+
import { Request, Result } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 공통 타입 정의
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 텔레메트리 초기화 옵션
|
|
10
|
+
*/
|
|
11
|
+
interface TelemetryOptions {
|
|
12
|
+
/**
|
|
13
|
+
* API Key for authentication (필수)
|
|
14
|
+
*/
|
|
15
|
+
apiKey: string;
|
|
16
|
+
/**
|
|
17
|
+
* 서비스 이름 (옵션)
|
|
18
|
+
* 지정하지 않으면 자동으로 'mcp-server-{random}' 형식으로 생성
|
|
19
|
+
*/
|
|
20
|
+
serviceName?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 커스텀 OTLP 엔드포인트 (옵션)
|
|
23
|
+
* 기본값: CONFIG.ENDPOINT
|
|
24
|
+
*/
|
|
25
|
+
endpoint?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 디버그 로그 활성화 (옵션)
|
|
28
|
+
*/
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* SDK 타입 정의
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* SDK 초기화 옵션 (TelemetryOptions 확장)
|
|
38
|
+
*/
|
|
39
|
+
interface SDKInitOptions extends TelemetryOptions {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* MCP JSON-RPC Request 타입
|
|
43
|
+
*/
|
|
44
|
+
type MCPRequest = Request;
|
|
45
|
+
/**
|
|
46
|
+
* MCP Result 타입
|
|
47
|
+
*/
|
|
48
|
+
type MCPResult = Result;
|
|
49
|
+
/**
|
|
50
|
+
* MCP Request Schema 타입
|
|
51
|
+
*/
|
|
52
|
+
type MCPRequestSchema = ZodObject<{
|
|
53
|
+
method: ZodLiteral<string>;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Request Handler Extra 타입
|
|
57
|
+
*/
|
|
58
|
+
interface RequestHandlerExtra {
|
|
59
|
+
signal: AbortSignal;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* MCP Server 타입 (재export)
|
|
63
|
+
*/
|
|
64
|
+
type MCPServer = Server;
|
|
65
|
+
|
|
66
|
+
export type { MCPRequest, MCPRequestSchema, MCPResult, MCPServer, RequestHandlerExtra, SDKInitOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={ENDPOINT:"https://aware.mcypher.com/v1/traces",SDK_VERSION:"1.0.0",SERVICE_NAME_PREFIX:"mcp-server"};export{e as CONFIG};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SpanStatusCode as t,context as r,trace as e}from"@opentelemetry/api";function n(t,r){for(const[e,n]of Object.entries(r))null!=n&&t.setAttribute(e,n)}function o(t,r,e,n){try{e?t.addEvent(r,e):t.addEvent(r)}catch(t){n&&console.error("[MCP Logger] Failed to add span event:",t)}}function c(r,e,n){const o=e instanceof Error?e.message:"Unknown error",c=e instanceof Error?e.constructor.name:"Error";e instanceof Error&&r.recordException(e),r.setStatus({code:t.ERROR,message:o}),r.setAttribute("error",!0),r.setAttribute("error.type",c),r.setAttribute("error.message",o),n&&console.error("[MCP Logger] Error recorded in span:",e)}function s(r){r.setStatus({code:t.OK})}function a(t,r=1e4){try{const e=JSON.stringify(t);return e.length>r?e.slice(0,r)+"... (truncated)":e}catch(t){return null}}function i(){const t={},n=r.active(),o=e.getSpan(n);if(o){const r=o.spanContext();r&&(t.traceparent=`00-${r.traceId}-${r.spanId}-01`)}return t}export{o as addSpanEvent,i as getTraceHeaders,s as markSpanSuccess,c as recordSpanError,a as safeStringify,n as setSpanAttributes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NodeSDK as e}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as r}from"@opentelemetry/exporter-trace-otlp-http";import{Resource as o}from"@opentelemetry/resources";import{trace as t}from"@opentelemetry/api";const n="https://aware.mcypher.com/v1/traces",i="1.0.0";let c=null,s=null,l=!1;function a(a){if(l)return a.debug&&console.error("[MCP Logger] Telemetry already initialized, returning existing tracer"),s;const g=a.serviceName||`mcp-server-${Math.random().toString(36).slice(2,8)}`;a.debug&&(console.error("[MCP Logger] Initializing telemetry..."),console.error(`[MCP Logger] Endpoint: ${a.endpoint||n}`),console.error(`[MCP Logger] Service: ${g}`)),c=new e({resource:new o({"service.name":g,"service.version":i}),traceExporter:new r({url:a.endpoint||n,headers:{"x-api-key":a.apiKey}})}),c.start(),s=t.getTracer("mcp-logger",i),l=!0,a.debug&&console.error("[MCP Logger] Telemetry initialized successfully");const p=async()=>{a.debug&&console.error("[MCP Logger] Shutting down telemetry..."),await u()};return process.once("SIGTERM",p),process.once("SIGINT",p),s}function g(){return s}function p(){return l}async function u(){if(c)try{await c.shutdown(),c=null,s=null,l=!1}catch(e){console.error("[MCP Logger] Error shutting down telemetry:",e)}}export{g as getTracer,a as initializeTelemetry,p as isInitializedTelemetry,u as shutdownTelemetry};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 공통 타입 정의
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 텔레메트리 초기화 옵션
|
|
6
|
+
*/
|
|
7
|
+
interface TelemetryOptions {
|
|
8
|
+
/**
|
|
9
|
+
* API Key for authentication (필수)
|
|
10
|
+
*/
|
|
11
|
+
apiKey: string;
|
|
12
|
+
/**
|
|
13
|
+
* 서비스 이름 (옵션)
|
|
14
|
+
* 지정하지 않으면 자동으로 'mcp-server-{random}' 형식으로 생성
|
|
15
|
+
*/
|
|
16
|
+
serviceName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 커스텀 OTLP 엔드포인트 (옵션)
|
|
19
|
+
* 기본값: CONFIG.ENDPOINT
|
|
20
|
+
*/
|
|
21
|
+
endpoint?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 디버그 로그 활성화 (옵션)
|
|
24
|
+
*/
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Span 속성 인터페이스
|
|
29
|
+
*/
|
|
30
|
+
interface SpanAttributes {
|
|
31
|
+
[key: string]: string | number | boolean | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* MCP 메시지 방향
|
|
35
|
+
*/
|
|
36
|
+
type MessageDirection = 'request' | 'response';
|
|
37
|
+
/**
|
|
38
|
+
* JSON-RPC 메시지 타입
|
|
39
|
+
*/
|
|
40
|
+
interface JSONRPCMessage {
|
|
41
|
+
jsonrpc: '2.0';
|
|
42
|
+
id?: string | number;
|
|
43
|
+
method?: string;
|
|
44
|
+
params?: any;
|
|
45
|
+
result?: any;
|
|
46
|
+
error?: {
|
|
47
|
+
code: number;
|
|
48
|
+
message: string;
|
|
49
|
+
data?: any;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { JSONRPCMessage, MessageDirection, SpanAttributes, TelemetryOptions };
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@awarecorp/mcp-logger",
|
|
3
|
+
"version": "0.0.2-dev.0",
|
|
4
|
+
"description": "Unified MCP observability solution - SDK for code integration and CLI for zero-config wrapping",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcp-logger": "./bin/mcp-logger.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"bin",
|
|
14
|
+
"!dist/cli/**/*.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "npm run clean && rollup -c",
|
|
18
|
+
"build:readable": "npm run clean && tsc",
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"clean": "rm -rf dist",
|
|
21
|
+
"dev": "tsc --watch",
|
|
22
|
+
"test:cli": "npm run build:readable && node bin/mcp-logger.js --help",
|
|
23
|
+
"publish:stable": "npm run build && npm publish --access public",
|
|
24
|
+
"publish:dev": "npm run build && npm publish --access public --tag dev",
|
|
25
|
+
"version:patch": "npm version patch",
|
|
26
|
+
"version:minor": "npm version minor",
|
|
27
|
+
"version:major": "npm version major",
|
|
28
|
+
"version:dev": "npm version prerelease --preid=dev"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mcp",
|
|
32
|
+
"observer",
|
|
33
|
+
"observability",
|
|
34
|
+
"opentelemetry",
|
|
35
|
+
"tracing",
|
|
36
|
+
"logging",
|
|
37
|
+
"cli",
|
|
38
|
+
"wrapper",
|
|
39
|
+
"aware"
|
|
40
|
+
],
|
|
41
|
+
"author": "Aware",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "^0.5.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"@modelcontextprotocol/sdk": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@opentelemetry/api": "^1.9.0",
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.52.0",
|
|
54
|
+
"@opentelemetry/resources": "^1.25.0",
|
|
55
|
+
"@opentelemetry/sdk-node": "^0.52.0",
|
|
56
|
+
"@opentelemetry/semantic-conventions": "^1.25.0",
|
|
57
|
+
"commander": "^11.1.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
61
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
62
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
63
|
+
"@types/node": "^20.0.0",
|
|
64
|
+
"rollup": "^4.52.5",
|
|
65
|
+
"rollup-plugin-dts": "^6.2.3",
|
|
66
|
+
"tslib": "^2.8.1",
|
|
67
|
+
"typescript": "^5.3.0"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=18"
|
|
71
|
+
}
|
|
72
|
+
}
|