@ai-sdk/mcp 0.0.34 → 0.0.36

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 0.0.36
4
+
5
+ ### Patch Changes
6
+
7
+ - 98a5ad3: fix(mcp): preserve explicit stdio transport environment values
8
+
9
+ ## 0.0.35
10
+
11
+ ### Patch Changes
12
+
13
+ - bf29419: chore: enable dead code lint rules
14
+ - Updated dependencies [bf29419]
15
+ - @ai-sdk/provider-utils@3.0.39
16
+
3
17
  ## 0.0.34
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1240,11 +1240,9 @@ var SseMCPTransport = class {
1240
1240
  message: `MCP SSE Transport Error: POSTing to endpoint (HTTP ${response.status}): ${text}`
1241
1241
  });
1242
1242
  (_d = this.onerror) == null ? void 0 : _d.call(this, error);
1243
- return;
1244
1243
  }
1245
1244
  } catch (error) {
1246
1245
  (_e = this.onerror) == null ? void 0 : _e.call(this, error);
1247
- return;
1248
1246
  }
1249
1247
  };
1250
1248
  await attempt();
@@ -1794,102 +1792,74 @@ var DefaultMCPClient = class {
1794
1792
  params,
1795
1793
  options
1796
1794
  } = {}) {
1797
- try {
1798
- return this.request({
1799
- request: { method: "tools/list", params },
1800
- resultSchema: ListToolsResultSchema,
1801
- options
1802
- });
1803
- } catch (error) {
1804
- throw error;
1805
- }
1795
+ return this.request({
1796
+ request: { method: "tools/list", params },
1797
+ resultSchema: ListToolsResultSchema,
1798
+ options
1799
+ });
1806
1800
  }
1807
1801
  async callTool({
1808
1802
  name: name3,
1809
1803
  args,
1810
1804
  options
1811
1805
  }) {
1812
- try {
1813
- return this.request({
1814
- request: { method: "tools/call", params: { name: name3, arguments: args } },
1815
- resultSchema: CallToolResultSchema,
1816
- options: {
1817
- signal: options == null ? void 0 : options.abortSignal
1818
- }
1819
- });
1820
- } catch (error) {
1821
- throw error;
1822
- }
1806
+ return this.request({
1807
+ request: { method: "tools/call", params: { name: name3, arguments: args } },
1808
+ resultSchema: CallToolResultSchema,
1809
+ options: {
1810
+ signal: options == null ? void 0 : options.abortSignal
1811
+ }
1812
+ });
1823
1813
  }
1824
1814
  async listResourcesInternal({
1825
1815
  params,
1826
1816
  options
1827
1817
  } = {}) {
1828
- try {
1829
- return this.request({
1830
- request: { method: "resources/list", params },
1831
- resultSchema: ListResourcesResultSchema,
1832
- options
1833
- });
1834
- } catch (error) {
1835
- throw error;
1836
- }
1818
+ return this.request({
1819
+ request: { method: "resources/list", params },
1820
+ resultSchema: ListResourcesResultSchema,
1821
+ options
1822
+ });
1837
1823
  }
1838
1824
  async readResourceInternal({
1839
1825
  uri,
1840
1826
  options
1841
1827
  }) {
1842
- try {
1843
- return this.request({
1844
- request: { method: "resources/read", params: { uri } },
1845
- resultSchema: ReadResourceResultSchema,
1846
- options
1847
- });
1848
- } catch (error) {
1849
- throw error;
1850
- }
1828
+ return this.request({
1829
+ request: { method: "resources/read", params: { uri } },
1830
+ resultSchema: ReadResourceResultSchema,
1831
+ options
1832
+ });
1851
1833
  }
1852
1834
  async listResourceTemplatesInternal({
1853
1835
  options
1854
1836
  } = {}) {
1855
- try {
1856
- return this.request({
1857
- request: { method: "resources/templates/list" },
1858
- resultSchema: ListResourceTemplatesResultSchema,
1859
- options
1860
- });
1861
- } catch (error) {
1862
- throw error;
1863
- }
1837
+ return this.request({
1838
+ request: { method: "resources/templates/list" },
1839
+ resultSchema: ListResourceTemplatesResultSchema,
1840
+ options
1841
+ });
1864
1842
  }
