@fre4x/jules 1.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/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/__tests__/julesApiClient.test.d.ts +2 -0
- package/dist/__tests__/julesApiClient.test.d.ts.map +1 -0
- package/dist/__tests__/julesApiClient.test.js +49 -0
- package/dist/__tests__/julesApiClient.test.js.map +1 -0
- package/dist/__tests__/toolRegistration.test.d.ts +2 -0
- package/dist/__tests__/toolRegistration.test.d.ts.map +1 -0
- package/dist/__tests__/toolRegistration.test.js +21 -0
- package/dist/__tests__/toolRegistration.test.js.map +1 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +3 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mock.d.ts +43 -0
- package/dist/mock.d.ts.map +1 -0
- package/dist/mock.js +60 -0
- package/dist/mock.js.map +1 -0
- package/dist/schemas/julesSchemas.d.ts +84 -0
- package/dist/schemas/julesSchemas.d.ts.map +1 -0
- package/dist/schemas/julesSchemas.js +33 -0
- package/dist/schemas/julesSchemas.js.map +1 -0
- package/dist/services/julesApiClient.d.ts +17 -0
- package/dist/services/julesApiClient.d.ts.map +1 -0
- package/dist/services/julesApiClient.js +55 -0
- package/dist/services/julesApiClient.js.map +1 -0
- package/dist/tools/approvePlan.d.ts +3 -0
- package/dist/tools/approvePlan.d.ts.map +1 -0
- package/dist/tools/approvePlan.js +41 -0
- package/dist/tools/approvePlan.js.map +1 -0
- package/dist/tools/createSession.d.ts +3 -0
- package/dist/tools/createSession.d.ts.map +1 -0
- package/dist/tools/createSession.js +57 -0
- package/dist/tools/createSession.js.map +1 -0
- package/dist/tools/listSessions.d.ts +3 -0
- package/dist/tools/listSessions.d.ts.map +1 -0
- package/dist/tools/listSessions.js +70 -0
- package/dist/tools/listSessions.js.map +1 -0
- package/dist/tools/listSources.d.ts +3 -0
- package/dist/tools/listSources.d.ts.map +1 -0
- package/dist/tools/listSources.js +59 -0
- package/dist/tools/listSources.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fritzprix
|
|
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,71 @@
|
|
|
1
|
+
# Jules MCP Server
|
|
2
|
+
|
|
3
|
+
An MCP server implementation for [Jules API](https://developers.google.com/jules/api), allowing LLMs to interact directly with your automated Jules workflows.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. **Jules API Key**: Get your API Key from the Jules [Settings page](https://jules.google.com/settings#api).
|
|
8
|
+
* *Note: Currently, Jules is migrating its authentication methods. If you receive a `401 Unauthorized` indicating "API keys are not supported by this API," you may need to wait for further updates from the Jules platform or supply an OAuth2 Token in place of the API key if supported.*
|
|
9
|
+
|
|
10
|
+
## Installation & Usage
|
|
11
|
+
|
|
12
|
+
You can use the server directly via `npx` without installing it globally:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx jules-mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Environment Variables
|
|
19
|
+
|
|
20
|
+
The server requires the following environment variables:
|
|
21
|
+
|
|
22
|
+
- `JULES_API_KEY`: Your Jules API Key or Authentication Token.
|
|
23
|
+
|
|
24
|
+
## Configuration for Claude Desktop
|
|
25
|
+
|
|
26
|
+
To use this server with the Claude Desktop app, you need to add it to your configuration file.
|
|
27
|
+
|
|
28
|
+
**Config file locations:**
|
|
29
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
30
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
31
|
+
|
|
32
|
+
Add the following to your configuration, replacing `<YOUR_API_KEY>` with your actual Jules API key:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"jules": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": [
|
|
40
|
+
"-y",
|
|
41
|
+
"jules-mcp"
|
|
42
|
+
],
|
|
43
|
+
"env": {
|
|
44
|
+
"JULES_API_KEY": "<YOUR_API_KEY>"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Available Tools
|
|
52
|
+
|
|
53
|
+
The server implements the following tools:
|
|
54
|
+
|
|
55
|
+
- `jules_list_sources`: Find the IDs of sources (e.g., connected GitHub repos) you can interact with.
|
|
56
|
+
- `jules_create_session`: Start a new Jules coding session with a specific prompt and source context.
|
|
57
|
+
- `jules_list_sessions`: Check the status and output links (e.g., Pull Requests) of your sessions.
|
|
58
|
+
- `jules_approve_plan`: Approve a session's execution plan (if it was created with `requirePlanApproval=true`).
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Install dependencies
|
|
64
|
+
npm install
|
|
65
|
+
|
|
66
|
+
# Build the project
|
|
67
|
+
npm run build
|
|
68
|
+
|
|
69
|
+
# Run via MCP Inspector for testing
|
|
70
|
+
npm run inspector
|
|
71
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"julesApiClient.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/julesApiClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
4
|
+
import { julesApiRequest, handleApiError } from '../services/julesApiClient.js';
|
|
5
|
+
import { API_BASE_URL } from '../constants.js';
|
|
6
|
+
const mock = new MockAdapter(axios);
|
|
7
|
+
describe('julesApiClient', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
mock.reset();
|
|
10
|
+
process.env.JULES_API_KEY = 'test-api-key';
|
|
11
|
+
});
|
|
12
|
+
it('should make an authenticated GET request', async () => {
|
|
13
|
+
mock.onGet(`${API_BASE_URL}/v1alpha/sources`).reply(200, {
|
|
14
|
+
sources: [{ name: 'test-source' }]
|
|
15
|
+
});
|
|
16
|
+
const result = await julesApiRequest('/v1alpha/sources');
|
|
17
|
+
expect(result.sources[0].name).toBe('test-source');
|
|
18
|
+
expect(mock.history.get[0].headers?.['X-Goog-Api-Key']).toBe('test-api-key');
|
|
19
|
+
});
|
|
20
|
+
it('should throw error if JULES_API_KEY is missing', async () => {
|
|
21
|
+
delete process.env.JULES_API_KEY;
|
|
22
|
+
await expect(julesApiRequest('/v1alpha/sources')).rejects.toThrow('JULES_API_KEY environment variable is missing.');
|
|
23
|
+
});
|
|
24
|
+
it('should handle API errors correctly', async () => {
|
|
25
|
+
// Simulate a network call that fails with 401
|
|
26
|
+
mock.onGet(`${API_BASE_URL}/v1alpha/sources`).reply(401, {
|
|
27
|
+
error: { message: 'Unauthorized' }
|
|
28
|
+
});
|
|
29
|
+
try {
|
|
30
|
+
await julesApiRequest('/v1alpha/sources');
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const message = handleApiError(error);
|
|
34
|
+
expect(message).toContain('Error: Unauthorized (401)');
|
|
35
|
+
expect(message).toContain('Unauthorized');
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
it('should handle timeout errors correctly', async () => {
|
|
39
|
+
mock.onGet(`${API_BASE_URL}/v1alpha/sources`).timeout();
|
|
40
|
+
try {
|
|
41
|
+
await julesApiRequest('/v1alpha/sources');
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const message = handleApiError(error);
|
|
45
|
+
expect(message).toContain('Error: Request timed out.');
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=julesApiClient.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"julesApiClient.test.js","sourceRoot":"","sources":["../../src/__tests__/julesApiClient.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MA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E;SACrC,CAAC,CAAC;QAEH,IAAI,CAAC;YACD,MAAM,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;YACvD,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACpD,IAAI,CAAC,KAAK,CAAC,GAAG,YAAY,kBAAkB,CAAC,CAAC,OAAO,EAAE,CAAC;QAExD,IAAI,CAAC;YACD,MAAM,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolRegistration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/toolRegistration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { registerListSourcesTool } from '../tools/listSources.js';
|
|
4
|
+
import { registerCreateSessionTool } from '../tools/createSession.js';
|
|
5
|
+
import { registerListSessionsTool } from '../tools/listSessions.js';
|
|
6
|
+
import { registerApprovePlanTool } from '../tools/approvePlan.js';
|
|
7
|
+
describe('Tool Registration', () => {
|
|
8
|
+
it('should register all core jules tools', () => {
|
|
9
|
+
const server = new McpServer({ name: 'test', version: '1.0.0' });
|
|
10
|
+
const registerSpy = vi.spyOn(server, 'registerTool');
|
|
11
|
+
registerListSourcesTool(server);
|
|
12
|
+
registerCreateSessionTool(server);
|
|
13
|
+
registerListSessionsTool(server);
|
|
14
|
+
registerApprovePlanTool(server);
|
|
15
|
+
expect(registerSpy).toHaveBeenCalledWith('jules_list_sources', expect.any(Object), expect.any(Function));
|
|
16
|
+
expect(registerSpy).toHaveBeenCalledWith('jules_create_session', expect.any(Object), expect.any(Function));
|
|
17
|
+
expect(registerSpy).toHaveBeenCalledWith('jules_list_sessions', expect.any(Object), expect.any(Function));
|
|
18
|
+
expect(registerSpy).toHaveBeenCalledWith('jules_approve_plan', expect.any(Object), expect.any(Function));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=toolRegistration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolRegistration.test.js","sourceRoot":"","sources":["../../src/__tests__/toolRegistration.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,MAAM,WAAW,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAErD,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAChC,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAClC,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACjC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAEhC,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,oBAAoB,EACpB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,sBAAsB,EACtB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,qBAAqB,EACrB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CACpC,oBAAoB,EACpB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvB,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,iCAAiC,CAAC;AAC3D,eAAO,MAAM,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { IS_MOCK } from "./mock.js";
|
|
5
|
+
import { registerListSourcesTool } from "./tools/listSources.js";
|
|
6
|
+
import { registerCreateSessionTool } from "./tools/createSession.js";
|
|
7
|
+
import { registerListSessionsTool } from "./tools/listSessions.js";
|
|
8
|
+
import { registerApprovePlanTool } from "./tools/approvePlan.js";
|
|
9
|
+
const server = new McpServer({
|
|
10
|
+
name: "@fre4x/jules",
|
|
11
|
+
version: "1.0.4",
|
|
12
|
+
});
|
|
13
|
+
registerListSourcesTool(server);
|
|
14
|
+
registerCreateSessionTool(server);
|
|
15
|
+
registerListSessionsTool(server);
|
|
16
|
+
registerApprovePlanTool(server);
|
|
17
|
+
async function main() {
|
|
18
|
+
if (!IS_MOCK && !process.env.JULES_API_KEY) {
|
|
19
|
+
console.error("ERROR: JULES_API_KEY environment variable is required.");
|
|
20
|
+
console.error("Tip: Set MOCK=true to run in mock mode without an API key.");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
if (IS_MOCK) {
|
|
24
|
+
console.error("[jules] Running in MOCK mode — no API key required.");
|
|
25
|
+
}
|
|
26
|
+
const transport = new StdioServerTransport();
|
|
27
|
+
await server.connect(transport);
|
|
28
|
+
console.error("[jules] MCP server running via stdio");
|
|
29
|
+
}
|
|
30
|
+
main().catch((error) => {
|
|
31
|
+
console.error("Server error:", error);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
});
|
|
34
|
+
//# sourceMapp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AC,CAAC;AAC1D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const IS_MOCK: boolean;
|
|
2
|
+
export declare const MOCK_FIXTURES: {
|
|
3
|
+
listSources: {
|
|
4
|
+
sources: {
|
|
5
|
+
name: string;
|
|
6
|
+
id: string;
|
|
7
|
+
githubRepo: {
|
|
8
|
+
owner: string;
|
|
9
|
+
repo: string;
|
|
10
|
+
};
|
|
11
|
+
}[];
|
|
12
|
+
nextPageToken: undefined;
|
|
13
|
+
};
|
|
14
|
+
listSessions: {
|
|
15
|
+
sessions: {
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
prompt: string;
|
|
20
|
+
state: string;
|
|
21
|
+
pendingPlanApproval: boolean;
|
|
22
|
+
outputs: {
|
|
23
|
+
pullRequest: {
|
|
24
|
+
title: string;
|
|
25
|
+
url: string;
|
|
26
|
+
};
|
|
27
|
+
}[];
|
|
28
|
+
}[];
|
|
29
|
+
nextPageToken: undefined;
|
|
30
|
+
};
|
|
31
|
+
createSession: {
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
prompt: string;
|
|
36
|
+
state: string;
|
|
37
|
+
};
|
|
38
|
+
approvePlan: {
|
|
39
|
+
name: string;
|
|
40
|
+
state: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,SAAmE,CAAC;AAExF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDzB,CAAC"}
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const IS_MOCK = process.env.MOCK === "true" || process.env.JULES_MOCK === "true";
|
|
2
|
+
export const MOCK_FIXTURES = {
|
|
3
|
+
listSources: {
|
|
4
|
+
sources: [
|
|
5
|
+
{
|
|
6
|
+
name: "sources/github/fritzprix/b1te",
|
|
7
|
+
id: "src-001",
|
|
8
|
+
githubRepo: { owner: "fritzprix", repo: "b1te" },
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: "sources/github/fritzprix/demo-repo",
|
|
12
|
+
id: "src-002",
|
|
13
|
+
githubRepo: { owner: "fritzprix", repo: "demo-repo" },
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
nextPageToken: undefined,
|
|
17
|
+
},
|
|
18
|
+
listSessions: {
|
|
19
|
+
sessions: [
|
|
20
|
+
{
|
|
21
|
+
name: "sessions/12345",
|
|
22
|
+
id: "12345",
|
|
23
|
+
title: "Add pagination to HN server",
|
|
24
|
+
prompt: "Add limit/offset pagination to all list tools in the HN MCP server.",
|
|
25
|
+
state: "SUCCEEDED",
|
|
26
|
+
pendingPlanApproval: false,
|
|
27
|
+
outputs: [
|
|
28
|
+
{
|
|
29
|
+
pullRequest: {
|
|
30
|
+
title: "feat: add pagination to HN list tools",
|
|
31
|
+
url: "https://github.com/fritzprix/b1te/pull/42",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "sessions/67890",
|
|
38
|
+
id: "67890",
|
|
39
|
+
title: "Fix type errors in fred server",
|
|
40
|
+
prompt: "Remove all any types from the FRED MCP server implementation.",
|
|
41
|
+
state: "AWAITING_PLAN_APPROVAL",
|
|
42
|
+
pendingPlanApproval: true,
|
|
43
|
+
outputs: [],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
nextPageToken: undefined,
|
|
47
|
+
},
|
|
48
|
+
createSession: {
|
|
49
|
+
name: "sessions/99999",
|
|
50
|
+
id: "99999",
|
|
51
|
+
title: "Mock Session",
|
|
52
|
+
prompt: "This is a mock session created without a real API call.",
|
|
53
|
+
state: "PENDING",
|
|
54
|
+
},
|
|
55
|
+
approvePlan: {
|
|
56
|
+
name: "sessions/67890",
|
|
57
|
+
state: "IN_PROGRESS",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=mock.js.map
|
package/dist/mock.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,CAAC;AAExF,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,WAAW,EAAE;QACT,OAAO,EAAE;YACL;gBACI,IAAI,EAAE,+BAA+B;gBACrC,EAAE,EAAE,SAAS;gBACb,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;aACnD;YACD;gBACI,IAAI,EAAE,oCAAoC;gBAC1C,EAAE,EAAE,SAAS;gBACb,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE;aACxD;SACJ;QACD,aAAa,EAAE,SAAS;KAC3B;IACD,YAAY,EAAE;QACV,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,gBAAgB;gBACtB,EAAE,EAAE,OAAO;gBACX,KAAK,EAAE,6BAA6B;gBACpC,MAAM,EAAE,qEAAqE;gBAC7E,KAAK,EAAE,WAAW;gBAClB,mBAAmB,EAAE,KAAK;gBAC1B,OAAO,EAAE;oBACL;wBACI,WAAW,EAAE;4BACT,KAAK,EAAE,uCAAuC;4BAC9C,GAAG,EAAE,2CAA2C;yBACnD;qBACJ;iBACJ;aACJ;YACD;gBACI,IAAI,EAAE,gBAAgB;gBACtB,EAAE,EAAE,OAAO;gBACX,KAAK,EAAE,gCAAgC;gBACvC,MAAM,EAAE,+DAA+D;gBACvE,KAAK,EAAE,wBAAwB;gBAC/B,mBAAmB,EAAE,IAAI;gBACzB,OAAO,EAAE,EAAE;aACd;SACJ;QACD,aAAa,EAAE,SAAS;KAC3B;IACD,aAAa,EAAE;QACX,IAAI,EAAE,gBAAgB;QACtB,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,cAAc;QACrB,MAAM,EAAE,yDAAyD;QACjE,KAAK,EAAE,SAAS;KACnB;IACD,WAAW,EAAE;QACT,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,aAAa;KACvB;CACJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare enum ResponseFormat {
|
|
3
|
+
MARKDOWN = "markdown",
|
|
4
|
+
JSON = "json"
|
|
5
|
+
}
|
|
6
|
+
export declare const PaginationSchema: z.ZodObject<{
|
|
7
|
+
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
9
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
pageSize: number;
|
|
12
|
+
response_format: "markdown" | "json";
|
|
13
|
+
pageToken?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
pageSize?: number | undefined;
|
|
16
|
+
pageToken?: string | undefined;
|
|
17
|
+
response_format?: "markdown" | "json" | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const ListSourcesInputSchema: z.ZodObject<{
|
|
20
|
+
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
22
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
pageSize: number;
|
|
25
|
+
response_format: "markdown" | "json";
|
|
26
|
+
pageToken?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
pageSize?: number | undefined;
|
|
29
|
+
pageToken?: string | undefined;
|
|
30
|
+
response_format?: "markdown" | "json" | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
export type ListSourcesInput = z.infer<typeof ListSourcesInputSchema>;
|
|
33
|
+
export declare const CreateSessionInputSchema: z.ZodObject<{
|
|
34
|
+
prompt: z.ZodString;
|
|
35
|
+
source: z.ZodString;
|
|
36
|
+
startingBranch: z.ZodDefault<z.ZodString>;
|
|
37
|
+
automationMode: z.ZodDefault<z.ZodEnum<["AUTO_CREATE_PR", "NONE"]>>;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
requirePlanApproval: z.ZodDefault<z.ZodBoolean>;
|
|
40
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
response_format: "markdown" | "json";
|
|
43
|
+
prompt: string;
|
|
44
|
+
source: string;
|
|
45
|
+
startingBranch: string;
|
|
46
|
+
automationMode: "AUTO_CREATE_PR" | "NONE";
|
|
47
|
+
title: string;
|
|
48
|
+
requirePlanApproval: boolean;
|
|
49
|
+
}, {
|
|
50
|
+
prompt: string;
|
|
51
|
+
source: string;
|
|
52
|
+
title: string;
|
|
53
|
+
response_format?: "markdown" | "json" | undefined;
|
|
54
|
+
startingBranch?: string | undefined;
|
|
55
|
+
automationMode?: "AUTO_CREATE_PR" | "NONE" | undefined;
|
|
56
|
+
requirePlanApproval?: boolean | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export type CreateSessionInput = z.infer<typeof CreateSessionInputSchema>;
|
|
59
|
+
export declare const ListSessionsInputSchema: z.ZodObject<{
|
|
60
|
+
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
61
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
62
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
pageSize: number;
|
|
65
|
+
response_format: "markdown" | "json";
|
|
66
|
+
pageToken?: string | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
pageSize?: number | undefined;
|
|
69
|
+
pageToken?: string | undefined;
|
|
70
|
+
response_format?: "markdown" | "json" | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type ListSessionsInput = z.infer<typeof ListSessionsInputSchema>;
|
|
73
|
+
export declare const ApprovePlanInputSchema: z.ZodObject<{
|
|
74
|
+
sessionId: z.ZodString;
|
|
75
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
response_format: "markdown" | "json";
|
|
78
|
+
sessionId: string;
|
|
79
|
+
}, {
|
|
80
|
+
sessionId: string;
|
|
81
|
+
response_format?: "markdown" | "json" | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
export type ApprovePlanInput = z.infer<typeof ApprovePlanInputSchema>;
|
|
84
|
+
//# sourceMappingURL=julesSchemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"julesSchemas.d.ts","sourceRoot":"","sources":["../../src/schemas/julesSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,oBAAY,cAAc;IACtB,QAAQ,aAAa;IACrB,IAAI,SAAS;CAChB;AAGD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAGH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAAmB,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAQnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG1E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAAmB,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAGxE,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// --- Enums ---
|
|
3
|
+
export var ResponseFormat;
|
|
4
|
+
(function (ResponseFormat) {
|
|
5
|
+
ResponseFormat["MARKDOWN"] = "markdown";
|
|
6
|
+
ResponseFormat["JSON"] = "json";
|
|
7
|
+
})(ResponseFormat || (ResponseFormat = {}));
|
|
8
|
+
// --- Common ---
|
|
9
|
+
export const PaginationSchema = z.object({
|
|
10
|
+
pageSize: z.number().int().min(1).max(100).default(20).describe("Maximum results to return"),
|
|
11
|
+
pageToken: z.string().optional().describe("Page token for retrieving the next page"),
|
|
12
|
+
response_format: z.enum(["markdown", "json"]).default("markdown").describe("Output format: 'markdown' or 'json'"),
|
|
13
|
+
});
|
|
14
|
+
// --- jules_list_sources ---
|
|
15
|
+
export const ListSourcesInputSchema = PaginationSchema;
|
|
16
|
+
// --- jules_create_session ---
|
|
17
|
+
export const CreateSessionInputSchema = z.object({
|
|
18
|
+
prompt: z.string().describe("The user's goal or prompt for the session."),
|
|
19
|
+
source: z.string().describe("The name of the source resource (e.g., 'sources/github/owner/repo')."),
|
|
20
|
+
startingBranch: z.string().default("main").describe("The starting branch for the repository."),
|
|
21
|
+
automationMode: z.enum(["AUTO_CREATE_PR", "NONE"]).default("NONE").describe("Whether to automatically create a PR ('AUTO_CREATE_PR' or 'NONE')."),
|
|
22
|
+
title: z.string().describe("The title of the session."),
|
|
23
|
+
requirePlanApproval: z.boolean().default(false).describe("If true, requires an explicit call to approve_plan to proceed."),
|
|
24
|
+
response_format: z.enum(["markdown", "json"]).default("markdown").describe("Output format: 'markdown' or 'json'"),
|
|
25
|
+
});
|
|
26
|
+
// --- jules_list_sessions ---
|
|
27
|
+
export const ListSessionsInputSchema = PaginationSchema;
|
|
28
|
+
// --- jules_approve_plan ---
|
|
29
|
+
export const ApprovePlanInputSchema = z.object({
|
|
30
|
+
sessionId: z.string().describe("The session ID or resource name (e.g., 'sessions/12345')."),
|
|
31
|
+
response_format: z.enum(["markdown", "json"]).default("markdown").describe("Output format: 'markdown' or 'json'"),
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=julesSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"julesSchemas.js","sourceRoot":"","sources":["../../src/schemas/julesSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,iBAAiB;AACjB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC5F,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IACpF,eAAe,EA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AE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IAC3F,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CACpH,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type ErrorResult = {
|
|
2
|
+
content: [{
|
|
3
|
+
type: "text";
|
|
4
|
+
text: string;
|
|
5
|
+
}];
|
|
6
|
+
isError: true;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Make an authenticated request to the Jules API.
|
|
10
|
+
*/
|
|
11
|
+
export declare function julesApiRequest<T>(endpoint: string, method?: "GET" | "POST" | "PUT" | "DELETE", data?: unknown, params?: Record<string, unknown>): Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Convert a caught error into a tool error result.
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleApiError(error: unknown): ErrorResult;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=julesApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"julesApiClient.d.ts","sourceRoot":"","sources":["../../src/services/julesApiClient.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAMhF;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAgB,EACjD,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,CAmBZ;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAwB1D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { API_BASE_URL } from "../constants.js";
|
|
3
|
+
function apiError(message) {
|
|
4
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Make an authenticated request to the Jules API.
|
|
8
|
+
*/
|
|
9
|
+
export async function julesApiRequest(endpoint, method = "GET", data, params) {
|
|
10
|
+
const apiKey = process.env.JULES_API_KEY;
|
|
11
|
+
if (!apiKey) {
|
|
12
|
+
throw new Error("JULES_API_KEY environment variable is missing.");
|
|
13
|
+
}
|
|
14
|
+
const response = await axios({
|
|
15
|
+
method,
|
|
16
|
+
url: `${API_BASE_URL}${endpoint.startsWith("/") ? endpoint : `/${endpoint}`}`,
|
|
17
|
+
data,
|
|
18
|
+
params,
|
|
19
|
+
timeout: 30000,
|
|
20
|
+
headers: {
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
"Accept": "application/json",
|
|
23
|
+
"X-Goog-Api-Key": apiKey,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return response.data;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Convert a caught error into a tool error result.
|
|
30
|
+
*/
|
|
31
|
+
export function handleApiError(error) {
|
|
32
|
+
if (error instanceof Error && error.message.includes("JULES_API_KEY")) {
|
|
33
|
+
return apiError(error.message);
|
|
34
|
+
}
|
|
35
|
+
if (axios.isAxiosError(error)) {
|
|
36
|
+
if (error.response) {
|
|
37
|
+
const status = error.response.status;
|
|
38
|
+
const data = error.response.data;
|
|
39
|
+
const detail = String(data?.error?.message ?? JSON.stringify(data) ?? "No details.");
|
|
40
|
+
switch (status) {
|
|
41
|
+
case 400: return apiError(`Bad Request (400): ${detail}`);
|
|
42
|
+
case 401: return apiError(`Unauthorized (401). Ensure JULES_API_KEY is correct. ${detail}`);
|
|
43
|
+
case 403: return apiError(`Forbidden (403). You do not have access to this resource. ${detail}`);
|
|
44
|
+
case 404: return apiError(`Not Found (404). The resource does not exist. ${detail}`);
|
|
45
|
+
case 429: return apiError(`Rate limit exceeded (429). Please wait before retrying. ${detail}`);
|
|
46
|
+
default: return apiError(`API request failed with status ${status}. ${detail}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (error.code === "ECONNABORTED") {
|
|
50
|
+
return apiError("Request timed out. Please try again.");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return apiError(`Unexpected error: ${error instanceof Error ? error.message : String(error)}`);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=julesApiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"julesApiClient.js","sourceRoot":"","sources":["../../src/services/julesApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,SAAS,QAAQ,CAAC,OAAe;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,QAAgB,EAChB,SAA4C,KAAK,EACjD,IAAc,EACd,MAAgC;IAEhC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACzC,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAI;QAC5B,MAAM;QACN,GAAG,EAAE,GAAG,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,C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AG,CAAC,CAAC,OAAO,QAAQ,CAAC,2DAA2D,MAAM,EAAE,CAAC,CAAC;gBAC/F,OAAO,CAAC,CAAE,OAAO,QAAQ,CAAC,kCAAkC,MAAM,KAAK,MAAM,EAAE,CAAC,CAAC;YACrF,CAAC;QACL,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,sCAAsC,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvePlan.d.ts","sourceRoot":"","sources":["../../src/tools/approvePlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAuCxD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { handleApiError, julesApiRequest } from "../services/julesApiClient.js";
|
|
2
|
+
import { ApprovePlanInputSchema, ResponseFormat } from "../schemas/julesSchemas.js";
|
|
3
|
+
import { CHARACTER_LIMIT } from "../constants.js";
|
|
4
|
+
import { IS_MOCK, MOCK_FIXTURES } from "../mock.js";
|
|
5
|
+
export function registerApprovePlanTool(server) {
|
|
6
|
+
server.registerTool("jules_approve_plan", {
|
|
7
|
+
title: "Approve Jules Session Plan",
|
|
8
|
+
description: "Approve a pending plan for a Jules session to proceed.",
|
|
9
|
+
inputSchema: ApprovePlanInputSchema,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: true,
|
|
13
|
+
idempotentHint: false,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
16
|
+
}, async (params) => {
|
|
17
|
+
const p = params;
|
|
18
|
+
try {
|
|
19
|
+
const endpoint = p.sessionId.includes("/")
|
|
20
|
+
? `/${p.sessionId}:approvePlan`
|
|
21
|
+
: `/v1alpha/sessions/${p.sessionId}:approvePlan`;
|
|
22
|
+
const data = IS_MOCK
|
|
23
|
+
? MOCK_FIXTURES.approvePlan
|
|
24
|
+
: await julesApiRequest(endpoint, "POST", {});
|
|
25
|
+
let textContent;
|
|
26
|
+
if (p.response_format === ResponseFormat.MARKDOWN) {
|
|
27
|
+
textContent = `# Plan Approved\n\nSuccessfully approved plan for session \`${p.sessionId}\`.\n\nUse \`jules_list_sessions\` to monitor progress.`;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
textContent = JSON.stringify({ success: true, session: p.sessionId, data }, null, 2);
|
|
31
|
+
}
|
|
32
|
+
if (textContent.length > CHARACTER_LIMIT)
|
|
33
|
+
textContent = textContent.slice(0, CHARACTER_LIMIT) + "\n...[truncated]";
|
|
34
|
+
return { content: [{ type: "text", text: textContent }] };
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return handleApiError(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=approvePlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvePlan.js","sourceRoot":"","sources":["../../src/tools/approvePlan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAoB,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACrD,MAAM,CAAC,YAAY,CACf,oBAAoB,EACpB;QACI,KAAK,EA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E,CAAC;YACb,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../src/tools/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAepE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAuD1D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { handleApiError, julesApiRequest } from "../services/julesApiClient.js";
|
|
2
|
+
import { CreateSessionInputSchema, ResponseFormat } from "../schemas/julesSchemas.js";
|
|
3
|
+
import { CHARACTER_LIMIT } from "../constants.js";
|
|
4
|
+
import { IS_MOCK, MOCK_FIXTURES } from "../mock.js";
|
|
5
|
+
export function registerCreateSessionTool(server) {
|
|
6
|
+
server.registerTool("jules_create_session", {
|
|
7
|
+
title: "Create Jules Session",
|
|
8
|
+
description: "Start a new automated coding session with Jules.",
|
|
9
|
+
inputSchema: CreateSessionInputSchema,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: false,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
16
|
+
}, async (params) => {
|
|
17
|
+
const p = params;
|
|
18
|
+
try {
|
|
19
|
+
const payload = {
|
|
20
|
+
prompt: p.prompt,
|
|
21
|
+
sourceContext: {
|
|
22
|
+
source: p.source,
|
|
23
|
+
githubRepoContext: { startingBranch: p.startingBranch },
|
|
24
|
+
},
|
|
25
|
+
automationMode: p.automationMode,
|
|
26
|
+
title: p.title,
|
|
27
|
+
requirePlanApproval: p.requirePlanApproval,
|
|
28
|
+
};
|
|
29
|
+
const data = IS_MOCK
|
|
30
|
+
? MOCK_FIXTURES.createSession
|
|
31
|
+
: await julesApiRequest("/v1alpha/sessions", "POST", payload);
|
|
32
|
+
let textContent;
|
|
33
|
+
if (p.response_format === ResponseFormat.MARKDOWN) {
|
|
34
|
+
const lines = [
|
|
35
|
+
`# Created Session: ${data.title ?? "Untitled"}`,
|
|
36
|
+
"",
|
|
37
|
+
`- **Name/ID**: ${data.name ?? data.id}`,
|
|
38
|
+
`- **Prompt**: ${data.prompt ?? p.prompt}`,
|
|
39
|
+
`- **Status**: ${data.state ?? "PENDING"}`,
|
|
40
|
+
"",
|
|
41
|
+
"You can check the progress of this session using the `jules_list_sessions` tool.",
|
|
42
|
+
];
|
|
43
|
+
textContent = lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
textContent = JSON.stringify(data, null, 2);
|
|
47
|
+
}
|
|
48
|
+
if (textContent.length > CHARACTER_LIMIT)
|
|
49
|
+
textContent = textContent.slice(0, CHARACTER_LIMIT) + "\n...[truncated]";
|
|
50
|
+
return { content: [{ type: "text", text: textContent }] };
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return handleApiError(error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=createSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../src/tools/createSession.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAsB,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAUpD,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACvD,MAAM,CAAC,YAAY,CACf,sBAAsB,EACtB;QACI,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,wBAAsD;Q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AAE,CAAC,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,WAAW,CAAC,MAAM,GAAG,eAAe;gBAAE,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,GAAG,kBAAkB,CAAC;YACnH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSessions.d.ts","sourceRoot":"","sources":["../../src/tools/listSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0BpE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,QAkEzD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { handleApiError, julesApiRequest } from "../services/julesApiClient.js";
|
|
2
|
+
import { ListSessionsInputSchema, ResponseFormat } from "../schemas/julesSchemas.js";
|
|
3
|
+
import { CHARACTER_LIMIT } from "../constants.js";
|
|
4
|
+
import { IS_MOCK, MOCK_FIXTURES } from "../mock.js";
|
|
5
|
+
export function registerListSessionsTool(server) {
|
|
6
|
+
server.registerTool("jules_list_sessions", {
|
|
7
|
+
title: "List Jules Sessions",
|
|
8
|
+
description: "List Jules sessions to check status or view outputs.",
|
|
9
|
+
inputSchema: ListSessionsInputSchema,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
16
|
+
}, async (params) => {
|
|
17
|
+
const p = params;
|
|
18
|
+
try {
|
|
19
|
+
const queryParams = { pageSize: p.pageSize };
|
|
20
|
+
if (p.pageToken)
|
|
21
|
+
queryParams.pageToken = p.pageToken;
|
|
22
|
+
const data = IS_MOCK
|
|
23
|
+
? MOCK_FIXTURES.listSessions
|
|
24
|
+
: await julesApiRequest("/v1alpha/sessions", "GET", undefined, queryParams);
|
|
25
|
+
const sessions = data?.sessions ?? [];
|
|
26
|
+
const nextPageToken = data?.nextPageToken;
|
|
27
|
+
if (!sessions.length) {
|
|
28
|
+
return { content: [{ type: "text", text: "No sessions found." }] };
|
|
29
|
+
}
|
|
30
|
+
const output = { sessions, nextPageToken };
|
|
31
|
+
let textContent;
|
|
32
|
+
if (p.response_format === ResponseFormat.MARKDOWN) {
|
|
33
|
+
const lines = ["# Jules Sessions", ""];
|
|
34
|
+
for (const session of sessions) {
|
|
35
|
+
lines.push(`## ${session.title ?? "Untitled"} (${session.name ?? session.id})`);
|
|
36
|
+
lines.push(`- **State**: ${session.state ?? "UNKNOWN"}`);
|
|
37
|
+
if (session.prompt)
|
|
38
|
+
lines.push(`- **Prompt**: ${session.prompt}`);
|
|
39
|
+
if (session.outputs?.length) {
|
|
40
|
+
lines.push("- **Outputs**:");
|
|
41
|
+
for (const out of session.outputs) {
|
|
42
|
+
if (out.pullRequest) {
|
|
43
|
+
lines.push(` - Pull Request: [${out.pullRequest.title}](${out.pullRequest.url})`);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
lines.push(` - ${JSON.stringify(out)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (session.pendingPlanApproval)
|
|
51
|
+
lines.push("- ⚠️ **Requires Plan Approval**: Use `jules_approve_plan` to approve.");
|
|
52
|
+
lines.push("");
|
|
53
|
+
}
|
|
54
|
+
if (nextPageToken)
|
|
55
|
+
lines.push(`**Next Page Token**: ${nextPageToken}`);
|
|
56
|
+
textContent = lines.join("\n");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
textContent = JSON.stringify(output, null, 2);
|
|
60
|
+
}
|
|
61
|
+
if (textContent.length > CHARACTER_LIMIT)
|
|
62
|
+
textContent = textContent.slice(0, CHARACTER_LIMIT) + "\n...[truncated]";
|
|
63
|
+
return { content: [{ type: "text", text: textContent }] };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return handleApiError(error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=listSessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSessions.js","sourceRoot":"","sources":["../../src/tools/listSessions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAqB,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAqBpD,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACtD,MAAM,CAAC,YAAY,CACf,qBAAqB,EACrB;QACI,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,sDAAsD;QACnE,WAAW,EAAE,uBAAqD;QAClE,WAAW,EAAE;YACT,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACvB;KACJ,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACb,MAAM,CAAC,GAAG,MAAsC,CAAC;QACjD,IAAI,CAAC;YACD,MAAM,WAAW,GAA4B,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;YACtE,IAAI,CAAC,CAAC,SAAS;gBAAE,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;YAErD,MAAM,IAAI,GAAG,OAAO;gBAChB,CAAC,CAAE,aAAa,CAAC,YAAqC;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DxD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { handleApiError, julesApiRequest } from "../services/julesApiClient.js";
|
|
2
|
+
import { ListSourcesInputSchema, ResponseFormat } from "../schemas/julesSchemas.js";
|
|
3
|
+
import { CHARACTER_LIMIT } from "../constants.js";
|
|
4
|
+
import { IS_MOCK, MOCK_FIXTURES } from "../mock.js";
|
|
5
|
+
export function registerListSourcesTool(server) {
|
|
6
|
+
// @ts-expect-error TS2589: ZodDefault chain triggers deep inference in MCP SDK 1.26
|
|
7
|
+
server.registerTool("jules_list_sources", {
|
|
8
|
+
title: "List Jules Sources",
|
|
9
|
+
description: "List available sources (repositories) connected to Jules.",
|
|
10
|
+
inputSchema: ListSourcesInputSchema,
|
|
11
|
+
annotations: {
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
}, async (params) => {
|
|
18
|
+
const p = params;
|
|
19
|
+
try {
|
|
20
|
+
const queryParams = { pageSize: p.pageSize };
|
|
21
|
+
if (p.pageToken)
|
|
22
|
+
queryParams.pageToken = p.pageToken;
|
|
23
|
+
const data = IS_MOCK
|
|
24
|
+
? MOCK_FIXTURES.listSources
|
|
25
|
+
: await julesApiRequest("/v1alpha/sources", "GET", undefined, queryParams);
|
|
26
|
+
const sources = data?.sources ?? [];
|
|
27
|
+
const nextPageToken = data?.nextPageToken;
|
|
28
|
+
if (!sources.length) {
|
|
29
|
+
return { content: [{ type: "text", text: "No sources found." }] };
|
|
30
|
+
}
|
|
31
|
+
const output = { sources, nextPageToken };
|
|
32
|
+
let textContent;
|
|
33
|
+
if (p.response_format === ResponseFormat.MARKDOWN) {
|
|
34
|
+
const lines = ["# Jules Sources", ""];
|
|
35
|
+
for (const source of sources) {
|
|
36
|
+
lines.push(`## ${source.name}`);
|
|
37
|
+
if (source.id)
|
|
38
|
+
lines.push(`- **ID**: ${source.id}`);
|
|
39
|
+
if (source.githubRepo)
|
|
40
|
+
lines.push(`- **GitHub Repo**: ${source.githubRepo.owner}/${source.githubRepo.repo}`);
|
|
41
|
+
lines.push("");
|
|
42
|
+
}
|
|
43
|
+
if (nextPageToken)
|
|
44
|
+
lines.push(`**Next Page Token**: ${nextPageToken}`);
|
|
45
|
+
textContent = lines.join("\n");
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
textContent = JSON.stringify(output, null, 2);
|
|
49
|
+
}
|
|
50
|
+
if (textContent.length > CHARACTER_LIMIT)
|
|
51
|
+
textContent = textContent.slice(0, CHARACTER_LIMIT) + "\n...[truncated]";
|
|
52
|
+
return { content: [{ type: "text", text: textContent }] };
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return handleApiError(error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=listSources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSources.js","sourceRoot":"","sources":["../../src/tools/listSources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAoB,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAapD,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACrD,oFAAoF;IACpF,MAAM,CAAC,YAAY,CACf,oBAAoB,EACpB;QACI,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE,sBAAoD;QACjE,WAAW,EAAE;YACT,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACvB;KACJ,EACD,KAAK,E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AAI,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;oBAC7G,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACnB,CAAC;gBACD,IAAI,aAAa;oBAAE,KAAK,CAAC,IAAI,CAAC,wBAAwB,aAAa,EAAE,CAAC,CAAC;gBACvE,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACJ,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAClD,CAAC;YAED,IAAI,WAAW,CAAC,MAAM,GAAG,eAAe;gBAAE,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,GAAG,kBAAkB,CAAC;YACnH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fre4x/jules",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "MCP server for Jules API integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"jules": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "node dist/index.js",
|
|
15
|
+
"dev": "tsx watch src/index.ts",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"inspector": "mcp-inspector node dist/index.js",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"author": "fritzprix <innocentevil0914@gmail.com>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": "https://github.com/fre4x/b1te",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
32
|
+
"axios": "^1.7.9",
|
|
33
|
+
"zod": "^3.24.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.10.0",
|
|
37
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
38
|
+
"axios-mock-adapter": "^2.1.0",
|
|
39
|
+
"tsx": "^4.19.2",
|
|
40
|
+
"typescript": "^5.7.2",
|
|
41
|
+
"vitest": "^4.0.18"
|
|
42
|
+
}
|
|
43
|
+
}
|