@meshcore/mcp-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MeshCore
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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,146 @@
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 { z } from "zod";
5
+ const API_BASE = "https://api.meshcore.ai";
6
+ const TOKEN = process.env.MESHCORE_API_TOKEN || "";
7
+ async function apiCall(path, options) {
8
+ const headers = {
9
+ "Content-Type": "application/json",
10
+ };
11
+ if (TOKEN) {
12
+ headers["Authorization"] = `Bearer ${TOKEN}`;
13
+ }
14
+ const resp = await fetch(`${API_BASE}${path}`, {
15
+ ...options,
16
+ headers: { ...headers, ...options?.headers },
17
+ });
18
+ if (!resp.ok) {
19
+ const text = await resp.text();
20
+ throw new Error(`API error ${resp.status}: ${text}`);
21
+ }
22
+ return resp.json();
23
+ }
24
+ const server = new McpServer({
25
+ name: "meshcore",
26
+ version: "1.0.0",
27
+ });
28
+ // Tool 1: Search marketplace
29
+ server.tool("meshcore_search", "Search the MeshCore AI agent marketplace by natural language query. Returns agents matching your search with name, description, pricing, and ID.", {
30
+ query: z.string().describe("Natural language search query (e.g. 'weather', 'summarize text', 'currency exchange')"),
31
+ type: z.enum(["AGENT", "TOOL", "LLM"]).optional().describe("Filter by agent type"),
32
+ limit: z.number().min(1).max(50).default(10).describe("Maximum number of results"),
33
+ }, async ({ query, type, limit }) => {
34
+ const params = new URLSearchParams({ query, limit: String(limit) });
35
+ const path = type
36
+ ? `/public/agents/search/by-type?${params}&type=${type}`
37
+ : `/public/agents/search?${params}`;
38
+ const results = await apiCall(path);
39
+ const formatted = results.map((a) => ({
40
+ id: a.id,
41
+ name: a.name,
42
+ description: a.description,
43
+ type: a.agentType,
44
+ pricing: a.pricingType === "FREE" ? "FREE" : `$${a.pricePerCall}/call`,
45
+ category: a.category,
46
+ }));
47
+ return {
48
+ content: [
49
+ {
50
+ type: "text",
51
+ text: JSON.stringify(formatted, null, 2),
52
+ },
53
+ ],
54
+ };
55
+ });
56
+ // Tool 2: Get agent details
57
+ server.tool("meshcore_agent_details", "Get full details about a specific agent including documentation, pricing, endpoint info, and team.", {
58
+ agentId: z.string().uuid().describe("The agent's UUID"),
59
+ }, async ({ agentId }) => {
60
+ const agent = await apiCall(`/public/${agentId}`);
61
+ return {
62
+ content: [
63
+ {
64
+ type: "text",
65
+ text: JSON.stringify(agent, null, 2),
66
+ },
67
+ ],
68
+ };
69
+ });
70
+ // Tool 3: Call an agent
71
+ server.tool("meshcore_call", "Call an agent through the MeshCore gateway. For paid agents, this will deduct from your wallet. The payload format depends on the specific agent.", {
72
+ agentId: z.string().uuid().describe("The agent's UUID to call"),
73
+ payload: z.record(z.any()).describe("The input payload for the agent (varies per agent)"),
74
+ }, async ({ agentId, payload }) => {
75
+ const result = await apiCall(`/gateway/call/${agentId}`, {
76
+ method: "POST",
77
+ body: JSON.stringify(payload),
78
+ });
79
+ return {
80
+ content: [
81
+ {
82
+ type: "text",
83
+ text: JSON.stringify(result, null, 2),
84
+ },
85
+ ],
86
+ };
87
+ });
88
+ // Tool 4: Check wallet balance
89
+ server.tool("meshcore_balance", "Check your MeshCore wallet balance. Requires MESHCORE_API_TOKEN to be set.", {}, async () => {
90
+ if (!TOKEN) {
91
+ return {
92
+ content: [
93
+ {
94
+ type: "text",
95
+ text: "Error: MESHCORE_API_TOKEN environment variable not set. Sign up at meshcore.ai to get your token.",
96
+ },
97
+ ],
98
+ };
99
+ }
100
+ const balance = await apiCall("/wallet/balance");
101
+ return {
102
+ content: [
103
+ {
104
+ type: "text",
105
+ text: JSON.stringify(balance, null, 2),
106
+ },
107
+ ],
108
+ };
109
+ });
110
+ // Tool 5: List agents/tools/LLMs
111
+ server.tool("meshcore_list", "List all available agents, tools, or LLMs on the MeshCore marketplace.", {
112
+ type: z
113
+ .enum(["agents", "tools", "llms", "all"])
114
+ .default("all")
115
+ .describe("Type of listings to return"),
116
+ }, async ({ type }) => {
117
+ const pathMap = {
118
+ agents: "/public/agents",
119
+ tools: "/public/tools",
120
+ llms: "/public/llms",
121
+ all: "/public/all",
122
+ };
123
+ const results = await apiCall(pathMap[type]);
124
+ const formatted = results.map((a) => ({
125
+ id: a.id,
126
+ name: a.name,
127
+ type: a.agentType,
128
+ pricing: a.pricingType === "FREE" ? "FREE" : `$${a.pricePerCall || a.pricePerInputToken}/call`,
129
+ description: a.description?.substring(0, 100),
130
+ }));
131
+ return {
132
+ content: [
133
+ {
134
+ type: "text",
135
+ text: JSON.stringify(formatted, null, 2),
136
+ },
137
+ ],
138
+ };
139
+ });
140
+ // Start server
141
+ async function main() {
142
+ const transport = new StdioServerTransport();
143
+ await server.connect(transport);
144
+ }
145
+ main().catch(console.error);
146
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,QAAQ,GAAG,yBAAyB,CAAC;AAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC;AAEnD,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,OAAqB;IACxD,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IACF,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAC;IAC/C,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE;QAC7C,GAAG,OAAO;QACV,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;KAC7C,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC;AAED,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;A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,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,SAAS;QACjB,OAAO,EAAE,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,kBAAkB,OAAO;QAC9F,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;KAC9C,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;aACzC;SACF;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@meshcore/mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for the MeshCore AI agent marketplace",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "meshcore-mcp-server": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/index.js",
13
+ "dev": "tsx src/index.ts"
14
+ },
15
+ "keywords": ["mcp", "meshcore", "ai-agents", "marketplace"],
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "@modelcontextprotocol/sdk": "^1.0.0",
19
+ "zod": "^3.22.0"
20
+ },
21
+ "devDependencies": {
22
+ "typescript": "^5.3.0",
23
+ "@types/node": "^20.10.0",
24
+ "tsx": "^4.7.0"
25
+ }
26
+ }
package/src/index.ts ADDED
@@ -0,0 +1,192 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import { z } from "zod";
6
+
7
+ const API_BASE = "https://api.meshcore.ai";
8
+ const TOKEN = process.env.MESHCORE_API_TOKEN || "";
9
+
10
+ async function apiCall(path: string, options?: RequestInit): Promise<any> {
11
+ const headers: Record<string, string> = {
12
+ "Content-Type": "application/json",
13
+ };
14
+ if (TOKEN) {
15
+ headers["Authorization"] = `Bearer ${TOKEN}`;
16
+ }
17
+
18
+ const resp = await fetch(`${API_BASE}${path}`, {
19
+ ...options,
20
+ headers: { ...headers, ...options?.headers },
21
+ });
22
+
23
+ if (!resp.ok) {
24
+ const text = await resp.text();
25
+ throw new Error(`API error ${resp.status}: ${text}`);
26
+ }
27
+
28
+ return resp.json();
29
+ }
30
+
31
+ const server = new McpServer({
32
+ name: "meshcore",
33
+ version: "1.0.0",
34
+ });
35
+
36
+ // Tool 1: Search marketplace
37
+ server.tool(
38
+ "meshcore_search",
39
+ "Search the MeshCore AI agent marketplace by natural language query. Returns agents matching your search with name, description, pricing, and ID.",
40
+ {
41
+ query: z.string().describe("Natural language search query (e.g. 'weather', 'summarize text', 'currency exchange')"),
42
+ type: z.enum(["AGENT", "TOOL", "LLM"]).optional().describe("Filter by agent type"),
43
+ limit: z.number().min(1).max(50).default(10).describe("Maximum number of results"),
44
+ },
45
+ async ({ query, type, limit }) => {
46
+ const params = new URLSearchParams({ query, limit: String(limit) });
47
+ const path = type
48
+ ? `/public/agents/search/by-type?${params}&type=${type}`
49
+ : `/public/agents/search?${params}`;
50
+
51
+ const results = await apiCall(path);
52
+
53
+ const formatted = results.map((a: any) => ({
54
+ id: a.id,
55
+ name: a.name,
56
+ description: a.description,
57
+ type: a.agentType,
58
+ pricing: a.pricingType === "FREE" ? "FREE" : `$${a.pricePerCall}/call`,
59
+ category: a.category,
60
+ }));
61
+
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text" as const,
66
+ text: JSON.stringify(formatted, null, 2),
67
+ },
68
+ ],
69
+ };
70
+ }
71
+ );
72
+
73
+ // Tool 2: Get agent details
74
+ server.tool(
75
+ "meshcore_agent_details",
76
+ "Get full details about a specific agent including documentation, pricing, endpoint info, and team.",
77
+ {
78
+ agentId: z.string().uuid().describe("The agent's UUID"),
79
+ },
80
+ async ({ agentId }) => {
81
+ const agent = await apiCall(`/public/${agentId}`);
82
+ return {
83
+ content: [
84
+ {
85
+ type: "text" as const,
86
+ text: JSON.stringify(agent, null, 2),
87
+ },
88
+ ],
89
+ };
90
+ }
91
+ );
92
+
93
+ // Tool 3: Call an agent
94
+ server.tool(
95
+ "meshcore_call",
96
+ "Call an agent through the MeshCore gateway. For paid agents, this will deduct from your wallet. The payload format depends on the specific agent.",
97
+ {
98
+ agentId: z.string().uuid().describe("The agent's UUID to call"),
99
+ payload: z.record(z.any()).describe("The input payload for the agent (varies per agent)"),
100
+ },
101
+ async ({ agentId, payload }) => {
102
+ const result = await apiCall(`/gateway/call/${agentId}`, {
103
+ method: "POST",
104
+ body: JSON.stringify(payload),
105
+ });
106
+
107
+ return {
108
+ content: [
109
+ {
110
+ type: "text" as const,
111
+ text: JSON.stringify(result, null, 2),
112
+ },
113
+ ],
114
+ };
115
+ }
116
+ );
117
+
118
+ // Tool 4: Check wallet balance
119
+ server.tool(
120
+ "meshcore_balance",
121
+ "Check your MeshCore wallet balance. Requires MESHCORE_API_TOKEN to be set.",
122
+ {},
123
+ async () => {
124
+ if (!TOKEN) {
125
+ return {
126
+ content: [
127
+ {
128
+ type: "text" as const,
129
+ text: "Error: MESHCORE_API_TOKEN environment variable not set. Sign up at meshcore.ai to get your token.",
130
+ },
131
+ ],
132
+ };
133
+ }
134
+
135
+ const balance = await apiCall("/wallet/balance");
136
+ return {
137
+ content: [
138
+ {
139
+ type: "text" as const,
140
+ text: JSON.stringify(balance, null, 2),
141
+ },
142
+ ],
143
+ };
144
+ }
145
+ );
146
+
147
+ // Tool 5: List agents/tools/LLMs
148
+ server.tool(
149
+ "meshcore_list",
150
+ "List all available agents, tools, or LLMs on the MeshCore marketplace.",
151
+ {
152
+ type: z
153
+ .enum(["agents", "tools", "llms", "all"])
154
+ .default("all")
155
+ .describe("Type of listings to return"),
156
+ },
157
+ async ({ type }) => {
158
+ const pathMap: Record<string, string> = {
159
+ agents: "/public/agents",
160
+ tools: "/public/tools",
161
+ llms: "/public/llms",
162
+ all: "/public/all",
163
+ };
164
+
165
+ const results = await apiCall(pathMap[type]);
166
+
167
+ const formatted = results.map((a: any) => ({
168
+ id: a.id,
169
+ name: a.name,
170
+ type: a.agentType,
171
+ pricing: a.pricingType === "FREE" ? "FREE" : `$${a.pricePerCall || a.pricePerInputToken}/call`,
172
+ description: a.description?.substring(0, 100),
173
+ }));
174
+
175
+ return {
176
+ content: [
177
+ {
178
+ type: "text" as const,
179
+ text: JSON.stringify(formatted, null, 2),
180
+ },
181
+ ],
182
+ };
183
+ }
184
+ );
185
+
186
+ // Start server
187
+ async function main() {
188
+ const transport = new StdioServerTransport();
189
+ await server.connect(transport);
190
+ }
191
+
192
+ main().catch(console.error);
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "declaration": true,
11
+ "sourceMap": true
12
+ },
13
+ "include": ["src/**/*"]
14
+ }