1865
1843
  async listPromptsInternal({
1866
1844
  params,
1867
1845
  options
1868
1846
  } = {}) {
1869
- try {
1870
- return this.request({
1871
- request: { method: "prompts/list", params },
1872
- resultSchema: ListPromptsResultSchema,
1873
- options
1874
- });
1875
- } catch (error) {
1876
- throw error;
1877
- }
1847
+ return this.request({
1848
+ request: { method: "prompts/list", params },
1849
+ resultSchema: ListPromptsResultSchema,
1850
+ options
1851
+ });
1878
1852
  }
1879
1853
  async getPromptInternal({
1880
1854
  name: name3,
1881
1855
  args,
1882
1856
  options
1883
1857
  }) {
1884
- try {
1885
- return this.request({
1886
- request: { method: "prompts/get", params: { name: name3, arguments: args } },
1887
- resultSchema: GetPromptResultSchema,
1888
- options
1889
- });
1890
- } catch (error) {
1891
- throw error;
1892
- }
1858
+ return this.request({
1859
+ request: { method: "prompts/get", params: { name: name3, arguments: args } },
1860
+ resultSchema: GetPromptResultSchema,
1861
+ options
1862
+ });
1893
1863
  }
1894
1864
  async notification(notification) {
1895
1865
  const jsonrpcNotification = {
@@ -1907,44 +1877,40 @@ var DefaultMCPClient = class {
1907
1877
  } = {}) {
1908
1878
  var _a3;
1909
1879
  const tools = {};
1910
- try {
1911
- let listToolsResult = await this.listTools();
1912
- const toolDefinitions = [...listToolsResult.tools];
1913
- while (listToolsResult.nextCursor != null) {
1914
- listToolsResult = await this.listTools({
1915
- params: { cursor: listToolsResult.nextCursor }
1916
- });
1917
- toolDefinitions.push(...listToolsResult.tools);
1918
- }
1919
- for (const { name: name3, description, inputSchema } of toolDefinitions) {
1920
- if (schemas !== "automatic" && !Object.prototype.hasOwnProperty.call(schemas, name3)) {
1921
- continue;
1922
- }
1923
- const self = this;
1924
- const execute = async (args, options) => {
1925
- var _a4;
1926
- (_a4 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a4.throwIfAborted();
1927
- return self.callTool({ name: name3, args, options });
1928
- };
1929
- const toolWithExecute = schemas === "automatic" ? (0, import_provider_utils5.dynamicTool)({
1930
- description,
1931
- inputSchema: (0, import_provider_utils5.jsonSchema)({
1932
- ...inputSchema,
1933
- properties: (_a3 = inputSchema.properties) != null ? _a3 : {},
1934
- additionalProperties: false
1935
- }),
1936
- execute
1937
- }) : (0, import_provider_utils5.tool)({
1938
- description,
1939
- inputSchema: schemas[name3].inputSchema,
1940
- execute
1941
- });
1942
- tools[name3] = toolWithExecute;
1880
+ let listToolsResult = await this.listTools();
1881
+ const toolDefinitions = [...listToolsResult.tools];
1882
+ while (listToolsResult.nextCursor != null) {
1883
+ listToolsResult = await this.listTools({
1884
+ params: { cursor: listToolsResult.nextCursor }
1885
+ });
1886
+ toolDefinitions.push(...listToolsResult.tools);
1887
+ }
1888
+ for (const { name: name3, description, inputSchema } of toolDefinitions) {
1889
+ if (schemas !== "automatic" && !Object.prototype.hasOwnProperty.call(schemas, name3)) {
1890
+ continue;
1943
1891
  }
1944
- return tools;
1945
- } catch (error) {
1946
- throw error;
1892
+ const self = this;
1893
+ const execute = async (args, options) => {
1894
+ var _a4;
1895
+ (_a4 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a4.throwIfAborted();
1896
+ return self.callTool({ name: name3, args, options });
1897
+ };
1898
+ const toolWithExecute = schemas === "automatic" ? (0, import_provider_utils5.dynamicTool)({
1899
+ description,
1900
+ inputSchema: (0, import_provider_utils5.jsonSchema)({
1901
+ ...inputSchema,
1902
+ properties: (_a3 = inputSchema.properties) != null ? _a3 : {},
1903
+ additionalProperties: false
1904
+ }),
1905
+ execute
1906
+ }) : (0, import_provider_utils5.tool)({
1907
+ description,
1908
+ inputSchema: schemas[name3].inputSchema,
1909
+ execute
1910
+ });
1911
+ tools[name3] = toolWithExecute;
1947
1912
  }
1913
+ return tools;
1948
1914
  }
1949
1915
  listResources({
1950
1916
  params,