Skip to content

Commit 9d88abf

Browse files
committed
Everart and thinking server
1 parent 5a279e5 commit 9d88abf

File tree

9 files changed

+661
-1
lines changed

9 files changed

+661
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"@modelcontextprotocol/server-slack": "*",
2727
"@modelcontextprotocol/server-brave-search": "*",
2828
"@modelcontextprotocol/server-memory": "*",
29-
"@modelcontextprotocol/server-filesystem": "*"
29+
"@modelcontextprotocol/server-filesystem": "*",
30+
"@modelcontextprotocol/server-everart": "*",
31+
"@modelcontextprotocol/server-sequentialthinking": "*"
3032
}
3133
}

src/everart/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# EverArt MCP Server
2+
3+
Image generation server for Claude Desktop using EverArt's API.
4+
5+
## Install
6+
```bash
7+
npm install
8+
export EVERART_API_KEY=your_key_here
9+
```
10+
11+
## Config
12+
Add to Claude Desktop config:
13+
```json
14+
{
15+
"mcpServers": {
16+
"everart": {
17+
"command": "npx",
18+
"args": ["-y", "@modelcontextprotocol/server-everart"],
19+
"env": {
20+
"EVERART_API_KEY": "your_key_here"
21+
}
22+
}
23+
}
24+
}
25+
```
26+
27+
## Tools
28+
29+
### generate_image
30+
Generates images with multiple model options. Opens result in browser and returns URL.
31+
32+
Parameters:
33+
```typescript
34+
{
35+
prompt: string, // Image description
36+
model?: string, // Model ID (default: "207910310772879360")
37+
image_count?: number // Number of images (default: 1)
38+
}
39+
```
40+
41+
Models:
42+
- 5000: FLUX1.1 (standard)
43+
- 9000: FLUX1.1-ultra
44+
- 6000: SD3.5
45+
- 7000: Recraft-Real
46+
- 8000: Recraft-Vector
47+
48+
All images generated at 1024x1024.
49+
50+
Sample usage:
51+
```javascript
52+
const result = await client.callTool({
53+
name: "generate_image",
54+
arguments: {
55+
prompt: "A cat sitting elegantly",
56+
model: "7000",
57+
image_count: 1
58+
}
59+
});
60+
```
61+
62+
Response format:
63+
```
64+
Image generated successfully!
65+
The image has been opened in your default browser.
66+
67+
Generation details:
68+
- Model: 7000
69+
- Prompt: "A cat sitting elegantly"
70+
- Image URL: https://storage.googleapis.com/...
71+
72+
You can also click the URL above to view the image again.
73+
```

src/everart/index.ts

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#!/usr/bin/env node
2+
import EverArt from "everart";
3+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5+
import {
6+
CallToolRequestSchema,
7+
ListToolsRequestSchema,
8+
ListResourcesRequestSchema,
9+
ReadResourceRequestSchema,
10+
} from "@modelcontextprotocol/sdk/types.js";
11+
import fetch from "node-fetch";
12+
import open from "open";
13+
14+
const server = new Server(
15+
{
16+
name: "example-servers/everart",
17+
version: "0.1.0",
18+
},
19+
{
20+
capabilities: {
21+
tools: {},
22+
resources: {}, // Required for image resources
23+
},
24+
},
25+
);
26+
27+
if (!process.env.EVERART_API_KEY) {
28+
console.error("EVERART_API_KEY environment variable is not set");
29+
process.exit(1);
30+
}
31+
32+
const client = new EverArt.default(process.env.EVERART_API_KEY);
33+
34+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
35+
tools: [
36+
{
37+
name: "generate_image",
38+
description:
39+
"Generate images using EverArt Models and returns a clickable link to view the generated image. " +
40+
"The tool will return a URL that can be clicked to view the image in a browser. " +
41+
"Available models:\n" +
42+
"- 5000:FLUX1.1: Standard quality\n" +
43+
"- 9000:FLUX1.1-ultra: Ultra high quality\n" +
44+
"- 6000:SD3.5: Stable Diffusion 3.5\n" +
45+
"- 7000:Recraft-Real: Photorealistic style\n" +
46+
"- 8000:Recraft-Vector: Vector art style\n" +
47+
"\nThe response will contain a direct link to view the generated image.",
48+
inputSchema: {
49+
type: "object",
50+
properties: {
51+
prompt: {
52+
type: "string",
53+
description: "Text description of desired image",
54+
},
55+
model: {
56+
type: "string",
57+
description:
58+
"Model ID (5000:FLUX1.1, 9000:FLUX1.1-ultra, 6000:SD3.5, 7000:Recraft-Real, 8000:Recraft-Vector)",
59+
default: "5000",
60+
},
61+
image_count: {
62+
type: "number",
63+
description: "Number of images to generate",
64+
default: 1,
65+
},
66+
},
67+
required: ["prompt"],
68+
},
69+
},
70+
],
71+
}));
72+
73+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
74+
return {
75+
resources: [
76+
{
77+
uri: "everart://images",
78+
mimeType: "image/png",
79+
name: "Generated Images",
80+
},
81+
],
82+
};
83+
});
84+
85+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
86+
if (request.params.uri === "everart://images") {
87+
return {
88+
contents: [
89+
{
90+
uri: "everart://images",
91+
mimeType: "image/png",
92+
blob: "", // Empty since this is just for listing
93+
},
94+
],
95+
};
96+
}
97+
throw new Error("Resource not found");
98+
});
99+
100+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
101+
if (request.params.name === "generate_image") {
102+
try {
103+
const {
104+
prompt,
105+
model = "207910310772879360",
106+
image_count = 1,
107+
} = request.params.arguments as any;
108+
109+
// Use correct EverArt API method
110+
const generation = await client.v1.generations.create(
111+
model,
112+
prompt,
113+
"txt2img",
114+
{
115+
imageCount: image_count,
116+
height: 1024,
117+
width: 1024,
118+
},
119+
);
120+
121+
// Wait for generation to complete
122+
const completedGen = await client.v1.generations.fetchWithPolling(
123+
generation[0].id,
124+
);
125+
126+
const imgUrl = completedGen.image_url;
127+
if (!imgUrl) throw new Error("No image URL");
128+
129+
// Automatically open the image URL in the default browser
130+
await open(imgUrl);
131+
132+
// Return a formatted message with the clickable link
133+
return {
134+
content: [
135+
{
136+
type: "text",
137+
text: `Image generated successfully!\nThe image has been opened in your default browser.\n\nGeneration details:\n- Model: ${model}\n- Prompt: "${prompt}"\n- Image URL: ${imgUrl}\n\nYou can also click the URL above to view the image again.`,
138+
},
139+
],
140+
};
141+
} catch (error: unknown) {
142+
console.error("Detailed error:", error);
143+
const errorMessage =
144+
error instanceof Error ? error.message : "Unknown error";
145+
return {
146+
content: [{ type: "text", text: `Error: ${errorMessage}` }],
147+
isError: true,
148+
};
149+
}
150+
}
151+
throw new Error(`Unknown tool: ${request.params.name}`);
152+
});
153+
154+
async function runServer() {
155+
const transport = new StdioServerTransport();
156+
await server.connect(transport);
157+
console.error("EverArt MCP Server running on stdio");
158+
}
159+
160+
runServer().catch(console.error);

