@intrig/mcp 0.0.1
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/README.md +229 -0
- package/dist/app/intrig-mcp/src/formatters/documentation.d.ts +73 -0
- package/dist/app/intrig-mcp/src/formatters/documentation.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/main.d.ts +9 -0
- package/dist/app/intrig-mcp/src/main.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/mcp/server.d.ts +14 -0
- package/dist/app/intrig-mcp/src/mcp/server.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/mcp/tools/get-documentation.d.ts +23 -0
- package/dist/app/intrig-mcp/src/mcp/tools/get-documentation.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/mcp/tools/get-project.d.ts +21 -0
- package/dist/app/intrig-mcp/src/mcp/tools/get-project.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/mcp/tools/list-projects.d.ts +13 -0
- package/dist/app/intrig-mcp/src/mcp/tools/list-projects.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/mcp/tools/search.d.ts +24 -0
- package/dist/app/intrig-mcp/src/mcp/tools/search.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/services/daemon-client.d.ts +54 -0
- package/dist/app/intrig-mcp/src/services/daemon-client.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/services/discovery.service.d.ts +60 -0
- package/dist/app/intrig-mcp/src/services/discovery.service.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/types/daemon-api.d.ts +150 -0
- package/dist/app/intrig-mcp/src/types/daemon-api.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/types/discovery.d.ts +61 -0
- package/dist/app/intrig-mcp/src/types/discovery.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/utils/errors.d.ts +25 -0
- package/dist/app/intrig-mcp/src/utils/errors.d.ts.map +1 -0
- package/dist/app/intrig-mcp/src/utils/logger.d.ts +25 -0
- package/dist/app/intrig-mcp/src/utils/logger.d.ts.map +1 -0
- package/dist/main.js +1426 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -0
- package/package.json +118 -0
package/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# @intrig/mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [Intrig](https://intrig.io) - exposes API documentation and search capabilities to Claude Desktop and MCP-compatible IDEs.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Intrig MCP server acts as a bridge between LLM clients (like Claude Desktop) and your Intrig-powered projects. It allows you to:
|
|
8
|
+
|
|
9
|
+
- **Search** for API endpoints and schemas by name, path, or description
|
|
10
|
+
- **View documentation** for hooks, functions, and type structures
|
|
11
|
+
- **Explore** request/response types and related resources
|
|
12
|
+
|
|
13
|
+
All without leaving your conversation with Claude.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Using npx (Recommended)
|
|
18
|
+
|
|
19
|
+
No installation required - configure Claude Desktop to run via npx:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"intrig": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["@intrig/mcp"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Global Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g @intrig/mcp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then configure Claude Desktop:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"intrig": {
|
|
44
|
+
"command": "intrig-mcp"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Claude Desktop Setup
|
|
51
|
+
|
|
52
|
+
1. Open Claude Desktop settings
|
|
53
|
+
2. Navigate to the MCP servers configuration
|
|
54
|
+
3. Add the Intrig MCP server configuration (see above)
|
|
55
|
+
4. Restart Claude Desktop
|
|
56
|
+
|
|
57
|
+
The configuration file is typically located at:
|
|
58
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
59
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
60
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
61
|
+
|
|
62
|
+
## Prerequisites
|
|
63
|
+
|
|
64
|
+
Before using the MCP server, ensure you have:
|
|
65
|
+
|
|
66
|
+
1. An Intrig project initialized (`intrig init`)
|
|
67
|
+
2. API sources configured in your `intrig.config.js`
|
|
68
|
+
3. The Intrig daemon running (`intrig daemon up`)
|
|
69
|
+
|
|
70
|
+
The MCP server will automatically discover running Intrig daemons on your machine.
|
|
71
|
+
|
|
72
|
+
## Available Tools
|
|
73
|
+
|
|
74
|
+
### `list_projects`
|
|
75
|
+
|
|
76
|
+
List all registered Intrig projects and their daemon status.
|
|
77
|
+
|
|
78
|
+
**Example prompt:**
|
|
79
|
+
> "What Intrig projects are available?"
|
|
80
|
+
|
|
81
|
+
**Response includes:**
|
|
82
|
+
- Project name and path
|
|
83
|
+
- Daemon status (running/stopped)
|
|
84
|
+
- Port number
|
|
85
|
+
- Project type (react, next, etc.)
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### `get_project`
|
|
90
|
+
|
|
91
|
+
Get detailed information about a specific project, including API sources.
|
|
92
|
+
|
|
93
|
+
**Parameters:**
|
|
94
|
+
- `path` (required): Absolute or relative path to the project
|
|
95
|
+
|
|
96
|
+
**Example prompt:**
|
|
97
|
+
> "Show me the details of the project at /home/user/my-app"
|
|
98
|
+
|
|
99
|
+
**Response includes:**
|
|
100
|
+
- Project configuration
|
|
101
|
+
- List of API sources with their spec URLs
|
|
102
|
+
- Daemon status
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### `search`
|
|
107
|
+
|
|
108
|
+
Search for API endpoints and schemas in a project.
|
|
109
|
+
|
|
110
|
+
**Parameters:**
|
|
111
|
+
- `project` (required): Project path or name
|
|
112
|
+
- `query` (required): Search terms (endpoint names, paths, HTTP methods, type names)
|
|
113
|
+
- `type` (optional): Filter by "endpoint" or "schema"
|
|
114
|
+
- `source` (optional): Filter by API source ID
|
|
115
|
+
- `limit` (optional): Maximum results (default: 15)
|
|
116
|
+
|
|
117
|
+
**Example prompts:**
|
|
118
|
+
> "Search for user endpoints in my-app"
|
|
119
|
+
> "Find all POST endpoints related to authentication"
|
|
120
|
+
> "Search for the UserProfile schema"
|
|
121
|
+
|
|
122
|
+
**Tips:**
|
|
123
|
+
- Use specific terms: endpoint names, paths (`/api/users`), HTTP methods (`GET`, `POST`)
|
|
124
|
+
- This is keyword search, not semantic search
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### `get_documentation`
|
|
129
|
+
|
|
130
|
+
Get full documentation for an endpoint or schema.
|
|
131
|
+
|
|
132
|
+
**Parameters:**
|
|
133
|
+
- `project` (required): Project path or name
|
|
134
|
+
- `type` (required): "endpoint" or "schema"
|
|
135
|
+
- `id` (required): Resource ID from search results
|
|
136
|
+
|
|
137
|
+
**Example prompt:**
|
|
138
|
+
> "Show me the documentation for endpoint abc123"
|
|
139
|
+
|
|
140
|
+
**Response includes:**
|
|
141
|
+
- Full markdown documentation
|
|
142
|
+
- Request/response types
|
|
143
|
+
- Related types and endpoints for drill-down
|
|
144
|
+
|
|
145
|
+
## Debug Logging
|
|
146
|
+
|
|
147
|
+
Enable debug logging by setting the `DEBUG` environment variable:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
DEBUG=intrig-mcp npx @intrig/mcp
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
For more verbose output:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
DEBUG=intrig-mcp:* npx @intrig/mcp
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Debug logs are written to stderr and won't interfere with the MCP protocol.
|
|
160
|
+
|
|
161
|
+
## Troubleshooting
|
|
162
|
+
|
|
163
|
+
### "No registered Intrig projects found"
|
|
164
|
+
|
|
165
|
+
The MCP server discovers projects by scanning for running Intrig daemons. To register a project:
|
|
166
|
+
|
|
167
|
+
1. Navigate to your project directory
|
|
168
|
+
2. Run `intrig init` if you haven't already
|
|
169
|
+
3. Run `intrig daemon up` to start the daemon
|
|
170
|
+
|
|
171
|
+
### "Project not found"
|
|
172
|
+
|
|
173
|
+
Ensure the path you're using is correct and the daemon is running:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
cd /path/to/your/project
|
|
177
|
+
intrig daemon up
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### "Daemon unavailable"
|
|
181
|
+
|
|
182
|
+
The daemon may have stopped. Restart it:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
intrig daemon up
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Or check if it's running:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
intrig daemon status
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### "No API sources configured"
|
|
195
|
+
|
|
196
|
+
Add API sources to your `intrig.config.js`:
|
|
197
|
+
|
|
198
|
+
```javascript
|
|
199
|
+
export default {
|
|
200
|
+
sources: [
|
|
201
|
+
{
|
|
202
|
+
id: "my-api",
|
|
203
|
+
specUrl: "https://api.example.com/openapi.json"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
};
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Then sync the specifications:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
intrig sync
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Search returns no results
|
|
216
|
+
|
|
217
|
+
- Try different keywords (endpoint names, paths, type names)
|
|
218
|
+
- Remove type filters to search both endpoints and schemas
|
|
219
|
+
- Use partial matches (e.g., "user" instead of "getUserById")
|
|
220
|
+
|
|
221
|
+
## Related
|
|
222
|
+
|
|
223
|
+
- [Intrig Documentation](https://intrig.io/docs)
|
|
224
|
+
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
225
|
+
- [Claude Desktop](https://claude.ai/desktop)
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
MIT
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documentation formatter for converting daemon API responses to markdown.
|
|
3
|
+
* Combines Tab[] arrays into single markdown documents with proper headers.
|
|
4
|
+
*/
|
|
5
|
+
import { Tab, RestDocumentation, SchemaDocumentation, RelatedType } from '../types/daemon-api.js';
|
|
6
|
+
/**
|
|
7
|
+
* Combine multiple tabs into a markdown document.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatTabs(tabs: Tab[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Format endpoint documentation as a complete markdown document.
|
|
12
|
+
*
|
|
13
|
+
* @param doc - REST documentation from daemon API
|
|
14
|
+
* @param source - Optional source identifier for display
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatEndpointDocumentation(doc: RestDocumentation, source?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Extract related types from endpoint documentation for drill-down.
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractEndpointRelatedTypes(doc: RestDocumentation): RelatedType[];
|
|
21
|
+
/**
|
|
22
|
+
* Format schema documentation as a complete markdown document.
|
|
23
|
+
*
|
|
24
|
+
* @param doc - Schema documentation from daemon API
|
|
25
|
+
* @param source - Optional source identifier for display
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatSchemaDocumentation(doc: SchemaDocumentation, source?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Extract TypeScript type definition from schema tabs.
|
|
30
|
+
* Looks for "Typescript Type" tab and extracts the code block.
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractTypeScriptDefinition(doc: SchemaDocumentation): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Format endpoint documentation with inlined schema definitions.
|
|
35
|
+
*
|
|
36
|
+
* @param doc - REST documentation from daemon API
|
|
37
|
+
* @param schemas - Map of schema ID to SchemaDocumentation for inlining
|
|
38
|
+
* @param source - Optional source identifier for display
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatEndpointDocumentationWithSchemas(doc: RestDocumentation, schemas: Map<string, SchemaDocumentation>, source?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Formatted documentation result for MCP tool responses.
|
|
43
|
+
*/
|
|
44
|
+
export interface FormattedDocumentation {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
type: 'endpoint' | 'schema';
|
|
48
|
+
source?: string;
|
|
49
|
+
method?: string;
|
|
50
|
+
path?: string;
|
|
51
|
+
documentation: string;
|
|
52
|
+
relatedTypes: Array<{
|
|
53
|
+
name: string;
|
|
54
|
+
id: string;
|
|
55
|
+
}>;
|
|
56
|
+
relatedEndpoints: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
id: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a formatted documentation result for an endpoint.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createEndpointResult(doc: RestDocumentation, source?: string): FormattedDocumentation;
|
|
65
|
+
/**
|
|
66
|
+
* Create a formatted documentation result for an endpoint with inlined schemas.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createEndpointResultWithSchemas(doc: RestDocumentation, schemas: Map<string, SchemaDocumentation>, source?: string): FormattedDocumentation;
|
|
69
|
+
/**
|
|
70
|
+
* Create a formatted documentation result for a schema.
|
|
71
|
+
*/
|
|
72
|
+
export declare function createSchemaResult(doc: SchemaDocumentation, source?: string): FormattedDocumentation;
|
|
73
|
+
//# sourceMappingURL=documentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentation.d.ts","sourceRoot":"","sources":["../../../../../src/formatters/documentation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,GAAG,EACH,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAahC;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAM9C;AA2DD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,iBAAiB,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CA0BR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,iBAAiB,GACrB,WAAW,EAAE,CA2Bf;AAgFD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,mBAAmB,EACxB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAiCR;AAMD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CA0BnF;AAyED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CACpD,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACzC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAqCR;AAMD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,aAAa,EAAE,MAAM,CAAC;IAGtB,YAAY,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,gBAAgB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,iBAAiB,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,sBAAsB,CAYxB;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACzC,MAAM,CAAC,EAAE,MAAM,GACd,sBAAsB,CAgCxB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,mBAAmB,EACxB,MAAM,CAAC,EAAE,MAAM,GACd,sBAAsB,CAaxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/main.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server setup for Intrig.
|
|
3
|
+
* Configures stdio transport and registers all tools.
|
|
4
|
+
*/
|
|
5
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Create and configure the MCP server.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createServer(): Server;
|
|
10
|
+
/**
|
|
11
|
+
* Start the MCP server with stdio transport.
|
|
12
|
+
*/
|
|
13
|
+
export declare function startServer(): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAuBnE;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CA+ErC;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAQjD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get_documentation tool - Get full documentation for an endpoint or schema.
|
|
3
|
+
* For endpoints, inlines request/response type definitions to avoid drill-down.
|
|
4
|
+
*/
|
|
5
|
+
import type { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Tool schema for get_documentation.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getDocumentationTool: Tool;
|
|
10
|
+
/**
|
|
11
|
+
* Input type for get_documentation.
|
|
12
|
+
*/
|
|
13
|
+
interface GetDocumentationInput {
|
|
14
|
+
project: string;
|
|
15
|
+
type: 'endpoint' | 'schema';
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Handle get_documentation tool call.
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleGetDocumentation(input: GetDocumentationInput): Promise<CallToolResult>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=get-documentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-documentation.d.ts","sourceRoot":"","sources":["../../../../../../src/mcp/tools/get-documentation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAK/E;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,IAuBlC,CAAC;AAEF;;GAEG;AACH,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ;AAyED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAmNzB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get_project tool - Resolve a path to its Intrig project with sources.
|
|
3
|
+
* Auto-starts daemon if not running.
|
|
4
|
+
*/
|
|
5
|
+
import type { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Tool schema for get_project.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getProjectTool: Tool;
|
|
10
|
+
/**
|
|
11
|
+
* Input type for get_project.
|
|
12
|
+
*/
|
|
13
|
+
interface GetProjectInput {
|
|
14
|
+
path: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Handle get_project tool call.
|
|
18
|
+
*/
|
|
19
|
+
export declare function handleGetProject(input: GetProjectInput): Promise<CallToolResult>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=get-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-project.d.ts","sourceRoot":"","sources":["../../../../../../src/mcp/tools/get-project.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAI/E;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,IAc5B,CAAC;AAEF;;GAEG;AACH,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAmFtF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_projects tool - List all registered Intrig projects and their daemon status.
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Tool schema for list_projects.
|
|
7
|
+
*/
|
|
8
|
+
export declare const listProjectsTool: Tool;
|
|
9
|
+
/**
|
|
10
|
+
* Handle list_projects tool call.
|
|
11
|
+
*/
|
|
12
|
+
export declare function handleListProjects(): Promise<CallToolResult>;
|
|
13
|
+
//# sourceMappingURL=list-projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-projects.d.ts","sourceRoot":"","sources":["../../../../../../src/mcp/tools/list-projects.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAI/E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,IAS9B,CAAC;AAEF;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC,CA0ClE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* search tool - Search for endpoints and schemas across an Intrig project.
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Tool schema for search.
|
|
7
|
+
*/
|
|
8
|
+
export declare const searchTool: Tool;
|
|
9
|
+
/**
|
|
10
|
+
* Input type for search.
|
|
11
|
+
*/
|
|
12
|
+
interface SearchInput {
|
|
13
|
+
project: string;
|
|
14
|
+
query: string;
|
|
15
|
+
type?: 'endpoint' | 'schema';
|
|
16
|
+
source?: string;
|
|
17
|
+
limit?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Handle search tool call.
|
|
21
|
+
*/
|
|
22
|
+
export declare function handleSearch(input: SearchInput): Promise<CallToolResult>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../../../src/mcp/tools/search.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAI/E;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,IAgCxB,CAAC;AAEF;;GAEG;AACH,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAyI9E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for communicating with Intrig daemon REST API.
|
|
3
|
+
* Handles search, documentation retrieval, and source listing operations.
|
|
4
|
+
* Uses Node.js native http/https modules for compatibility with all Node versions.
|
|
5
|
+
*/
|
|
6
|
+
import { DaemonResult, SearchParams, SearchResponse, RestDocumentation, SchemaDocumentation, IntrigSourceConfig } from '../types/daemon-api.js';
|
|
7
|
+
interface RequestConfig {
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
retryCount?: number;
|
|
10
|
+
retryDelayMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Search for resources (endpoints and schemas) in the daemon.
|
|
14
|
+
*
|
|
15
|
+
* @param baseUrl - Base URL of the daemon (e.g., "http://localhost:5050")
|
|
16
|
+
* @param params - Search parameters
|
|
17
|
+
* @param config - Optional request configuration
|
|
18
|
+
*/
|
|
19
|
+
export declare function search(baseUrl: string, params: SearchParams, config?: RequestConfig): Promise<DaemonResult<SearchResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get endpoint documentation by ID.
|
|
22
|
+
*
|
|
23
|
+
* @param baseUrl - Base URL of the daemon
|
|
24
|
+
* @param id - Endpoint ID
|
|
25
|
+
* @param config - Optional request configuration
|
|
26
|
+
*/
|
|
27
|
+
export declare function getEndpointDocumentation(baseUrl: string, id: string, config?: RequestConfig): Promise<DaemonResult<RestDocumentation>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get schema documentation by ID.
|
|
30
|
+
*
|
|
31
|
+
* @param baseUrl - Base URL of the daemon
|
|
32
|
+
* @param id - Schema ID
|
|
33
|
+
* @param config - Optional request configuration
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSchemaDocumentation(baseUrl: string, id: string, config?: RequestConfig): Promise<DaemonResult<SchemaDocumentation>>;
|
|
36
|
+
/**
|
|
37
|
+
* List all configured API sources.
|
|
38
|
+
*
|
|
39
|
+
* @param baseUrl - Base URL of the daemon
|
|
40
|
+
* @param config - Optional request configuration
|
|
41
|
+
*/
|
|
42
|
+
export declare function listSources(baseUrl: string, config?: RequestConfig): Promise<DaemonResult<IntrigSourceConfig[]>>;
|
|
43
|
+
/**
|
|
44
|
+
* Search with a simpler interface, converting "endpoint"/"schema" to "rest"/"schema".
|
|
45
|
+
*
|
|
46
|
+
* @param baseUrl - Base URL of the daemon
|
|
47
|
+
* @param query - Search query
|
|
48
|
+
* @param type - Optional type filter ("endpoint" or "schema")
|
|
49
|
+
* @param source - Optional source filter
|
|
50
|
+
* @param limit - Optional result limit (default: 15)
|
|
51
|
+
*/
|
|
52
|
+
export declare function searchSimple(baseUrl: string, query: string, type?: 'endpoint' | 'schema', source?: string, limit?: number): Promise<DaemonResult<SearchResponse>>;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=daemon-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-client.d.ts","sourceRoot":"","sources":["../../../../../src/services/daemon-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EACL,YAAY,EAGZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAUhC,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAgOD;;;;;;GAMG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAuBvC;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAO1C;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAO5C;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAO7C;AAMD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,UAAU,GAAG,QAAQ,EAC5B,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAYvC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { DiscoveryMetadata, ProjectInfo, Result, DiscoveryError } from '../types/discovery.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the registry directory path for the current user.
|
|
4
|
+
* Format: {os.tmpdir()}/{username}.intrig/
|
|
5
|
+
*/
|
|
6
|
+
export declare function getRegistryDir(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Check if a port is in use via TCP probe.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isPortInUse(port: number): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Scan the registry directory for all registered projects.
|
|
13
|
+
* Returns an array of DiscoveryMetadata for valid JSON files.
|
|
14
|
+
* Skips corrupted or invalid files silently.
|
|
15
|
+
*/
|
|
16
|
+
export declare function scanRegistry(): DiscoveryMetadata[];
|
|
17
|
+
/**
|
|
18
|
+
* Check if a daemon is running by probing its port.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isDaemonRunning(metadata: DiscoveryMetadata): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* List all registered projects with their running status.
|
|
23
|
+
*/
|
|
24
|
+
export declare function listProjects(): Promise<ProjectInfo[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Wait for a daemon to be ready by polling its port.
|
|
27
|
+
* @param port The port to poll
|
|
28
|
+
* @param maxWaitMs Maximum time to wait in milliseconds (default: 10000)
|
|
29
|
+
* @param pollIntervalMs Polling interval in milliseconds (default: 500)
|
|
30
|
+
*/
|
|
31
|
+
export declare function waitForDaemonReady(port: number, maxWaitMs?: number, pollIntervalMs?: number): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Start a daemon for a project by spawning `intrig daemon up`.
|
|
34
|
+
* Returns a Result indicating success or failure.
|
|
35
|
+
*/
|
|
36
|
+
export declare function startDaemon(projectPath: string): Promise<Result<void, DiscoveryError>>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a path to its matching project.
|
|
39
|
+
* Checks if the input path equals or is a subdirectory of any registered project.
|
|
40
|
+
* Prefers exact matches over subdirectory matches.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveProjectPath(inputPath: string): DiscoveryMetadata | null;
|
|
43
|
+
/**
|
|
44
|
+
* Get a project by path, ensuring the daemon is running.
|
|
45
|
+
* Auto-starts the daemon if not running and waits for it to be ready.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getProject(inputPath: string): Promise<Result<ProjectInfo, DiscoveryError>>;
|
|
48
|
+
/**
|
|
49
|
+
* Find a project by name (exact match on projectName).
|
|
50
|
+
*/
|
|
51
|
+
export declare function findProjectByName(projectName: string): DiscoveryMetadata | null;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a project identifier (path or project name) to metadata.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveProjectIdentifier(identifier: string): DiscoveryMetadata | null;
|
|
56
|
+
/**
|
|
57
|
+
* Get a project by identifier (path or project name), ensuring daemon is running.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getProjectByIdentifier(identifier: string): Promise<Result<ProjectInfo, DiscoveryError>>;
|
|
60
|
+
//# sourceMappingURL=discovery.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/discovery.service.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,MAAM,EAIN,cAAc,EACf,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AASD;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMhE;AAmCD;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,iBAAiB,EAAE,CA4BlD;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnF;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAkB3D;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,SAAQ,EACjB,cAAc,SAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAWlB;AASD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CA4BvC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAiC9E;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAqD9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAG/E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CASrF;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAc9C"}
|