Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.17"
".": "0.1.0-alpha.18"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.1.0-alpha.18 (2026-01-07)

Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/Scan-Documents/node-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18)

### Bug Fixes

* **mcp:** fix options parsing ([950cadd](https://github.com/Scan-Documents/node-sdk/commit/950caddd288b4cf8f3d9b62248adfacb0a5ec86d))


### Chores

* break long lines in snippets into multiline ([69ff5c6](https://github.com/Scan-Documents/node-sdk/commit/69ff5c6d4226f137b8d796c338600f353e9c34ed))

## 0.1.0-alpha.17 (2026-01-06)

Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/Scan-Documents/node-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17)
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const client = new ScanDocuments({
apiKey: process.env['SCAN_DOCUMENTS_API_KEY'], // This is the default and can be omitted
});

const file = await client.files.upload({ file: fs.createReadStream('path/to/file'), name: 'REPLACE_ME' });
const file = await client.files.upload({
file: fs.createReadStream('path/to/file'),
name: 'REPLACE_ME',
});
```

### Request & Response types
Expand Down Expand Up @@ -84,8 +87,14 @@ await client.files.upload({ file: new File(['my bytes'], 'file'), name: 'File Na
await client.files.upload({ file: await fetch('https://somesite/file'), name: 'File Name' });

// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.files.upload({ file: await toFile(Buffer.from('my bytes'), 'file'), name: 'File Name' });
await client.files.upload({ file: await toFile(new Uint8Array([0, 1, 2]), 'file'), name: 'File Name' });
await client.files.upload({
file: await toFile(Buffer.from('my bytes'), 'file'),
name: 'File Name',
});
await client.files.upload({
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
name: 'File Name',
});
```

## Task operations
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scan-documents",
"version": "0.1.0-alpha.17",
"version": "0.1.0-alpha.18",
"description": "The official TypeScript library for the Scan Documents API",
"author": "Scan Documents <support@scan-documents.com>",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scan-documents-mcp",
"version": "0.1.0-alpha.17",
"version": "0.1.0-alpha.18",
"description": "The official MCP Server for the Scan Documents API",
"author": "Scan Documents <support@scan-documents.com>",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/mcp-server/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function parseCLIOptions(): CLIOptions {
const transport = argv.transport as 'stdio' | 'http';

return {
includeDocsTools,
...(includeDocsTools !== undefined && { includeDocsTools }),
transport,
port: argv.port,
socket: argv.socket,
Expand Down Expand Up @@ -87,6 +87,6 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
: defaultOptions.includeDocsTools;

return {
includeDocsTools: docsTools,
...(docsTools !== undefined && { includeDocsTools: docsTools }),
};
}
2 changes: 1 addition & 1 deletion packages/mcp-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const newMcpServer = () =>
new McpServer(
{
name: 'scan_documents_api',
version: '0.1.0-alpha.17',
version: '0.1.0-alpha.18',
},
{ capabilities: { tools: {}, logging: {} } },
);
Expand Down
8 changes: 4 additions & 4 deletions packages/mcp-server/tests/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('parseCLIOptions', () => {
const result = parseCLIOptions();

expect(result.transport).toBe('http');
expect(result.port).toBe('2222');
expect(result.port).toBe(2222);
cleanup();
});
});
Expand All @@ -38,13 +38,13 @@ describe('parseQueryOptions', () => {
const query = '';
const result = parseQueryOptions(defaultOptions, query);

expect(result).toBe({});
expect(result).toEqual({});
});

it('should handle invalid query string gracefully', () => {
const query = 'invalid=value&operation=invalid-operation';
const query = 'invalid=value&tools=invalid-operation';

// Should throw due to Zod validation for invalid operation
// Should throw due to Zod validation for invalid tools
expect(() => parseQueryOptions(defaultOptions, query)).toThrow();
});
});
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.1.0-alpha.17'; // x-release-please-version
export const VERSION = '0.1.0-alpha.18'; // x-release-please-version
48 changes: 40 additions & 8 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ describe('instantiate client', () => {
error: jest.fn(),
};

const client = new ScanDocuments({ logger: logger, logLevel: 'debug', apiKey: 'My API Key' });
const client = new ScanDocuments({
logger: logger,
logLevel: 'debug',
apiKey: 'My API Key',
});

await forceAPIResponseForClient(client);
expect(debugMock).toHaveBeenCalled();
Expand All @@ -107,7 +111,11 @@ describe('instantiate client', () => {
error: jest.fn(),
};

const client = new ScanDocuments({ logger: logger, logLevel: 'info', apiKey: 'My API Key' });
const client = new ScanDocuments({
logger: logger,
logLevel: 'info',
apiKey: 'My API Key',
});

await forceAPIResponseForClient(client);
expect(debugMock).not.toHaveBeenCalled();
Expand Down Expand Up @@ -157,7 +165,11 @@ describe('instantiate client', () => {
};

process.env['SCAN_DOCUMENTS_LOG'] = 'debug';
const client = new ScanDocuments({ logger: logger, logLevel: 'off', apiKey: 'My API Key' });
const client = new ScanDocuments({
logger: logger,
logLevel: 'off',
apiKey: 'My API Key',
});

await forceAPIResponseForClient(client);
expect(debugMock).not.toHaveBeenCalled();
Expand All @@ -173,7 +185,11 @@ describe('instantiate client', () => {
};

process.env['SCAN_DOCUMENTS_LOG'] = 'not a log level';
const client = new ScanDocuments({ logger: logger, logLevel: 'debug', apiKey: 'My API Key' });
const client = new ScanDocuments({
logger: logger,
logLevel: 'debug',
apiKey: 'My API Key',
});
expect(client.logLevel).toBe('debug');
expect(warnMock).not.toHaveBeenCalled();
});
Expand Down Expand Up @@ -549,7 +565,11 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};

const client = new ScanDocuments({ apiKey: 'My API Key', timeout: 10, fetch: testFetch });
const client = new ScanDocuments({
apiKey: 'My API Key',
timeout: 10,
fetch: testFetch,
});

expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
expect(count).toEqual(2);
Expand Down Expand Up @@ -579,7 +599,11 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};

const client = new ScanDocuments({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
const client = new ScanDocuments({
apiKey: 'My API Key',
fetch: testFetch,
maxRetries: 4,
});

expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });

Expand All @@ -603,7 +627,11 @@ describe('retries', () => {
capturedRequest = init;
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
const client = new ScanDocuments({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
const client = new ScanDocuments({
apiKey: 'My API Key',
fetch: testFetch,
maxRetries: 4,
});

expect(
await client.request({
Expand Down Expand Up @@ -665,7 +693,11 @@ describe('retries', () => {
capturedRequest = init;
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
const client = new ScanDocuments({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
const client = new ScanDocuments({
apiKey: 'My API Key',
fetch: testFetch,
maxRetries: 4,
});

expect(
await client.request({
Expand Down