src/everart/package.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "@modelcontextprotocol/server-everart",
3+
"version": "0.1.0",
4+
"description": "MCP server for EverArt API integration",
5+
"license": "MIT",
6+
"author": "Anthropic, PBC (https://anthropic.com)",
7+
"homepage": "https://modelcontextprotocol.io",
8+
"bugs": "https://github.com/modelcontextprotocol/servers/issues",
9+
"type": "module",
10+
"bin": {
11+
"mcp-server-everart": "dist/index.js"
12+
},
13+
"files": [
14+
"dist"
15+
],
16+
"scripts": {
17+
"build": "tsc && shx chmod +x dist/*.js",
18+
"prepare": "npm run build",
19+
"watch": "tsc --watch"
20+
},
21+
"dependencies": {
22+
"@modelcontextprotocol/sdk": "0.5.0",
23+
"everart": "^1.0.0",
24+
"node-fetch": "^3.3.2",
25+
"open": "^9.1.0"
26+
},
27+
"devDependencies": {
28+
"@types/node": "^20.11.0",
29+
"shx": "^0.3.4",
30+
"typescript": "^5.3.3"
31+
}
32+
}

src/everart/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./dist",
5+
"rootDir": "."
6+
},
7+
"include": [
8+
"./**/*.ts"
9+
]
10+
}

src/sequentialthinking/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
# Sequential Thinking MCP Server
3+
4+
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
5+
6+
## Features
7+
8+
- Break down complex problems into manageable steps
9+
- Revise and refine thoughts as understanding deepens
10+
- Branch into alternative paths of reasoning
11+
- Adjust the total number of thoughts dynamically
12+
- Generate and verify solution hypotheses
13+
14+
## Tool
15+
16+
### sequential_thinking
17+
18+
Facilitates a detailed, step-by-step thinking process for problem-solving and analysis.
19+
20+
**Inputs:**
21+
- `thought` (string): The current thinking step
22+
- `nextThoughtNeeded` (boolean): Whether another thought step is needed
23+
- `thoughtNumber` (integer): Current thought number
24+
- `totalThoughts` (integer): Estimated total thoughts needed
25+
- `isRevision` (boolean, optional): Whether this revises previous thinking
26+
- `revisesThought` (integer, optional): Which thought is being reconsidered
27+
- `branchFromThought` (integer, optional): Branching point thought number
28+
- `branchId` (string, optional): Branch identifier
29+
- `needsMoreThoughts` (boolean, optional): If more thoughts are needed
30+
31+
## Usage
32+
33+
The Sequential Thinking tool is designed for:
34+
- Breaking down complex problems into steps
35+
- Planning and design with room for revision
36+
- Analysis that might need course correction
37+
- Problems where the full scope might not be clear initially
38+
- Tasks that need to maintain context over multiple steps
39+
- Situations where irrelevant information needs to be filtered out
40+
41+
## Configuration
42+
43+
### Usage with Claude Desktop
44+
45+
Add this to your `claude_desktop_config.json`:
46+
47+
```json
48+
{
49+
"mcpServers": {
50+
"sequential-thinking": {
51+
"command": "npx",
52+
"args": [
53+
"-y",
54+
"@modelcontextprotocol/server-sequential-thinking"
55+
]
56+
}
57+
}
58+
}
59+
```
60+
61+
## License
62+
63+
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

0 commit comments

Comments
 (0)